Class: Kanoah::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty, Services::Authentication, Services::IssueLink, Services::TestCase, Services::TestPlan, Services::TestResult, Services::TestRun
Defined in:
lib/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Services::TestRun

#get_run_details, #get_test_runs, #post_new_result_to_run, #post_new_test_run, #update_result_of_run

Methods included from Services::TestResult

#post_new_result

Methods included from Services::TestPlan

#get_plan_details

Methods included from Services::TestCase

#get_test_case_details, #post_new_test_case, #search_test_cases

Methods included from Services::IssueLink

#get_linked_tests

Methods included from Services::Authentication

#login

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



17
18
19
20
21
22
23
24
# File 'lib/client.rb', line 17

def initialize(options={})
  self.class.base_uri options.fetch(:base_url) { Kanoah.config.base_url }
  @environment = options.fetch(:environment)
  @test_run_id = options.fetch(:test_run_id) { nil }
  @project_id     = options.fetch(:project_id)
  token = Base64.encode64(options.fetch(:username)+':'+options.fetch(:password))
  set_access_token(token[0..-2])
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



14
15
16
# File 'lib/client.rb', line 14

def environment
  @environment
end

#projectObject (readonly)

Returns the value of attribute project.



14
15
16
# File 'lib/client.rb', line 14

def project
  @project
end

#test_run_idObject (readonly)

Returns the value of attribute test_run_id.



14
15
16
# File 'lib/client.rb', line 14

def test_run_id
  @test_run_id
end

Instance Method Details

#set_access_token(token) ⇒ Object



26
27
28
# File 'lib/client.rb', line 26

def set_access_token(token)
  @header = { "Authorization" => "Basic #{token}", "Content-Type" => "application/json"}
end