We are vastly using API integration for different purposes in our application. We did several API integration like Basecamp API integration,Twitter API integration.
We used Twitter API integration in ruzuku.com. In Twitter API integration, we can send data from our website to twitter and retrieve data from twitter website to our application by authenticating the user.
Sample Code for Retrieving data in Twitter:
@user = User.find(xxxx)
client = Twitter::Client.new(:login = 'xxxx', :password = 'xxxxxxx')
@tweets = client.timeline_for(:user, :id = xxxx)
//* In @tweets, we got values in hash *//
@tweets.each do |tweet|
//* In tweet, we can get a single record*//
//* Now we can get the data of a particular attributes like this*//
@progress_tweet.twitterid = tweet.user.screen_name
end
Sample Code for sending data in Twitter:
#==============================================#
client.message(:post, messages, id)
#==============================================#