Class: TestObjectRestClient
- Inherits:
-
Object
- Object
- TestObjectRestClient
- Defined in:
- lib/test_object_rest_client.rb
Instance Method Summary collapse
- #basic_authorization ⇒ Object
- #build_path(session_id) ⇒ Object
- #headers ⇒ Object
-
#initialize(parameters) ⇒ TestObjectRestClient
constructor
A new instance of TestObjectRestClient.
- #put_test_outcome(outcome) ⇒ Object
Constructor Details
#initialize(parameters) ⇒ TestObjectRestClient
Returns a new instance of TestObjectRestClient.
6 7 8 9 |
# File 'lib/test_object_rest_client.rb', line 6 def initialize(parameters) @api_url = parameters[:api_url] @api_key = parameters[:api_key] end |
Instance Method Details
#basic_authorization ⇒ Object
19 20 21 |
# File 'lib/test_object_rest_client.rb', line 19 def { username: @api_key, password: '' } end |
#build_path(session_id) ⇒ Object
11 12 13 |
# File 'lib/test_object_rest_client.rb', line 11 def build_path(session_id) @path = "#{@api_url}session/#{session_id}/test/" end |
#headers ⇒ Object
23 24 25 |
# File 'lib/test_object_rest_client.rb', line 23 def headers { 'Content-Type' => 'application/json' } end |
#put_test_outcome(outcome) ⇒ Object
15 16 17 |
# File 'lib/test_object_rest_client.rb', line 15 def put_test_outcome(outcome) HTTParty.put(@path, basic_auth: , body: { passed: outcome }.to_json, headers: headers, debug_output: $stdout) end |