Class: Openlayer::ProjectVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/openlayer/objects/project_version.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Object

#method_missing, #respond_to_missing?

Constructor Details

#initialize(client, attributes) ⇒ ProjectVersion

Returns a new instance of ProjectVersion.



12
13
14
15
16
# File 'lib/openlayer/objects/project_version.rb', line 12

def initialize(client, attributes)
  @client = client
  super(attributes)
  @project_version_id = commit.projectVersionId
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Openlayer::Object

Instance Attribute Details

#all_attributes_hashObject (readonly)

Returns the value of attribute all_attributes_hash.



5
6
7
# File 'lib/openlayer/objects/project_version.rb', line 5

def all_attributes_hash
  @all_attributes_hash
end

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/openlayer/objects/project_version.rb', line 5

def client
  @client
end

#project_version_idObject (readonly)

Returns the value of attribute project_version_id.



5
6
7
# File 'lib/openlayer/objects/project_version.rb', line 5

def project_version_id
  @project_version_id
end

Class Method Details

.from_response(client, response) ⇒ Object



7
8
9
10
# File 'lib/openlayer/objects/project_version.rb', line 7

def self.from_response(client, response)
  attributes = handle_response(response)
  new(client, attributes)
end

Instance Method Details



18
19
20
21
# File 'lib/openlayer/objects/project_version.rb', line 18

def print_status_report
  puts "Status: #{status}"
  puts "Status Message: #{status_message}" unless status_message.nil?
end


23
24
25
26
27
# File 'lib/openlayer/objects/project_version.rb', line 23

def print_test_report
  puts "Failing Test Count: #{failing_test_count}"
  puts "Passing Test Count: #{passing_test_count}"
  puts "Total Test Count: #{total_test_count}"
end

#refreshObject



43
44
45
# File 'lib/openlayer/objects/project_version.rb', line 43

def refresh
  @attributes = OpenStruct.new handle_response client.connection.get("versions/#{project_version_id}")
end

#to_hObject



29
30
31
# File 'lib/openlayer/objects/project_version.rb', line 29

def to_h
  @attributes.to_h
end

#wait_for_completion(timeout: 300, interval: 10) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/openlayer/objects/project_version.rb', line 33

def wait_for_completion(timeout: 300, interval: 10)
  start_time = Time.now
  while Time.now - start_time < timeout
    refresh
    break if status == "completed" || status == "failed"

    sleep interval
  end
end