Class: KalibroGem::Entities::BaseTool
- Defined in:
- lib/kalibro_gem/entities/base_tool.rb
Instance Attribute Summary collapse
-
#collector_class_name ⇒ Object
Returns the value of attribute collector_class_name.
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#supported_metric ⇒ Object
Returns the value of attribute supported_metric.
Attributes inherited from Model
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Model
#==, create, create_array_from_hash, create_objects_array_from_hash, #destroy, #errors=, exists?, find, #initialize, request, #save, #save!, #to_hash, to_object, to_objects_array
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, #save_action, #save_params
Constructor Details
This class inherits a constructor from KalibroGem::Entities::Model
Instance Attribute Details
#collector_class_name ⇒ Object
Returns the value of attribute collector_class_name.
22 23 24 |
# File 'lib/kalibro_gem/entities/base_tool.rb', line 22 def collector_class_name @collector_class_name end |
#description ⇒ Object
Returns the value of attribute description.
22 23 24 |
# File 'lib/kalibro_gem/entities/base_tool.rb', line 22 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
22 23 24 |
# File 'lib/kalibro_gem/entities/base_tool.rb', line 22 def name @name end |
#supported_metric ⇒ Object
Returns the value of attribute supported_metric.
22 23 24 |
# File 'lib/kalibro_gem/entities/base_tool.rb', line 22 def supported_metric @supported_metric end |
Class Method Details
.all ⇒ Object
50 51 52 53 |
# File 'lib/kalibro_gem/entities/base_tool.rb', line 50 def self.all base_tools = all_names base_tools.map{ |name| find_by_name(name) } end |
.all_names ⇒ Object
44 45 46 47 48 |
# File 'lib/kalibro_gem/entities/base_tool.rb', line 44 def self.all_names base_tool_name = request(:all_base_tool_names)[:base_tool_name] return [base_tool_name] if base_tool_name.is_a?(String) return base_tool_name.to_a end |
.find_by_name(base_tool_name) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/kalibro_gem/entities/base_tool.rb', line 36 def self.find_by_name(base_tool_name) begin new request(:get_base_tool, {:base_tool_name => base_tool_name})[:base_tool] rescue raise KalibroGem::Errors::RecordNotFound end end |
Instance Method Details
#metric(name) ⇒ Object
32 33 34 |
# File 'lib/kalibro_gem/entities/base_tool.rb', line 32 def metric(name) supported_metrics.find {|metric| metric.name == name} end |
#supported_metrics ⇒ Object
28 29 30 |
# File 'lib/kalibro_gem/entities/base_tool.rb', line 28 def supported_metrics @supported_metric end |