Class: KalibroClient::Entities::Processor::ModuleResult

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

address

Methods inherited from Base

#kalibro_errors, module_name

Instance Attribute Details

#gradeObject

Returns the value of attribute grade.



22
23
24
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 22

def grade
  @grade
end

#heightObject

Returns the value of attribute height.



22
23
24
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 22

def height
  @height
end

#idObject

Returns the value of attribute id.



22
23
24
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 22

def id
  @id
end

#kalibro_moduleObject

Returns the value of attribute kalibro_module.



22
23
24
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 22

def kalibro_module
  @kalibro_module
end

#parent_idObject

Returns the value of attribute parent_id.



22
23
24
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 22

def parent_id
  @parent_id
end

#processing_idObject

Returns the value of attribute processing_id.



22
23
24
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 22

def processing_id
  @processing_id
end

Class Method Details

.history_of(module_result, repository_id) ⇒ Object



74
75
76
77
78
79
80
81
82
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 74

def self.history_of(module_result, repository_id)
  response = self.create_array_from_hash(Repository.request(':id/module_result_history_of', {id: repository_id, kalibro_module_id: module_result.kalibro_module.id})['date_module_results'])
  response.map do |date_module_result_pair|
    date_module_result = KalibroClient::Entities::Miscellaneous::DateModuleResult.new
    date_module_result.date = date_module_result_pair.first
    date_module_result.module_result = KalibroClient::Entities::Processor::ModuleResult.new date_module_result_pair.last
    date_module_result
  end
end

Instance Method Details

#childrenObject



24
25
26
27
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 24

def children
  response = self.class.request(':id/children', {id: id}, :get)
  self.class.create_objects_array_from_hash(response)
end

#file?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 70

def file?
  !self.folder?
end

#folder?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 66

def folder?
  self.children.count > 0
end

#hotspot_metric_resultsObject



88
89
90
91
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 88

def hotspot_metric_results
  HotspotMetricResult.create_objects_array_from_hash(self.class.request(":id/hotspot_metric_results",
                                                                        {id: self.id}, :get))
end

#parentsObject



29
30
31
32
33
34
35
36
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 29

def parents
  if parent_id == 0
    []
  else
    parent = self.class.find(parent_id)
    parent.parents << parent
  end
end

#processingObject



54
55
56
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 54

def processing
  KalibroClient::Entities::Processor::Processing.find(self.processing_id)
end

#tree_metric_resultsObject



84
85
86
# File 'lib/kalibro_client/entities/processor/module_result.rb', line 84

def tree_metric_results
  TreeMetricResult.create_objects_array_from_hash(self.class.request(":id/metric_results", {id: self.id}, :get))
end