Module: Mackerel::REST::NotificationGroup
- Included in:
- Client
- Defined in:
- lib/mackerel/notification_group.rb
Instance Method Summary collapse
- #delete_notification_group(notification_group_id) ⇒ Object
- #get_notification_groups ⇒ Object
- #post_notification_group(notification_group) ⇒ Object
- #update_notification_group(notification_group_id, notification_group) ⇒ Object
Instance Method Details
#delete_notification_group(notification_group_id) ⇒ Object
51 52 53 54 55 |
# File 'lib/mackerel/notification_group.rb', line 51 def delete_notification_group(notification_group_id) command = ApiCommand.new(:delete, "/api/v0/notification-groups/#{notification_group_id}", @api_key) data = command.execute(client) Mackerel::NotificationGroup.new(data) end |
#get_notification_groups ⇒ Object
38 39 40 41 42 |
# File 'lib/mackerel/notification_group.rb', line 38 def get_notification_groups() command = ApiCommand.new(:get, '/api/v0/notification-groups', @api_key) data = command.execute(client) data['notificationGroups'].map{|a| Mackerel::NotificationGroup.new(a)} end |
#post_notification_group(notification_group) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/mackerel/notification_group.rb', line 31 def post_notification_group(notification_group) command = ApiCommand.new(:post, '/api/v0/notification-groups', @api_key) command.body = notification_group.to_json data = command.execute(client) Mackerel::NotificationGroup.new(data) end |
#update_notification_group(notification_group_id, notification_group) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/mackerel/notification_group.rb', line 44 def update_notification_group(notification_group_id, notification_group) command = ApiCommand.new(:put, "/api/v0/notification-groups/#{notification_group_id}", @api_key) command.body = notification_group.to_json data = command.execute(client) Mackerel::NotificationGroup.new(data) end |