Class: Gossip::TwitterCrony

Inherits:
Crony
  • Object
show all
Defined in:
lib/gossip/cronies/twitter.rb

Overview

TwitterCrony updates Twitter (www.twitter.com) status. Note: only the text of the scandal is used, not the details.

Instance Attribute Summary

Attributes inherited from Crony

#is_bff_by_default, #user_choices

Instance Method Summary collapse

Methods inherited from Crony

#add_bff_choice, #checked, #df, #initialize, #is_bff?, #is_bff_by_default?, #postprocess_user_choices

Constructor Details

This class inherits a constructor from Gossip::Crony

Instance Method Details

#add_configuration_choices(builder) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/gossip/cronies/twitter.rb', line 25

def add_configuration_choices(builder)
  builder.add_choice(:twitter_login,
                     :default => checked(:default_login)) { | command_line |
    command_line.uses_option("--twitter-login LOGIN", 
                             "Your Twitter login",
                             df(:default_login)
                             )
  }
  
  builder.add_choice(:twitter_password,
                     :default => checked(:default_password)) { | command_line |
    command_line.uses_option("--twitter-password PASSWORD", 
                             "Your Twitter password.",
                             df(:default_password)
                             )
  }
  
end

#command_line_descriptionObject



19
20
21
22
23
# File 'lib/gossip/cronies/twitter.rb', line 19

def command_line_description
    ["-t", "--twitter",
     "Control whether Twitter updates are made.",
     "Defaults to #{is_bff_by_default?}."]
end

#hear(scandal, details) ⇒ Object



44
45
46
47
# File 'lib/gossip/cronies/twitter.rb', line 44

def hear(scandal, details)
  twit = Twitter::Base.new(@user_choices[:twitter_login], @user_choices[:twitter_password])
  twit.update(scandal)
end

#nameObject



16
# File 'lib/gossip/cronies/twitter.rb', line 16

def name; "twitter"; end

#symbolObject



17
# File 'lib/gossip/cronies/twitter.rb', line 17

def symbol; :twitter; end