Class: God::Contacts::Sns
- Inherits:
-
Contact
- Object
- Contact
- God::Contacts::Sns
- Defined in:
- lib/god-sns-contact.rb
Class Attribute Summary collapse
-
.access_key_id ⇒ Object
Returns the value of attribute access_key_id.
-
.arn ⇒ Object
Returns the value of attribute arn.
-
.format ⇒ Object
Returns the value of attribute format.
-
.secret_access_key ⇒ Object
Returns the value of attribute secret_access_key.
Instance Attribute Summary collapse
-
#access_key_id ⇒ Object
Returns the value of attribute access_key_id.
-
#arn ⇒ Object
Returns the value of attribute arn.
-
#secret_access_key ⇒ Object
Returns the value of attribute secret_access_key.
Instance Method Summary collapse
Class Attribute Details
.access_key_id ⇒ Object
Returns the value of attribute access_key_id.
20 21 22 |
# File 'lib/god-sns-contact.rb', line 20 def access_key_id @access_key_id end |
.arn ⇒ Object
Returns the value of attribute arn.
20 21 22 |
# File 'lib/god-sns-contact.rb', line 20 def arn @arn end |
.format ⇒ Object
Returns the value of attribute format.
20 21 22 |
# File 'lib/god-sns-contact.rb', line 20 def format @format end |
.secret_access_key ⇒ Object
Returns the value of attribute secret_access_key.
20 21 22 |
# File 'lib/god-sns-contact.rb', line 20 def secret_access_key @secret_access_key end |
Instance Attribute Details
#access_key_id ⇒ Object
Returns the value of attribute access_key_id.
42 43 44 |
# File 'lib/god-sns-contact.rb', line 42 def access_key_id @access_key_id end |
#arn ⇒ Object
Returns the value of attribute arn.
42 43 44 |
# File 'lib/god-sns-contact.rb', line 42 def arn @arn end |
#secret_access_key ⇒ Object
Returns the value of attribute secret_access_key.
42 43 44 |
# File 'lib/god-sns-contact.rb', line 42 def secret_access_key @secret_access_key end |
Instance Method Details
#notify(message, time, priority, category, host) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/god-sns-contact.rb', line 44 def notify(, time, priority, category, host) AWS.config(:access_key_id => access_key_id, :secret_access_key => secret_access_key) topic = AWS::SNS::Topic.new(arn) topic.publish(Sns.format.call(, time, priority, category, host), :subject => "God Alert") self.info = "sent sns update" rescue => e applog(nil, :info, "failed to send sns update: #{e.}") applog(nil, :debug, e.backtrace.join("\n")) end |
#valid? ⇒ Boolean
34 35 36 37 38 39 40 |
# File 'lib/god-sns-contact.rb', line 34 def valid? valid = true valid &= complain("Attribute 'access_key_id' must be specified", self) unless arg(:access_key_id) valid &= complain("Attribute 'secret_access_key' must be specified", self) unless arg(:secret_access_key) valid &= complain("Attribute 'arn' must be specified", self) unless arg(:arn) valid end |