Module: Mackerel::REST::Dashboard
- Included in:
- Client
- Defined in:
- lib/mackerel/dashboard.rb
Instance Method Summary collapse
- #delete_dashboard(dashboardId) ⇒ Object
- #get_dashboard(dashboardId) ⇒ Object
- #get_dashboards ⇒ Object
- #post_dashboard(title, markdown, urlPath) ⇒ Object
- #update_dashboard(dashboardId, title, markdown, urlPath) ⇒ Object
Instance Method Details
#delete_dashboard(dashboardId) ⇒ Object
64 65 66 67 68 |
# File 'lib/mackerel/dashboard.rb', line 64 def delete_dashboard(dashboardId) command = ApiCommand.new(:delete, "/api/v0/dashboards/#{dashboardId}", @api_key) data = command.execute(client) Mackerel::Dashboard.new(data) end |
#get_dashboard(dashboardId) ⇒ Object
58 59 60 61 62 |
# File 'lib/mackerel/dashboard.rb', line 58 def get_dashboard(dashboardId) command = ApiCommand.new(:get, "/api/v0/dashboards/#{dashboardId}", @api_key) data = command.execute(client) Mackerel::Dashboard.new(data) end |
#get_dashboards ⇒ Object
52 53 54 55 56 |
# File 'lib/mackerel/dashboard.rb', line 52 def get_dashboards() command = ApiCommand.new(:get, '/api/v0/dashboards', @api_key) data = command.execute(client) data['dashboards'].map{ |d| Mackerel::Dashboard.new(d) } end |
#post_dashboard(title, markdown, urlPath) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/mackerel/dashboard.rb', line 30 def post_dashboard(title, markdown, urlPath) command = ApiCommand.new(:post, '/api/v0/dashboards', @api_key) command.body = { title: title, bodyMarkdown: markdown, urlPath: urlPath }.to_json data = command.execute(client) Mackerel::Dashboard.new(data) end |
#update_dashboard(dashboardId, title, markdown, urlPath) ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/mackerel/dashboard.rb', line 41 def update_dashboard(dashboardId, title, markdown, urlPath) command = ApiCommand.new(:put, "/api/v0/dashboards/#{dashboardId}", @api_key) command.body = { title: title, bodyMarkdown: markdown, urlPath: urlPath }.to_json data = command.execute(client) Mackerel::Dashboard.new(data) end |