Class: God::Contacts::Twitter
- Inherits:
-
God::Contact
- Object
- God::Contact
- God::Contacts::Twitter
- Defined in:
- lib/god/contacts/twitter.rb
Class Attribute Summary collapse
-
.access_secret ⇒ Object
Returns the value of attribute access_secret.
-
.access_token ⇒ Object
Returns the value of attribute access_token.
-
.consumer_secret ⇒ Object
Returns the value of attribute consumer_secret.
-
.consumer_token ⇒ Object
Returns the value of attribute consumer_token.
Instance Attribute Summary collapse
-
#access_secret ⇒ Object
Returns the value of attribute access_secret.
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#consumer_secret ⇒ Object
Returns the value of attribute consumer_secret.
-
#consumer_token ⇒ Object
Returns the value of attribute consumer_token.
Attributes inherited from God::Contact
Instance Method Summary collapse
Methods inherited from God::Contact
#arg, defaults, #friendly_name, generate, normalize, valid?
Methods included from God::Configurable
#base_name, complain, #complain, #friendly_name, #prepare, #reset
Class Attribute Details
.access_secret ⇒ Object
Returns the value of attribute access_secret.
19 20 21 |
# File 'lib/god/contacts/twitter.rb', line 19 def access_secret @access_secret end |
.access_token ⇒ Object
Returns the value of attribute access_token.
19 20 21 |
# File 'lib/god/contacts/twitter.rb', line 19 def access_token @access_token end |
.consumer_secret ⇒ Object
Returns the value of attribute consumer_secret.
19 20 21 |
# File 'lib/god/contacts/twitter.rb', line 19 def consumer_secret @consumer_secret end |
.consumer_token ⇒ Object
Returns the value of attribute consumer_token.
19 20 21 |
# File 'lib/god/contacts/twitter.rb', line 19 def consumer_token @consumer_token end |
Instance Attribute Details
#access_secret ⇒ Object
Returns the value of attribute access_secret.
35 36 37 |
# File 'lib/god/contacts/twitter.rb', line 35 def access_secret @access_secret end |
#access_token ⇒ Object
Returns the value of attribute access_token.
35 36 37 |
# File 'lib/god/contacts/twitter.rb', line 35 def access_token @access_token end |
#consumer_secret ⇒ Object
Returns the value of attribute consumer_secret.
35 36 37 |
# File 'lib/god/contacts/twitter.rb', line 35 def consumer_secret @consumer_secret end |
#consumer_token ⇒ Object
Returns the value of attribute consumer_token.
35 36 37 |
# File 'lib/god/contacts/twitter.rb', line 35 def consumer_token @consumer_token end |
Instance Method Details
#notify(message, time, priority, category, host) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/god/contacts/twitter.rb', line 38 def notify(, time, priority, category, host) oauth = ::Twitter::OAuth.new(arg(:consumer_token), arg(:consumer_secret)) oauth.(arg(:access_token), arg(:access_secret)) ::Twitter::Base.new(oauth).update() self.info = "sent twitter update" rescue => e applog(nil, :info, "failed to send twitter update: #{e.}") applog(nil, :debug, e.backtrace.join("\n")) end |
#valid? ⇒ Boolean
26 27 28 29 30 31 32 33 |
# File 'lib/god/contacts/twitter.rb', line 26 def valid? valid = true valid &= complain("Attribute 'consumer_token' must be specified", self) unless arg(:consumer_token) valid &= complain("Attribute 'consumer_secret' must be specified", self) unless arg(:consumer_secret) valid &= complain("Attribute 'access_token' must be specified", self) unless arg(:access_token) valid &= complain("Attribute 'access_secret' must be specified", self) unless arg(:access_secret) valid end |