Class: KalibroClient::Entities::Processor::TreeMetricResult
- Inherits:
-
MetricResult
- Object
- Base
- Base
- MetricResult
- KalibroClient::Entities::Processor::TreeMetricResult
- Defined in:
- lib/kalibro_client/entities/processor/tree_metric_result.rb
Instance Attribute Summary collapse
-
#aggregated_value ⇒ Object
Returns the value of attribute aggregated_value.
Attributes inherited from MetricResult
#id, #line_number, #message, #metric_configuration, #metric_configuration_id, #module_result_id, #related_hotspot_metric_results_id, #value
Attributes included from DateAttributes
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #descendant_values ⇒ Object
-
#initialize(attributes = {}, persisted = false) ⇒ TreeMetricResult
constructor
A new instance of TreeMetricResult.
Methods inherited from MetricResult
Methods inherited from Base
Methods inherited from Base
#==, create, create_array_from_hash, create_objects_array_from_hash, #destroy, exists?, find, 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
#initialize(attributes = {}, persisted = false) ⇒ TreeMetricResult
Returns a new instance of TreeMetricResult.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/kalibro_client/entities/processor/tree_metric_result.rb', line 23 def initialize(attributes={}, persisted=false) value = attributes["value"] @value = (value == "NaN") ? attributes["aggregated_value"].to_f : value.to_f attributes.each do |field, value| if field!= "value" and field!= "aggregated_value" and self.class.is_valid?(field) send("#{field}=", value) end end @kalibro_errors = [] @persisted = persisted end |
Instance Attribute Details
#aggregated_value ⇒ Object
Returns the value of attribute aggregated_value.
21 22 23 |
# File 'lib/kalibro_client/entities/processor/tree_metric_result.rb', line 21 def aggregated_value @aggregated_value end |
Class Method Details
.history_of(metric_name, kalibro_module_id, repository_id) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/kalibro_client/entities/processor/tree_metric_result.rb', line 44 def self.history_of(metric_name, kalibro_module_id, repository_id) response = Repository.request(':id/metric_result_history_of', {metric_name: metric_name, kalibro_module_id: kalibro_module_id, id: repository_id})['metric_result_history_of'] response.map { |date_metric_result| KalibroClient::Entities::Miscellaneous::DateMetricResult.new date_metric_result } end |
Instance Method Details
#descendant_values ⇒ Object
39 40 41 42 |
# File 'lib/kalibro_client/entities/processor/tree_metric_result.rb', line 39 def descendant_values descendant_values = self.class.request(':id/descendant_values', {id: id}, :get)['descendant_values'] descendant_values.map {|descendant_value| descendant_value.to_f} end |