Module: Mackerel::REST::Annotation
- Included in:
- Client
- Defined in:
- lib/mackerel/annotation.rb
Instance Method Summary collapse
- #delete_graph_annotation(annotation_id) ⇒ Object
- #get_graph_annotations(service, from, to) ⇒ Object
- #post_graph_annotation(annotation) ⇒ Object
- #update_graph_annotation(annotation_id, annotation) ⇒ Object
Instance Method Details
#delete_graph_annotation(annotation_id) ⇒ Object
54 55 56 57 58 |
# File 'lib/mackerel/annotation.rb', line 54 def delete_graph_annotation(annotation_id) command = ApiCommand.new(:delete, "/api/v0/graph-annotations/#{annotation_id}", @api_key) data = command.execute(client) Mackerel::Annotation.new(data) end |
#get_graph_annotations(service, from, to) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/mackerel/annotation.rb', line 38 def get_graph_annotations(service, from, to) command = ApiCommand.new(:get, '/api/v0/graph-annotations', @api_key) command.params['service'] = service command.params['from'] = from command.params['to'] = to data = command.execute(client) data['graphAnnotations'].map{|a| Mackerel::Annotation.new(a)} end |
#post_graph_annotation(annotation) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/mackerel/annotation.rb', line 31 def post_graph_annotation(annotation) command = ApiCommand.new(:post, '/api/v0/graph-annotations', @api_key) command.body = annotation.to_json data = command.execute(client) Mackerel::Annotation.new(data) end |
#update_graph_annotation(annotation_id, annotation) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/mackerel/annotation.rb', line 47 def update_graph_annotation(annotation_id, annotation) command = ApiCommand.new(:put, "/api/v0/graph-annotations/#{annotation_id}", @api_key) command.body = annotation.to_json data = command.execute(client) Mackerel::Annotation.new(data) end |