LyreBird
Twitter Gateway, allows your app to respond to natural language questions from Twitter.
Requirements
-
HTTParty github.com/jnunemaker/httparty/ - For accessing the Twitter web service.
SYNOPSIS
class LyresController
def index(response,history={},tweet_params={})
response.register_response(tweet_params) # Register the response that it can be persistent between tweets.
return "LyresController INDEX called" # Return text which will be used for the body of your response tweet.
end
def show(response,history={},tweet_params={})
response.register_response(tweet_params)
return "LyresController SHOW called"
end
end
require 'rubygems'
require 'lyre_bird'
routes = [
{ 'str' => "Do you have a :item for me" },
{
‘str’ => “:item in :location”, ‘class’ => ‘LyresController’, # Specify class to be called when this route is matched. ‘method’ => ‘show’
}
]
lyre = LyreBird::Base.new('<TWITTER_USERNAME>','<TWITTER_PASSWORD>', {
:routes => routes,
:since_filename => File.dirname(__FILE__) + '/listenSince.txt', # STRING - File used to store since_id,
:defaults => { :class => ‘LyresController’, # The default class you want to call when a response is successful :method => ‘index’ # The default method you want to call when a response is successful }
})
lyre.check() # Check for new messages.
Install
sudo gem sources -a http://gems.github.com
sudo gem install simonreed-lyrebird