Integrating Facebook,twitter,google plus into another app - ruby-on-rails

Integrating facebook,twitter and google plus into another web app, so that the posts in that app are posted write away as status in facebook,tweets in twitter and status in google plus.I am developing this using ruby on rails.I searched a lot about this but didn't find anything which would work for me.Can post some links or ideas which would be helpful for this.

For Facebook I must suggest you to use Koala Gem...
For Twitter
Twitter
https://twitter.com/about/resources/buttons
A twitter button can be easily generated here and placed on your web site..Its working great. You can even customize everything in twitter.. Its so user friendly.
For Google plus
Google Plus
I am just working on Google plus..Facing some difficulties as its having so many restrictions.
Still I would Like to Share a link you can follow that..
How to share content from our site to google plus
I hope it will work fine...

I'd suggest to use Koala ( https://github.com/arsduo/koala/wiki ) to interface with Facebook. It's by far the best maintained fb library out there.
Otherwise, you should learn one thing or two about OAuth2:
https://github.com/intridea/oauth2
https://developers.facebook.com/docs/authentication/
https://developers.google.com/accounts/docs/OAuth2
Use https://github.com/sferik/twitter to interact with twitter.
For google, I've found that implementing the XML chat manually is easier than using any existing API wrapper. To convert XML responses into data, you an use a combination of the Response#parsed method of oauth2 gem and Array.wrap of ActiveSupport (there is no way for an XML parser to tell a single node to a possibly repeated node (so an array) that appears just once, avery big drawback of XML in my point of view)
Or you can directly ask google for JSON, so you already have the data correctly structured.
And, as #brendan-benson very correctly says, do only API calls in background workers, never in your normal request/responses cycle.

There are plenty of gems available to access these APIs:
Twitter API Wrapper
Facebook API Wrapper
Google Plus API Wrapper
Since APIs are flaky, it's best to use a queueing system like resque to queue the calls in Post#after_create, and then have a resque worker execute the call asynchronously.

Related

How can I get share count using the new Twitter Search APIs?

I wonder if it's still possible to use the Search API on client side using an AJAX call, C# would be fine too, but so far I'm finding a lot of talk about this but no code sample or any good instructions how this can be done,
Some sites like these are doing it but obviously this got way more complicated to do than before
I don't see any practice examples on https://dev.twitter.com/rest/public/search
Any suggestions?
As you've discovered, Twitter has turned off the sharecount API - see https://twittercommunity.com/t/a-new-design-for-tweet-and-follow-buttons/52791/5 and https://blog.twitter.com/developer/en_us/a/2015/hard-decisions-for-a-sustainable-platform.html
There are some alternatives like https://opensharecount.com/
That works by continually searching the Twitter API and counting up all the shares that it sees.

What is a good strategy for staying up-to-date with external API's?

My project is reliant on several API's, like Twitter and Youtube for example. Recently, Youtube deprecated their old API, and it caused issues with my team's iPad app.
We could have stayed ahead of the change if we were paying attention to Youtube's announcements of the upcoming deprecation. But alas, we were not and the idea of staying up to date with all of our dependencies manually(browsing the web) seems exhausting and inefficient.
I have found the following tool to help notify when changes occur with external library dependencies, https://libraries.io. However, this does not help with API dependencies.
Besides checking the API source webpages every so often, I was wondering if anyone had suggestions on how to stay notified and up-to-date with news regarding updates to a specified list of external API's?
After some time looking at different options, I have found a solution that is not perfect, but seems to work best at fitting this need.
Solution Description
This solution uses a combination of Twitter, Google Scripts, and website blogtrottr.com. I am creating a twitter list of reliable dev handles that often post updates on new API. For example I made a list that contained #twitterapi and #YouTubeDev. Used Google Scripts to create an online feed out of the twitter list. Then used blogtrottr to email me every time that feed gets a new posting.
Steps to Implement
Create a twitter list of reliable handles that often post about updates to their API
Create an RSS Feed from that Twitter list. The details for how to do this can be found here.
Plug that url that you get from Google Script into blogtrotter.
I did find some other ways to do this, but so far this is the only solution that was 100% free!

Display all tweets with a certain hashtag with simple design

I'm developing some website using Rails. I want to add "our users' tweets" part to the main page. I need an advice how I can do it better. I hoped to get standard way to do it, may be some Twitter widget or something else. I used Google, but I've found nothing. Please, point me to the right path. Sorry if my questions is very simple, but I don't really know how to do it. I hope that I needn't parse JSON and add styles independently; I need simple design from Twitter :)
To answer your [ambiguous] question, there are a number of things to consider:
How will you retrieve the tweets?
How will you store / access them?
How will the data be displayed on front-end?
The two methods you have are either to use the Twitter gem, or the TwitterFetcher JS plugin:
Gem
The Twitter gem uses the Twitter API to pull data from the official Twitter API. This means you've got the throttling & authentication to build into your app
The benefits of using this gem is it gives you a HUGE amount of flexibility with the data. You can pull as much data as you need / want, in whatever format you want - all formatted in JSON & can be displayed on your site
This gem is best suited to storing your tweets, either in a DB or in Redis etc, otherwise you'll have massive synchronous dependency on Twitter's API - which is never good for performance
JS
The TwitterFetcher JS plugin is epic - basically takes a Twitter widget & strips out the HTML, allowing you to style it how you like
This is the most effective way to retrieve Twitter data on-the-fly, as it's asynchronous, relies on Twitter's widget system (far more robust than API), and stores no data locally

using APIs with oauth for single user

I'm trying to make use of various APIs including twitter, youtube, etc because we want to embed recent entries (tweets, videos) on our website.
However, since I'm just retrieving my own data, I'm wondering how I can do this simpler than the multi-step process required by OAuth.
Twitter provides me with my own access token I can use directly, so that kinda works, but I can't find any such token in the YouTube documentation.
So how am I supposed to make use of the api if I just want to get a simple list of stuff? how exaclty am I supposed to authenticate my own website to use my own account?
I think i might have things all wrong and if so please point me in the right direction. I tried using rss feeds but they don't give me as much control over what I retrieve as using the API directly...
any insight or suggestions are appreciated!
see my comment above. summary: it depends on the requirements of the individual api

Getting stats for Twitter app

I'm using Twitter's OAuth for my app (DroidIn)
To my dismay I can't find any way to track who and how often is using the app. Searching Twitter for "sent from DroidIn" does not yield any results. I suppose I can call some sort of counter app from my code but that doesn't seem to be fair to my users. Any ideas or suggestions?
It seems that yet again I have to answer my own question. After some investigation and feedback from question posted on Google Twitter developer group it seems that for now there are no stats easily accessible or available. Said that I found 2 interesting things:
You can search Twitter using source:yourapp switch. For example you can try this query
android source:API
There is very exciting streaming API from Twitter. I have a short write-up in my dev blog.
But if you want some actual stats there's no other choice today but implement it as part of your app. There's one more possibility if you have some sort of web-based interface you may want to use Google Analytics to trigger some Google javascript while submitting the update. I'm trying that right now and may end up with article in the blog

Resources