Module: Mackerel::REST::Monitor
- Included in:
- Client
- Defined in:
- lib/mackerel/monitor.rb
Instance Method Summary collapse
- #delete_monitor(monitor_id) ⇒ Object
- #get_monitors ⇒ Object
- #post_monitor(monitor) ⇒ Object
- #update_monitor(monitor_id, monitor) ⇒ Object
Instance Method Details
#delete_monitor(monitor_id) ⇒ Object
69 70 71 72 73 |
# File 'lib/mackerel/monitor.rb', line 69 def delete_monitor(monitor_id) command = ApiCommand.new(:delete, "/api/v0/monitors/#{monitor_id}", @api_key) data = command.execute(client) Mackerel::Monitor.new(data) end |
#get_monitors ⇒ Object
56 57 58 59 60 |
# File 'lib/mackerel/monitor.rb', line 56 def get_monitors() command = ApiCommand.new(:get,'/api/v0/monitors', @api_key) data = command.execute(client) data['monitors'].map{ |m| Mackerel::Monitor.new(m) } end |
#post_monitor(monitor) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/mackerel/monitor.rb', line 49 def post_monitor(monitor) command = ApiCommand.new(:post, '/api/v0/monitors', @api_key) command.body = monitor.to_json data = command.execute(client) Mackerel::Monitor.new(data) end |
#update_monitor(monitor_id, monitor) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/mackerel/monitor.rb', line 62 def update_monitor(monitor_id, monitor) command = ApiCommand.new(:put, "/api/v0/monitors/#{monitor_id}", @api_key) command.body = monitor.to_json data = command.execute(client) Mackerel::Monitor.new(data) end |