Class: Mackerel::Alert
- Inherits:
-
Object
- Object
- Mackerel::Alert
- Defined in:
- lib/mackerel/alert.rb
Instance Attribute Summary collapse
-
#closedAt ⇒ Object
Returns the value of attribute closedAt.
-
#hostId ⇒ Object
Returns the value of attribute hostId.
-
#id ⇒ Object
Returns the value of attribute id.
-
#message ⇒ Object
Returns the value of attribute message.
-
#monitorId ⇒ Object
Returns the value of attribute monitorId.
-
#openedAt ⇒ Object
Returns the value of attribute openedAt.
-
#reason ⇒ Object
Returns the value of attribute reason.
-
#status ⇒ Object
Returns the value of attribute status.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Alert
constructor
A new instance of Alert.
- #to_h ⇒ Object
- #to_json(options = nil) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Alert
Returns a new instance of Alert.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mackerel/alert.rb', line 6 def initialize(args = {}) @id = args["id"] @status = args["status"] @monitorId = args["monitorId"] @type = args["type"] @hostId = args["hostId"] @value = args["value"] @message = args["message"] @reason = args["reason"] @openedAt = args["openedAt"] @closedAt = args["closedAt"] end |
Instance Attribute Details
#closedAt ⇒ Object
Returns the value of attribute closedAt.
4 5 6 |
# File 'lib/mackerel/alert.rb', line 4 def closedAt @closedAt end |
#hostId ⇒ Object
Returns the value of attribute hostId.
4 5 6 |
# File 'lib/mackerel/alert.rb', line 4 def hostId @hostId end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/mackerel/alert.rb', line 4 def id @id end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/mackerel/alert.rb', line 4 def @message end |
#monitorId ⇒ Object
Returns the value of attribute monitorId.
4 5 6 |
# File 'lib/mackerel/alert.rb', line 4 def monitorId @monitorId end |
#openedAt ⇒ Object
Returns the value of attribute openedAt.
4 5 6 |
# File 'lib/mackerel/alert.rb', line 4 def openedAt @openedAt end |
#reason ⇒ Object
Returns the value of attribute reason.
4 5 6 |
# File 'lib/mackerel/alert.rb', line 4 def reason @reason end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/mackerel/alert.rb', line 4 def status @status end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/mackerel/alert.rb', line 4 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/mackerel/alert.rb', line 4 def value @value end |
Instance Method Details
#to_h ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/mackerel/alert.rb', line 19 def to_h instance_variables.flat_map do |name| respond_to?(name[1..-1]) ? [name[1..-1]] : [] end.each_with_object({}) do |name, hash| hash[name] = public_send(name) end.delete_if { |key, val| val == nil } end |
#to_json(options = nil) ⇒ Object
27 28 29 |
# File 'lib/mackerel/alert.rb', line 27 def to_json( = nil) return to_h.to_json() end |