Display or not Apipie documentation - ruby-on-rails

I'm using Apipie on my Rails app. I'm also using Cancancan to manage authorizations according to user's status.
I was wondering if anyone has already try to join these 2 gems to allow users to see API documentation or not.
Basically, I'm wondering if there is any way to dismiss API Documentation according to variables.

well yes you can. You should write you own check of the authorization, but have a look at the second answer here: https://github.com/Apipie/apipie-rails/issues/349

Related

How to create Firebase Dynamic Links from the Admin SDK

Instead of creating a dynamic link inside the iOS app, is it possible to create dynamic links directly from the Admin SDK? For example, I listen for the creation of a document in the Admin SDK, and then create a dynamic link with its path.
Thanks!
As you can see from the Firebase Admin SDK documentation, working with Dynamic Links is not among the many things it can do.
It's possible #ken, Firebase's docs just refer to it as "Email Action Links". Now it depends on what you want to do with the dynamic links...
If your use case falls under one of these 3 generic categories (email password links / sign in / reset links), it's done for you.
https://firebase.google.com/docs/auth/admin/email-action-links
If you want to go beyond that, the API specifies an ActionCodeSettings field which has the parameter dynamicLinkDomain. You may be able to send a dynamic link like this anyway, even if its not explicitly handled for you.
Alternatively, you could make the dynamic links manually via this method, and write the link out in your Admin SDK area (whether thats Node.js or where-ever you're listening for document creation).
https://firebase.google.com/docs/dynamic-links/create-manually
You can do this but not directly from the Admin API. BigMcLargeHuge's answer is correct, but the documentation page from that answer doesn't explain how to generate short links (which is often more desirable).
The documentation that includes short links is here:
https://firebase.google.com/docs/dynamic-links/rest
You just have to make a post request.

how to get twitter feeds in shopify

I am trying to get twitter feeds in to my shopify site. I want to get the feeds and style them as I want and thus cant use a app.
I know how to do it using PHP but can not use that code in shopify and looking for a way I can use OAuth in shopify and get the feeds. I tried the shopify docs but without an example its kinda hard to actually get my head around it.
http://docs.shopify.com/api/tutorials/oauth
Thats the link I am using as a guide. If anyone can direct me to an example which might be similar that would be awesome. (google didnt seem to be that helpful this time either)
Cheers
I know you said you didn't want to use an app, but can I suggest taking a look at Twitify? You can use custom CSS to style your tweets. Also see discussions about Twitify here and here.
Twitter changed their display guidelines and policies on embedding of tweets on websites in June 2013. One of the themes I used for a client earlier in the year had custom styling of tweets, and they have now changed it to use the official Twitter widget to meet the new guidelines. In fact, the images on the Shopify theme store show how it used to look before Twitter changed things:
And after:
I think using an app like Twitify would be the easiest way to deal with these changes to embedding tweets.
Thanx for the suggestion. I did take a look at that before I posted this question. This is a project for a client and I dont think getting a plug in is a viable option. Anyways I found a work around.
Hosted the file on a server and then accessed it. So that resolved the problem. :)
I used node.js to write the script and get the posts as required.
Cheers.
you can use the app for that Twitify https://apps.shopify.com/twitify or you can Embed a Twitter feed in your online store
Go to your Twitter settings.
Click Widgets to open the widgets menu.
Create a new widget, following Twitter's instructions.
Copy the embed code.

Github Authentication API in Rails

I've been frustrated in my efforts to find information about this because a lot of the links posted on StackOverflow and elsewhere to related topics are 404'd. The Github API only says how to do things from the command line, and none of the gems I've found have given this kind of support. I know, however, that it is possible, because I've seen it done before.
How would I go about getting a user's current Github login information? That is, if a user is logged into Github, I want to find that out and use some of their user information in my website. If they are not logged in, I want to connect to Github to log them in.
Is there a gem for this, and if so, what is it and how does it work (if there isn't sufficient documentation)? If there isn't, then how do I go about using the Github API to do this in Ruby?
For authenticating with github, use the excellent omniauth gem with the (offcial) omniauth-github strategy.
You can see what basic information about the user you will get when the user authenticates with github here.
And here is a list of omniauth strategies that people have posted. For a good getting-started example, see the facebook strategy.
I found this blog post on using the Omniauth-Github gem. Provides a great tutorial top to bottom.
I used it today with no issues. Blog Post: Omniauth-Github Tutorial

Graph api in ruby on rails for add to timeline

Whats the best available plugin for add to timeline implementations in rails. I have already implemented fetching friends, I have fb token etc. I used https://github.com/appoxy/mini_fb gem for that.
I want to implement a functionality ie add_to_timeline. Something like pintrest has. Take a look on screenshot.
Whats the best possible Gem/guide for this.
PS: I am not asking for the code, an example is good to have, even guidance for the gem or plugin is even enough :)
This is facebook open graph. You'll have to define actions and objects. Read this:
https://developers.facebook.com/docs/opengraph/keyconcepts/
https://github.com/nov/fb_graph
app = FbGraph::Application.new(APP_ID)
me = FbGraph::User.me(ACCESS_TOKEN)
# Fetch activities
actions = me.og_actions app.og_action(:custom_action)
# Publish an activity
action = me.og_action!(
app.og_action(:custom_action),
:custom_object => 'http://samples.ogp.me/264755040233381')
https://github.com/nov/fb_graph/wiki/OpenGraph
And as kenny said, you'll have to create your own custom actions and objects on Facebook.

What is the best way to embed a user's tweets and mentions into a website?

I need to embed a specific user's recent tweets onto the home page of a website. The website is built in ASP.NET.
I've looked at the Twitter REST API and have tried using the user_timeline. It works but does not include mentions for the user. I want to include mentions but the only way to do it seems to be by using APIs that require authentication. I would prefer not to use authentication as it seems it would start to make things more complicated. I also do not want to get the current user to authenticate.
What is the best way to achieve this?
Use the GET search API instead. Search for statuses containing the user's #username, but in this case it will not return mentions from private/locked accounts since there's no authentication.
For example, if you want to search mentions for #stackexchange, call this.
GET http://search.twitter.com/search.json?q=#stackexchange
You could do a search for #username using the REST Search api. There's a good chance that would work :)

Resources