Class: God::Contacts::Twitter

Inherits:
God::Contact show all
Defined in:
lib/god/contacts/twitter.rb

Class Attribute Summary collapse

Attributes inherited from God::Contact

#group, #info, #name

Instance Method Summary collapse

Methods inherited from God::Contact

#friendly_name, generate, normalize, valid?

Methods included from God::Configurable

#base_name, complain, #complain, #friendly_name, #prepare, #reset

Class Attribute Details

.settingsObject

Returns the value of attribute settings.



20
21
22
# File 'lib/god/contacts/twitter.rb', line 20

def settings
  @settings
end

Instance Method Details

#notify(message, time, priority, category, host) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/god/contacts/twitter.rb', line 27

def notify(message, time, priority, category, host)
  begin
    ::Twitter::Base.new(Twitter.settings[:username], 
                        Twitter.settings[:password]).update(message)

    self.info = "sent twitter update as #{Twitter.settings[:username]}"
  rescue => e
    self.info = "failed to send twitter update from #{self.twitter_id}: #{e.message}"
  end
end

#valid?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/god/contacts/twitter.rb', line 23

def valid?
  valid = true
end