Class: Kanoah::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty, Helper::TestCase, 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 Helper::TestCase

#retrive_based_on_username

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.



19
20
21
22
23
24
25
26
27
28
# File 'lib/client.rb', line 19

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

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



16
17
18
# File 'lib/client.rb', line 16

def project
  @project
end

#responseObject (readonly)

Returns the value of attribute response.



16
17
18
# File 'lib/client.rb', line 16

def response
  @response
end

#test_run_idObject (readonly)

Returns the value of attribute test_run_id.



16
17
18
# File 'lib/client.rb', line 16

def test_run_id
  @test_run_id
end

Instance Method Details

#set_access_token(token) ⇒ Object



30
31
32
# File 'lib/client.rb', line 30

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