Class: TestRescueAgent::TestRescueClient
- Inherits:
-
Object
- Object
- TestRescueAgent::TestRescueClient
show all
- Defined in:
- lib/test_rescue_agent/test_rescue_client.rb,
lib/test_rescue_agent/test_rescue_client/file_run.rb,
lib/test_rescue_agent/test_rescue_client/test_run.rb,
lib/test_rescue_agent/test_rescue_client/suite_run.rb,
lib/test_rescue_agent/test_rescue_client/file_run_exception.rb
Defined Under Namespace
Classes: FileRun, FileRunException, SuiteRun, TestRun
Instance Method Summary
collapse
Constructor Details
Returns a new instance of TestRescueClient.
13
14
15
16
17
18
|
# File 'lib/test_rescue_agent/test_rescue_client.rb', line 13
def initialize(options={})
@endpoint = options[:endpoint]
@repository_id = options[:repository_id]
@api_key = options[:api_key]
@secret = options[:secret]
end
|
Instance Method Details
#claim_file_run(suite_run_id, container_id) ⇒ Object
39
40
41
42
43
|
# File 'lib/test_rescue_agent/test_rescue_client.rb', line 39
def claim_file_run(suite_run_id, container_id)
response = post("/suite_runs/#{suite_run_id}/file_runs/claim", container_id: container_id)
json = JSON.parse(response.body)
TestRescueClient::FileRun.new(self, json) if json
end
|
#complete_file_run(suite_run_id, file_run_id) ⇒ Object
45
46
47
|
# File 'lib/test_rescue_agent/test_rescue_client.rb', line 45
def complete_file_run(suite_run_id, file_run_id)
update_file_run(suite_run_id, file_run_id, {completed_at: Time.now.iso8601})
end
|
#create_file_run(suite_run_id, attributes) ⇒ Object
29
30
31
32
|
# File 'lib/test_rescue_agent/test_rescue_client.rb', line 29
def create_file_run(suite_run_id, attributes)
response = post("/suite_runs/#{suite_run_id}/file_runs", file_run: attributes)
TestRescueClient::FileRun.new(self, JSON.parse(response.body))
end
|
#create_file_run_exception(suite_run_id, file_run_id, attributes) ⇒ Object
34
35
36
37
|
# File 'lib/test_rescue_agent/test_rescue_client.rb', line 34
def create_file_run_exception(suite_run_id, file_run_id, attributes)
response = post("/suite_runs/#{suite_run_id}/file_runs/#{file_run_id}/exceptions", file_run_exception: attributes)
TestRescueClient::FileRunException.new(self, JSON.parse(response.body))
end
|
#create_suite_run(sha:) ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/test_rescue_agent/test_rescue_client.rb', line 20
def create_suite_run(sha:)
response = post('/suite_runs', suite_run: {
head_branch: 'master',
sha: sha,
title: 'Collect Pull Request Title from GitHub'
})
TestRescueClient::SuiteRun.new(self, JSON.parse(response.body))
end
|
#create_test_run(suite_run_id, file_run_id, attributes) ⇒ Object
53
54
55
56
|
# File 'lib/test_rescue_agent/test_rescue_client.rb', line 53
def create_test_run(suite_run_id, file_run_id, attributes)
response = post("/suite_runs/#{suite_run_id}/file_runs/#{file_run_id}/test_runs", test_run: attributes)
TestRescueClient::TestRun.new(self, JSON.parse(response.body))
end
|
#update_file_run(suite_run_id, file_run_id, attributes) ⇒ Object
49
50
51
|
# File 'lib/test_rescue_agent/test_rescue_client.rb', line 49
def update_file_run(suite_run_id, file_run_id, attributes)
patch("/suite_runs/#{suite_run_id}/file_runs/#{file_run_id}", file_run: attributes)
end
|