Class: Pushpop::Twitter
- Inherits:
-
Step
- Object
- Step
- Pushpop::Twitter
- Defined in:
- lib/pushpop-twitter.rb,
lib/pushpop-twitter/version.rb
Constant Summary collapse
- PLUGIN_NAME =
'twitter'- VERSION =
'0.1.0'
Instance Method Summary collapse
- #configure(last_response = nil, step_responses = nil) ⇒ Object
-
#favorite(tweet, options = {}) ⇒ Object
param tweet, tweet-sized JSON.
- #follow(username, options = {}) ⇒ Object
-
#initialize(*args) ⇒ Twitter
constructor
A new instance of Twitter.
- #run(last_response = nil, step_responses = nil) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Twitter
Returns a new instance of Twitter.
12 13 14 15 16 17 18 19 20 |
# File 'lib/pushpop-twitter.rb', line 12 def initialize(*args) super @twitter = ::Twitter::REST::Client.new do |config| config.consumer_key = ENV['TWITTER_CONSUMER_KEY'] config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET'] config.access_token = ENV['TWITTER_OAUTH_TOKEN'] config.access_token_secret = ENV['TWITTER_OAUTH_SECRET'] end end |
Instance Method Details
#configure(last_response = nil, step_responses = nil) ⇒ Object
50 51 52 |
# File 'lib/pushpop-twitter.rb', line 50 def configure(last_response=nil, step_responses=nil) self.instance_exec(last_response, step_responses, &block) end |
#favorite(tweet, options = {}) ⇒ Object
param tweet, tweet-sized JSON
44 45 46 47 48 |
# File 'lib/pushpop-twitter.rb', line 44 def favorite(tweet, ={}) @command = 'favorite' @tweet_id = tweet[:id_str] = end |
#follow(username, options = {}) ⇒ Object
37 38 39 40 41 |
# File 'lib/pushpop-twitter.rb', line 37 def follow(username, ={}) @command = 'follow' @username = username = end |
#run(last_response = nil, step_responses = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pushpop-twitter.rb', line 22 def run(last_response=nil, step_responses=nil) self.configure(last_response, step_responses) case @command when 'follow' @twitter.follow @username when 'favorite' @twitter.favorite @tweet_id else raise 'No command specified!' end end |