Twitter bot with Rails - ruby-on-rails

I am trying to create a Twitter bot with Ruby on Rails but I just dont find any useful information on this manner...
Is it posible?
I tried with the GEM twibot but it is deprecated it is not longer useful.
Does Rails have a method for trigger events when (for example) a twit is posted?
Anyone have worked with something like this?
Any tutorial?
Any information at all that is in current use, I mean that does work today with the Twitter API (Many of the stuff I googled does not work now)?
Thank you very much.

Twitter itself is running on Rails, and it has a REST API. You could easily write your own solution with ActiveResource
You can get started with the ActiveResource videos on Railscasts

rails per se does not have any support for twitter. it's just an mvc-web-framework. but there are a lot of ruby gems for twitter. my favorite is this https://github.com/jnunemaker/twitter but you can find a lot more here https://www.ruby-toolbox.com/categories/api_clients.html

Related

Ruby On Rails Twitter Application

I am new to Ruby On Rails. I want to create a simple application which has a home page with a search box and a submit button. The search box is used for searching keywords on twitter dynamically. The application connects to twitter, takes all the feeds containing the keyword searched and displays back on the home page of my application. Can anyone please guide me how should i go about it ? I want to create an application from scratch. Please site any example for the same. Any suggestions would be helpful.
Thanks,
Bhargav
If you really want to start from scratch and not use any gems for it, you should go to the Twitter API reference, and start from there
I would recomend you use the twitter gem
RailsCasts has a nice episode on it, but the episode for Twitter Integration is not for free.
If you are looking into use Rails for a long time, a subscription is well worth it though.
Hope this helps
I recently wrote a small Twitter app from scratch (without the Twitter gem), maybe it is helpful:
https://github.com/sos4nt/jack-of-all-tweets
There's an instance running on Heroku: https://jack-of-all-tweets.herokuapp.com
You should probably use the twitter gem: https://github.com/sferik/twitter

Using Phaxio with Rails 3.1 app

I am trying to use the Phaxio API to include the ability to send faxes to customers from my Rails app, however I am having difficulty trying to implement it. I know Phaxio is new and there doesn't seem to be much on it except for what is provided by their online docs, which don't really cover too much and have no examples using rails.
From what I can gather from their docs is that I need to send a request to https://api.phaxio.com/v1/send along with some parameters. In their example they use curl to do this but how would I do this from a rails controller? Is their any helper libraries out there for this or will I have to write it from scratch? I might be swinging in the dark here but any help on this subject matter would be greatly appreciated.
Thanks
I just sent over an email to you, but I'll post some example code here as well. We're currently working on a Ruby helper for Phaxio, but here's some code that should help you get started in the mean time.
You'll need to gem install mime-types first.
http://pastebin.com/jfTLn6Bq
-Josh Nankin
Co-Founder, Phaxio

Rails 3 and Facebook share

in my app I want to have the "Share" Facebook thing in the items with a pre-defined message, so the user clicks in "Share" and gets redirected to the Allow/Deny page and after allowing, the pre-defined message is automatically posted in the user's facebook wall. What's the best gem for my problem(I am sure there is one :p)?
Thanks!
P.S: I looked at the facebooker gem but it seems out-of-date and I have to use the latest Rails 3.
Take a look at some related questions. Is fb_graph or Koala gem better than facebooker2? and Which Facebook Ruby API
I'm currently using a custom solution for our facebook integration but I have been looking moving to a gem and these seem to be the main choices:
koala
fb_graph
facebooker2
So far I agree with David from the "Which Facebook Ruby API" post and am leaning towards fb_graph because of its simplicity. It should handle your requirements without any problems, just take a look at the sample app.
koala seems to a better choice, as the remaining gems are outdated. Either they support the old facebook API or are not in active development.
I am successfully using koala with rails 3.
https://github.com/arsduo/koala

Is fb_graph or Koala ruby gem better than facebooker2, using the facebook graph?

Is the fb_graph gem better?
It seems to be newer, but the facebooker has a lot more people using.
http://github.com/nsanta/fbgraph
http://github.com/mmangino/facebooker
Update:
I looked into koala, and it seems it is a good choice as well.
http://github.com/arsduo/koala
I also figure out that fb_graph is different than fbgraph. This is the right one:
http://github.com/nov/fb_graph
And there is a new facebooker, that uses that Open Graph API, but it doesnt look as mature as the others:
http://github.com/wallace/facebooker2
I've been using Koala and have been very happy. It's very low level - meaning no abstractions that try to do stuff for you. The graph API is very straightforward, so this the best approach.
I ended up using Koala. It seems to be the best choice now. Facebooker2 is still very early stage, and Koala does a great job wrapping everything.
Don't get confused! Facebooker is for the old FB API!
The original Facebooker gem was split into two pieces for the new api - Facebooker2 for front-end helpers/auth and Mogli for back-end open graph api calls. Both are managed by the same person who did the original Facebooker gem - mike mangino - who does a great job of supporting both. Mogli is most directly comparable to Koala.
So far, I'm a big fan of koala, but I've not tried fb_graph. I did post a comparison of a few facebook gems here: http://jeffdeville.com/minifb-vs-koala-vs-mogli-facebook-graph-api-r

Which Ruby gems support the Facebook API?

I have a rails application using the Facebook API. I've seen several different Ruby gems for integrating with Facebook, but they look dated.
Is it best to write low-level calls myself? Is there a decent and current gem available?
Have any of these gems changed recently?
I'm beginning a new project -- which gem should I use as of September, 2012?
The Koala Gem is the way to go.
These Railscasts from July will tell you all you need to know about interacting with the Social Graph in Ruby and in Rails (both are paid episodes):
#361: Facebook Graph API: Learn how to use the Facebook Graph API with the Koala gem to fetch data from Facebook and post content through a user. Here I delve into permissions, error handling, and more.
#363: Facebook Open Graph: This episode builds on last week's episodes and shows how to integrate Facebook further through the Open Graph protocol. You will also learn how to tunnel your local server and move Facebook communication into a background process.
Having used it quite recently, I'd suggest Koala too. Pretty well documented, goes through the changes in api pretty smoothly, still maintained, and arsduo is a pretty cool guy.
According to this link,
With Facebook’s Graph API and the creation of the Open Graph protocol, it is now easier then ever before to read and write data from and to the “social graph”.
...
The following are proven to work with Ruby 1.9.x and Rails 3.0.0.
Gems
Cardinal Blue’s rest-graph
miniFB
FBGraph
Koala
Mogli
Plugins - Facebooker2
Middlewares
OmniAuth
rack-facebook
I would suggest either mogli or koala.
One known to have an active user base is facebooker2. The documentation is not really sufficient right now but its mailing list is very active, you get responses pretty quickly.
I've dug into the Koala deeply for my project, and I found it to be well written, solid code that has full test coverage. The main author, Alex Koppel, definitely knows what he's doing and he cares about the developer community. I needed to make a few improvements, which was easy thanks to the good architecture of the gem, and Alex was helpful in merging the changes into the master branch. Highly recommended.
The oauth2 from Intridea supports Facebook's Graph API.
Blog Post: http://intridea.com/2010/4/22/oauth2-gem-just-in-time-for-facebook-graph?blog=company
On github: http://github.com/intridea/oauth2
The sample source of Heroku's facebook application was used mogli,but now is koala.It is the best and great gem.Have a good group -- koala-users

Resources