Class: ProbeDockProbe::TestRun

Inherits:
Object
  • Object
show all
Defined in:
lib/probe_dock_ruby/test_run.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ TestRun

Returns a new instance of TestRun.



7
8
9
10
# File 'lib/probe_dock_ruby/test_run.rb', line 7

def initialize project
  @results = []
  @project = project
end

Instance Attribute Details

#durationObject

Returns the value of attribute duration.



5
6
7
# File 'lib/probe_dock_ruby/test_run.rb', line 5

def duration
  @duration
end

#projectObject (readonly)

Returns the value of attribute project.



4
5
6
# File 'lib/probe_dock_ruby/test_run.rb', line 4

def project
  @project
end

#resultsObject (readonly)

Returns the value of attribute results.



4
5
6
# File 'lib/probe_dock_ruby/test_run.rb', line 4

def results
  @results
end

#uidObject

Returns the value of attribute uid.



5
6
7
# File 'lib/probe_dock_ruby/test_run.rb', line 5

def uid
  @uid
end

Instance Method Details

#add_result(options = {}) ⇒ Object



12
13
14
# File 'lib/probe_dock_ruby/test_run.rb', line 12

def add_result options = {}
  @results << TestResult.new(@project, options)
end

#to_h(options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/probe_dock_ruby/test_run.rb', line 16

def to_h options = {}
  validate!

  {
    'projectId' => @project.api_id,
    'version' => @project.version,
    'duration' => @duration,
    'results' => @results.collect{ |r| r.to_h options }
  }.tap do |h|
    h['reports'] = [ { 'uid' => @uid } ] if @uid
  end
end