Class: TestRail::APIClient

Inherits:
Object
  • Object
show all
Includes:
Endpoints
Defined in:
lib/testrail-ruby.rb,
lib/testrail-ruby-broken.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Endpoints

#add_case, #add_milestone, #add_plan, #add_plan_entry, #add_project, #add_result, #add_result_for_case, #add_results, #add_results_for_cases, #add_run, #add_section, #add_suite, #close_plan, #close_run, #delete_case, #delete_milestone, #delete_plan, #delete_plan_entry, #delete_project, #delete_run, #delete_suite, #get_case, #get_cases, #get_milestone, #get_milestones, #get_plan, #get_plans, #get_project, #get_projects, #get_results, #get_results_for_case, #get_results_for_run, #get_run, #get_runs, #get_section, #get_sections, #get_suite, #get_suites, #get_test, #get_tests, #update_case, #update_milestone, #update_plan, #update_plan_entry, #update_project, #update_run, #update_suite

Constructor Details

#initialize(base_url) ⇒ APIClient

Returns a new instance of APIClient.


23
24
25
26
27
28
# File 'lib/testrail-ruby.rb', line 23

def initialize(base_url)
  if !base_url.match(/\/$/)
    base_url += '/'
  end
  @url = base_url + 'index.php?/api/v2/'
end

Instance Attribute Details

#passwordObject

Returns the value of attribute password.


21
22
23
# File 'lib/testrail-ruby.rb', line 21

def password
  @password
end

#userObject

Returns the value of attribute user.


20
21
22
# File 'lib/testrail-ruby.rb', line 20

def user
  @user
end

Instance Method Details

#send_get(uri, data) ⇒ Object


30
31
32
# File 'lib/testrail-ruby.rb', line 30

def send_get(uri)
  _send_request('GET', uri)
end

#send_post(uri, data) ⇒ Object

Send POST

Issues a POST request (write) against the API and returns the result (as Ruby hash).

Arguments:

uri The API method to call including parameters

(e.g. add_case/1)

data The data to submit as part of the request (as

Ruby hash, strings must be UTF-8 encoded)

47
48
49
# File 'lib/testrail-ruby.rb', line 47

def send_post(uri, data)
  _send_request('POST', uri, data)
end