Class: TotenDev::MetricController
- Inherits:
-
Controller
show all
- Defined in:
- lib/tdev_metrics/controllers/metric_controller.rb
Instance Attribute Summary
Attributes inherited from Controller
#base_url, #password, #username
Instance Method Summary
collapse
Methods inherited from Controller
#get, #initialize, #post, #request
Instance Method Details
#create(metric) ⇒ Object
11
12
13
14
|
# File 'lib/tdev_metrics/controllers/metric_controller.rb', line 11
def create( metric )
req = post 'info/create', metric.to_hash
req.is_a? Net::HTTPSuccess
end
|
#delete(id) ⇒ Object
21
22
23
24
|
# File 'lib/tdev_metrics/controllers/metric_controller.rb', line 21
def delete( id )
req = post "info/delete/#{id}"
req.is_a? Net::HTTPSuccess
end
|
#list(metric = nil, params = {}) ⇒ Object
26
27
28
29
30
|
# File 'lib/tdev_metrics/controllers/metric_controller.rb', line 26
def list( metric = nil, params = {} )
req = get list_endpoint_for_metric( metric ), params
return nil unless req.is_a? Net::HTTPSuccess
list_parse_response req.body
end
|
#update(id, metric) ⇒ Object
16
17
18
19
|
# File 'lib/tdev_metrics/controllers/metric_controller.rb', line 16
def update( id, metric )
req = post "info/update/#{id}", metric.to_hash
req.is_a? Net::HTTPSuccess
end
|