Class: LyreBird::Twitter
- Inherits:
-
Object
- Object
- LyreBird::Twitter
- Includes:
- HTTParty
- Defined in:
- lib/lyre_bird/twitter.rb
Instance Method Summary collapse
-
#initialize(u, p) ⇒ Twitter
constructor
A new instance of Twitter.
-
#mentions(which = :mentions, options = {}) ⇒ Object
which can be :friends, :user or :public options can be things like since, since_id, count, etc.
- #post(text) ⇒ Object
-
#timeline(which = :friends, options = {}) ⇒ Object
which can be :friends, :user or :public options can be things like since, since_id, count, etc.
Constructor Details
#initialize(u, p) ⇒ Twitter
Returns a new instance of Twitter.
8 9 10 |
# File 'lib/lyre_bird/twitter.rb', line 8 def initialize(u, p) @auth = {:username => u, :password => p} end |
Instance Method Details
#mentions(which = :mentions, options = {}) ⇒ Object
which can be :friends, :user or :public options can be things like since, since_id, count, etc.
14 15 16 17 18 19 20 21 22 |
# File 'lib/lyre_bird/twitter.rb', line 14 def mentions(which=:mentions, ={}) since_id = [:since_id] = {} .merge!({:basic_auth => @auth}) url = "/statuses/#{which}.json?" url += "since_id=#{since_id}" unless since_id.nil? puts "Requesting #{url} from Twitter API using #{@auth.inspect}" self.class.get(url, ) end |
#post(text) ⇒ Object
31 32 33 34 35 |
# File 'lib/lyre_bird/twitter.rb', line 31 def post(text) puts "POSTING TO TWITTER - " + text if $lyre_debug = { :query => {:status => text}, :basic_auth => @auth } self.class.post('/statuses/update.json', ) end |
#timeline(which = :friends, options = {}) ⇒ Object
which can be :friends, :user or :public options can be things like since, since_id, count, etc.
26 27 28 29 |
# File 'lib/lyre_bird/twitter.rb', line 26 def timeline(which=:friends, ={}) .merge!({:basic_auth => @auth}) self.class.get("/statuses/#{which}_timeline.json", ) end |