I am developing in Rails 3 and I need to use the Facebook connect API (Graph).
I am currently trying out the Javascript SDK and it works fine. The problem is I do not know how to "save" and interact with the information I extract in Rails.
The best thing would be to use some "native" Rails plugin for Facebook. I have looked a bit on the Facebooker Plugin but I do not know how to get started and use it.
Does anyone know how to interact with the Facebook API with Rails 3?
You would need to integrate some kind of server-side logic. For instance, you could use your own JS to call FB's JS and then AJAX submit the data received back from FB to your server for persistence.
Then, you could use something like koala to make server side calls later to the OpenGraph API.
Facebook Graph API is HTTP based, so it works with any language that has an HTTP library, such as cURL, urllib. Just call appropriate url with appropriate data and you will get you data as JSON object.You can use facebook explorer tool for sandbox testing of your api. For rails koala gem just makes it easy to call API and extract info from response.
Related
I have a requirement to download attachments from Jira during event triggers and upload back to other supporting tool. For this purpose, started using WebHooks, during event trigger, json values will get passed thru post call. I have found Jira rest api also to get attachment download link to use it in webhooks. But this rest api requires valid authentication. I can't use basic login details to hard code in the script for downloading through URL.
How can I authorize this URL for getting the attachment. I heard that, we can establish OAuth and for this I need to enable application linking. At this stage, I am not sure how can I link the WebHook URL as an application. Current Hook is not a complete application it just accepts json as post and parses through it.
Need your support how to enable this OAuth and how to create that app. I am newbie to this WebHooks and OAuth concepts. so bare me for the generic queries .. :)
If there are any other possible solutions for my requirement are also welcomed.
Thank you..
I am building a Ruby on Rails (Rails - v4.2.3 & Ruby 2.2.2) App which consumes an existing REST API.
The aforementioned API is written in PHP.
I need help regarding how to manage the authentication?
On searching through various forums I came across these two gems
https://github.com/lynndylanhurley/devise_token_auth
https://github.com/gonzalo-bulnes/simple_token_authentication
The problem I am facing with both is that they require my app to have a users model configured (using Devise).
However My app is primarily a front end for the Existing REST API, so if I do configure my own User model, I will end up with two Data Stores (One for the APP I make and the other for the existing API).
I wish to consume the external API and not have any native models for my APP.
I believe I can use ActiveResource for this (I need more reputation points to post a link to the gem, sorry I cannot do that right now, I am new to StackOverflow):
However I am not sure how to go about managing the security of the application. More specifically what measures can I take to prevent the authentication information from being viewed in plaintext while it is being transmitted to my API server for authentication?
Thank You.
Use HTTPS on your API. If your external API is using HTTPS then user info wouldn't be sent in plaintext from your rails app.
Don't forget to use HTTPS for your rails app too, as that is more important.
How can I access the Appery.io (or any future db) that is exposed to the REST API using RoR?
So I have an app i built using Appery.io and I also created a test app using RoR that I would like to use to pull information from the Appery.io db and display it on my RoR app.
I am somewhat familiar with REST and get the idea of what it is doing but I am not to certain on how to connect or make a connection from my RoR app to my Appery.io app. Appery.io has the following documentation for their db api, Appery.io DB API .
I have been looking around and also have seen people mention the following gems for HTTP request:
Weary
HTTParty
RestClient
Would I use one of those? I also read about using Active Resource as a possible solution?
Any help with getting started or a tutorial or article to point me in the right direction would be very helpful.
Thanks!
You won't be establishing an ongoing connection, each request/response will be a single query to your Appery DB. You authenticate those calls using a custom header with API key as defined in the documentation. There's an example using cURL that might be a good place to start playing with the API before you pull it into your RoR app. That example shows you how to get your key, too.
It looks like you can use the predefined APIs, or you can define a custom REST API associated with your Appery app? Instructions for building an API appear to be here.
Once you get the calls working from cURL (or other web request client of your choice), adding the calls to the RoR app should be more straightforward. Any of those gems could probably ease that process: I've only used RestClient personally, but found it very straightforward.
Any of those call methods (cURL, other clients, the gems, etc) will allow you specify your URI, method (e.g. GET or POST), headers, request body (where appropriate), and will allow you to examine your response. Take a look at the gem documentation to see how those map exactly - it will vary slightly from tool to tool.
If you don't have prior experience with calling external APIs, and would like a conceptual explanation, I like this article as a (very short!) beginner's guide.
I have just completed Hartl's book on rails. Following the examples have been helpful and I have been able to build some very basic functionality for my app. However, there is this API I would like to use, and have been granted a key for the API. I have absolutely no idea how to start implementing the API. The other stuff surrounding API's have been helpful, but I literally am stuck on what the very first step should be to begin implementing the API.
I need for a user to be able to sign up and authenticate, then supply data that will be tracked through the external API. I've got the user sign up and authenticate stuff down pat, just need to know what the very first baby step to using this API should be.
The logic behind the answer would be equally helpful.
You can use ActiveResource for your model and point it to the external API. This is useful if your model uses an external data source.
http://api.rubyonrails.org/classes/ActiveResource/Base.html
If the external API you want to use is a well known, there is a good chance that there is already a gem for interaction with that API.
If you only need to send some data to the external API but your model does not use it as its source, you can use an HTTP client like Faraday https://github.com/technoweenie/faraday
I'm working on my senior project which has some data and I need to send it by twitter.
How to send this data by twitter dynamically?
Is it need a server or not?
Thanks
You can send it by Twitter API, by POST statuses/update service. Instead of dealing with Twitter API directly, you can use some library instead, depending on the language you're using (here' a nice one for Ruby. You don't need server.