Class: Mackerel::NotificationGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/mackerel/notification_group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ NotificationGroup

Returns a new instance of NotificationGroup.



5
6
7
8
9
10
11
12
13
# File 'lib/mackerel/notification_group.rb', line 5

def initialize(args = {})
  @id                              = args["id"]
  @name                            = args["name"]
  @notificationLevel               = args["notificationLevel"]
  @childNotificationGroupIds       = args["childNotificationGroupIds"]
  @childChannelIds                 = args["childChannelIds"]
  @monitors                        = args["monitors"]
  @services                        = args["services"]
end

Instance Attribute Details

#childChannelIdsObject

Returns the value of attribute childChannelIds.



4
5
6
# File 'lib/mackerel/notification_group.rb', line 4

def childChannelIds
  @childChannelIds
end

#childNotificationGroupIdsObject

Returns the value of attribute childNotificationGroupIds.



4
5
6
# File 'lib/mackerel/notification_group.rb', line 4

def childNotificationGroupIds
  @childNotificationGroupIds
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/mackerel/notification_group.rb', line 4

def id
  @id
end

#monitorsObject

Returns the value of attribute monitors.



4
5
6
# File 'lib/mackerel/notification_group.rb', line 4

def monitors
  @monitors
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/mackerel/notification_group.rb', line 4

def name
  @name
end

#notificationLevelObject

Returns the value of attribute notificationLevel.



4
5
6
# File 'lib/mackerel/notification_group.rb', line 4

def notificationLevel
  @notificationLevel
end

#servicesObject

Returns the value of attribute services.



4
5
6
# File 'lib/mackerel/notification_group.rb', line 4

def services
  @services
end

Instance Method Details

#to_hObject



15
16
17
18
19
20
21
# File 'lib/mackerel/notification_group.rb', line 15

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



23
24
25
# File 'lib/mackerel/notification_group.rb', line 23

def to_json(options = nil)
  return to_h.to_json(options)
end