Class: KalibroClient::Entities::Processor::MetricCollectorDetails

Inherits:
Base
  • Object
show all
Defined in:
lib/kalibro_client/entities/processor/metric_collector_details.rb

Instance Attribute Summary collapse

Attributes included from DateAttributes

#created_at, #updated_at

Attributes inherited from Base

#kalibro_errors, #persisted

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

address

Methods inherited from Base

#==, create, create_array_from_hash, create_objects_array_from_hash, #destroy, exists?, find, #initialize, request, #save, #save!, #to_hash, to_object, to_objects_array, #update

Methods included from RequestMethods::ClassMethods

#exists_action, #find_action, #id_params

Methods included from HashConverters

#convert_to_hash, #date_with_milliseconds, #field_to_hash

Methods included from XMLConverters

#get_xml, #xml_instance_class_name

Methods included from RequestMethods

#destroy_action, #destroy_params, #destroy_prefix, #save_action, #save_params, #save_prefix, #update_params, #update_prefix

Constructor Details

This class inherits a constructor from KalibroClient::Entities::Base

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



21
22
23
# File 'lib/kalibro_client/entities/processor/metric_collector_details.rb', line 21

def description
  @description
end

#nameObject

Returns the value of attribute name.



21
22
23
# File 'lib/kalibro_client/entities/processor/metric_collector_details.rb', line 21

def name
  @name
end

#supported_metricsObject

Returns the value of attribute supported_metrics.



21
22
23
# File 'lib/kalibro_client/entities/processor/metric_collector_details.rb', line 21

def supported_metrics
  @supported_metrics
end

Class Method Details

.allObject



55
56
57
# File 'lib/kalibro_client/entities/processor/metric_collector_details.rb', line 55

def self.all
  create_objects_array_from_hash(request('', {}, :get))
end

.all_namesObject



51
52
53
# File 'lib/kalibro_client/entities/processor/metric_collector_details.rb', line 51

def self.all_names
  request(:names, {}, :get)['metric_collector_names'].to_a
end

.find_by_name(metric_collector_name) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/kalibro_client/entities/processor/metric_collector_details.rb', line 43

def self.find_by_name(metric_collector_name)
  begin
    new request(:find, {name: metric_collector_name})["metric_collector_details"]
  rescue
    raise KalibroClient::Errors::RecordNotFound
  end
end

Instance Method Details

#find_metric_by_code(metric_code) ⇒ Object



39
40
41
# File 'lib/kalibro_client/entities/processor/metric_collector_details.rb', line 39

def find_metric_by_code(metric_code)
  @supported_metrics[metric_code]
end

#find_metric_by_name(name) ⇒ Object



34
35
36
37
# File 'lib/kalibro_client/entities/processor/metric_collector_details.rb', line 34

def find_metric_by_name(name)
  metric = self.supported_metrics.find {|code, metric| metric.name == name}
  metric.nil? ? nil : metric.last
end