Module: Endpoints

Included in:
TestRail::APIClient
Defined in:
lib/endpoints.rb

Instance Method Summary collapse

Instance Method Details

#add_case(section_id, opts = {}) ⇒ Object

Creates a new test case

Examples:

POST index.php?/api/v2/add_case/:section_id


Parameters:

  • section_id (int)

    The id of the test case

  • opts (hash) (defaults to: {})

See Also:



46
47
48
# File 'lib/endpoints.rb', line 46

def add_case(section_id, opts = {})
  send_post("add_case/#{section_id.to_s}", opts)
end

#add_milestone(project_id, opts = {}) ⇒ Object

Add milestone to project id

Examples:

POST index.php?/api/v2/add_milestone/:project_id


Parameters:

  • project_id (int)
  • opts (hash) (defaults to: {})

See Also:



164
165
166
# File 'lib/endpoints.rb', line 164

def add_milestone(project_id, opts = {})
  send_post("add_milestone/#{project_id.to_s}", opts)
end

#add_plan(project_id, opts = {}) ⇒ Object

Add plan to project by project id

Examples:

POST index.php?/api/v2/add_plan/:project_id


Parameters:

  • project_id (int)
  • opts (hash) (defaults to: {})

See Also:



209
210
211
# File 'lib/endpoints.rb', line 209

def add_plan(project_id, opts = {})
  send_post("add_plan/#{project_id.to_s}", opts)
end

#add_plan_entry(plan_id, opts = {}) ⇒ Object

Add plan entries by plan id

Examples:

POST index.php?/api/v2/add_plan_entry/:plan_id


Parameters:

  • plan_id (int)
  • opts (hash) (defaults to: {})

See Also:



218
219
220
# File 'lib/endpoints.rb', line 218

def add_plan_entry(plan_id, opts = {})
  send_post("add_plan_entry/#{plan_id.to_s}", opts)
end

#add_project(opts = {}) ⇒ Object

Add a project

Examples:

POST index.php?/api/v2/add_project


Parameters:

  • opts (hash) (defaults to: {})

See Also:



282
283
284
# File 'lib/endpoints.rb', line 282

def add_project(opts = {})
  send_post("add_project", opts)
end

#add_result(test_id, opts = {}) ⇒ Object

Adds a new test result, comment or assigns a test. It’s recommended to use add_results instead if you plan to add results for multiple tests.

Examples:

POST index.php?/api/v2/add_result/:test_id


Parameters:

  • test_id (int)
  • opts (hash) (defaults to: {})

See Also:



338
339
340
# File 'lib/endpoints.rb', line 338

def add_result(test_id, opts = {})
  send_post("add_result/#{test_id.to_s}", opts)
end

#add_result_for_case(run_id, case_id, opts = {}) ⇒ Object

Adds a new test result, comment or assigns a test (for a test run and case combination)

Examples:

POST index.php?/api/v2/add_result_for_case/:run_id/:case_id


Parameters:

  • run_id (int)
  • case_id (int)
  • opts (hash) (defaults to: {})

See Also:



348
349
350
# File 'lib/endpoints.rb', line 348

def add_result_for_case(run_id, case_id, opts = {})
  send_post("add_result_for_case/#{run_id.to_s}/#{case_id.to_s}", opts)
end

#add_results(run_id, opts = {}) ⇒ Object

Adds one or more new test results, comments or assigns one or more tests

Examples:

POST index.php?/api/v2/add_results/:run_id


Parameters:

  • run_id (int)
  • opts (hash) (defaults to: {})

See Also:



357
358
359
# File 'lib/endpoints.rb', line 357

def add_results(run_id, opts = {})
  send_post("add_results/#{run_id.to_s}", opts)
end

#add_results_for_cases(run_id, opts = {}) ⇒ Object

Adds one or more new test results, comments or assigns one or more tests (using the case IDs)

Examples:

POST index.php?/api/v2/add_results_for_cases/:run_id


Parameters:

  • run_id (int)
  • opts (hash) (defaults to: {})

See Also:



366
367
368
# File 'lib/endpoints.rb', line 366

def add_results_for_cases(run_id, opts = {})
  send_post("add_results_for_cases/#{run_id.to_s}", opts)
end

#add_run(project_id, opts = {}) ⇒ Object

Add run by suite id

Examples:

POST index.php?/api/v2/add_run/:project_id


Parameters:

  • project_id (int)
  • opts (hash) (defaults to: {})

See Also:



394
395
396
# File 'lib/endpoints.rb', line 394

def add_run(project_id, opts = {})
  send_post("add_run/#{project_id.to_s}", opts)
end

#add_section(project_id, suite_id, opts = {}) ⇒ Object

Note:

suite_id is required unless running in single suite mode

Add section to suite

Examples:

POST index.php?/api/v2/add_section/:project_id


Parameters:

  • project_id (int)
  • opts (hash) (defaults to: {})

See Also:



137
138
139
# File 'lib/endpoints.rb', line 137

def add_section(project_id, suite_id, opts = {})
  send_post("add_section/#{project_id.to_s}&suite_id=#{suite_id.to_s}", opts)
end

#add_suite(project_id, opts = {}) ⇒ Object

Add a test suite

Examples:

POST index.php?/api/v2/add_suite/:project_id


Parameters:

  • project_id (int)

    The id of the project containing suites

  • opts (hash) (defaults to: {})

See Also:



91
92
93
# File 'lib/endpoints.rb', line 91

def add_suite(project_id, opts = {})
  send_post("add_suite/#{project_id.to_s}", opts)
end

#close_plan(plan_id, opts = {}) ⇒ Object

Close plan by plan id

Examples:

POST index.php?/api/v2/close_plan/:plan_id


Parameters:

  • plan_id (int)
  • opts (hash) (defaults to: {})

See Also:



246
247
248
# File 'lib/endpoints.rb', line 246

def close_plan(plan_id, opts = {})
  send_post("close_plan/#{plan_id.to_s}", opts)
end

#close_run(run_id, opts = {}) ⇒ Object

Closes an existing test run and archives its tests & results

Examples:

POST index.php?/api/v2/close_run/:run_id


Parameters:

  • run_id (int)
  • opts (hash) (defaults to: {})

See Also:



412
413
414
# File 'lib/endpoints.rb', line 412

def close_run(run_id, opts = {})
  send_post("close_run/#{run_id.to_s}", opts)
end

#delete_case(case_id, opts = {}) ⇒ Object

Delete test case by case id

Examples:

POST index.php?/api/v2/delete_case/:case_id


Parameters:

  • case_id (int)

    The id of the test case

  • opts (hash) (defaults to: {})

See Also:



64
65
66
# File 'lib/endpoints.rb', line 64

def delete_case(case_id, opts = {})
  send_post("delete_case/#{case_id.to_s}", opts)
end

#delete_milestone(milestone_id, opts = {}) ⇒ Object

Add milestone to project id

Examples:

POST index.php?/api/v2/delete_milestone/:milestone_id


Parameters:

  • milestone_id (int)
  • opts (hash) (defaults to: {})

See Also:



182
183
184
# File 'lib/endpoints.rb', line 182

def delete_milestone(milestone_id, opts = {})
  send_post("delete_milestone/#{milestone_id.to_s}", opts)
end

#delete_plan(plan_id, opts) ⇒ Object

Examples:

POST index.php?/api/v2/delete_plan/:plan_id


See Also:



252
253
254
# File 'lib/endpoints.rb', line 252

def delete_plan(plan_id, opts)
  send_post("delete_plan/#{plan_id.to_s}", opts)
end

#delete_plan_entry(plan_id, entry_id, opts = {}) ⇒ Object

Examples:

POST index.php?/api/v2/delete_plan_entry/:plan_id/:entry_id




257
258
259
# File 'lib/endpoints.rb', line 257

def delete_plan_entry(plan_id, entry_id, opts = {})
  send_post("delete_plan_entry/#{plan_id.to_s}/#{entry_id.to_s}", opts)
end

#delete_project(project_id, opts) ⇒ Object

Delete a project

Examples:

POST index.php?/api/v2/delete_project/:project_id


Parameters:

  • project_id (int)

    The project you want to delete

  • opts (hash)

See Also:



301
302
303
# File 'lib/endpoints.rb', line 301

def delete_project(project_id, opts)
  send_post("delete_project/#{project_id.to_s}", opts)
end

#delete_run(run_id, opts = {}) ⇒ Object

Deletes an existing test run.

Examples:

POST index.php?/api/v2/delete_run/:run_id


Parameters:

  • run_id (int)
  • opts (hash) (defaults to: {})

See Also:



421
422
423
# File 'lib/endpoints.rb', line 421

def delete_run(run_id, opts = {})
  send_post("delete_run/#{run_id.to_s}", opts)
end

#delete_suite(suite_id, opts = {}) ⇒ Object

Delete a test suite

Examples:

POST index.php?/api/v2/delete_suite/:suite_id


Parameters:

  • suite_id (int)

    The suite id

  • opts (hash) (defaults to: {})

See Also:



109
110
111
# File 'lib/endpoints.rb', line 109

def delete_suite(suite_id, opts = {})
  send_post("delete_suite/#{suite_id.to_s}", opts)
end

#get_case(case_id, opts = {}) ⇒ Object

Returns an existing test case

Examples:

GET index.php?/api/v2/get_case/:case_id


Parameters:

  • case_id (int)

    The id of the test case you want.

  • opts (hash) (defaults to: {})

See Also:



7
8
9
# File 'lib/endpoints.rb', line 7

def get_case(case_id, opts = {})
  send_get("get_case/#{case_id.to_s}", opts)
end

#get_cases(project_id, opts = {}) ⇒ Object

Returns a list of test cases for a test suite or specific section in a test suite.

Examples:

GET index.php?/api/v2/get_cases/:project_id


Parameters:

  • project_id (int)

    The id of the project that contains your tests

  • opts (hash) (defaults to: {})

See Also:



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

def get_cases(project_id, opts = {})
  send_get("get_cases/#{project_id.to_s}", opts)
end

#get_cases_by_section(project_id, suite_id, section_id, opts = {}) ⇒ Object

Return all test cases in a given project by suite_id and section_id

Examples:

GET index.php?/api/v2/get_cases/:project_id&suite_id=:suite_id&section_id=:section_id


Parameters:

  • project_id (int)

    The id of the project that contains your tests

  • suite_id (int)

    The id of the suite within the project

  • section_id (int)

    The id of the section within the suite

  • opts (hash) (defaults to: {})

See Also:



27
28
29
# File 'lib/endpoints.rb', line 27

def get_cases_by_section(project_id, suite_id, section_id, opts = {})
  send_get("get_cases/#{project_id.to_s}&suite_id=#{suite_id.to_s}&section_id=#{section_id.to_s}", opts)
end

#get_cases_by_suite(project_id, suite_id, opts = {}) ⇒ Object

Return all test cases in a given project by suite_id

Examples:

GET index.php?/api/v2/get_cases/:project_id&suite_id=:suite_id


Parameters:

  • project_id (int)

    The id of the project that contains your tests

  • suite_id (int)

    The id of the suite within the project

  • opts (hash) (defaults to: {})

See Also:



37
38
39
# File 'lib/endpoints.rb', line 37

def get_cases_by_suite(project_id, suite_id, opts = {})
  send_get("get_cases/#{project_id.to_s}&suite_id=#{suite_id.to_s}", opts)
end

#get_milestone(milestone_id, opts = {}) ⇒ Object

Get milestone by milestone id

Examples:

GET index.php?/api/v2/get_milestone/:milestone_id


Parameters:

  • milestone_id (int)
  • opts (hash) (defaults to: {})

See Also:



146
147
148
# File 'lib/endpoints.rb', line 146

def get_milestone(milestone_id, opts = {})
  send_get("get_milestone/#{milestone_id.to_s}", opts)
end

#get_milestones(project_id, opts = {}) ⇒ Object

Get project milestones by project id

Examples:

GET index.php?/api/v2/get_milestones/:project_id


Parameters:

  • project_id (int)
  • opts (hash) (defaults to: {})

See Also:



155
156
157
# File 'lib/endpoints.rb', line 155

def get_milestones(project_id, opts = {})
  send_get("get_milestones/#{project_id.to_s}", opts)
end

#get_plan(plan_id, opts = {}) ⇒ Object

Get plan by id

Examples:

GET index.php?/api/v2/get_plan/:plan_id


Parameters:

  • plan_id (int)
  • opts (hash) (defaults to: {})

See Also:



191
192
193
# File 'lib/endpoints.rb', line 191

def get_plan(plan_id, opts = {})
  send_get("get_plan/#{plan_id.to_s}", opts)
end

#get_plans(project_id, opts = {}) ⇒ Object

Get plans in project by project id

Examples:

GET index.php?/api/v2/get_plans/:project_id


Parameters:

  • project_id (int)
  • opts (hash) (defaults to: {})

See Also:



200
201
202
# File 'lib/endpoints.rb', line 200

def get_plans(project_id, opts = {})
  send_get("get_plans/#{project_id.to_s}", opts)
end

#get_project(project_id, opts = {}) ⇒ Object

Get project by project id

Examples:

GET index.php?/api/v2/get_project/:project_id


Parameters:

  • project_id (int)
  • opts (hash) (defaults to: {})

See Also:



266
267
268
# File 'lib/endpoints.rb', line 266

def get_project(project_id, opts = {})
  send_get("get_project/#{project_id.to_s}", opts)
end

#get_projects(opts = {}) ⇒ Object

Get all projects

Examples:

GET index.php?/api/v2/get_projects


Parameters:

  • opts (hash) (defaults to: {})

See Also:



274
275
276
# File 'lib/endpoints.rb', line 274

def get_projects(opts = {})
  send_get('get_projects', opts)
end

#get_results(test_id, opts = {}) ⇒ Object

Returns a list of test results for a test

Examples:

GET index.php?/api/v2/get_results/:test_id


Parameters:

  • test_id (int)
  • opts (hash) (defaults to: {})

See Also:



310
311
312
# File 'lib/endpoints.rb', line 310

def get_results(test_id, opts = {})
  send_get("get_results/#{test_id.to_s}", opts)
end

#get_results_for_case(run_id, case_id, opts = {}) ⇒ Object

Returns a list of test results for a test run and case combination

Examples:

GET index.php?/api/v2/get_results_for_case/:run_id/:case_id


Parameters:

  • run_id (int)
  • case_id (int)
  • opts (hash) (defaults to: {})

See Also:



320
321
322
# File 'lib/endpoints.rb', line 320

def get_results_for_case(run_id, case_id, opts = {})
  send_get("get_results_for_case/#{run_id.to_s}/#{case_id.to_s}", opts)
end

#get_results_for_run(run_id, opts = {}) ⇒ Object

Returns a list of test results for a test run

Examples:

GET index.php?/api/v2/get_results_for_run/:run_id


Parameters:

  • run_id (int)
  • opts (hash) (defaults to: {})

See Also:



329
330
331
# File 'lib/endpoints.rb', line 329

def get_results_for_run(run_id, opts = {})
  send_get("get_results_for_run/#{run_id.to_s}", opts)
end

#get_run(run_id, opts = {}) ⇒ Object

Get run by run id

Examples:

GET index.php?/api/v2/get_run/:run_id


Parameters:

  • run_id (int)
  • opts (hash) (defaults to: {})

See Also:



375
376
377
# File 'lib/endpoints.rb', line 375

def get_run(run_id, opts = {})
  send_get("get_run/#{run_id.to_s}", opts)
end

#get_runs(project_id, opts = {}) ⇒ Object

Get runs by project id

Examples:

GET index.php?/api/v2/get_runs/:project_id


Parameters:

  • project_id (int)
  • plan_id (int)
  • opts (hash) (defaults to: {})

See Also:



385
386
387
# File 'lib/endpoints.rb', line 385

def get_runs(project_id, opts = {})
  send_get("get_runs/#{project_id.to_s}", opts)
end

#get_section(section_id, opts = {}) ⇒ Object

Return section by id

Examples:

GET index.php?/api/v2/get_section/:section_id


Parameters:

  • section_id (int)
  • opts (hash) (defaults to: {})

See Also:



118
119
120
# File 'lib/endpoints.rb', line 118

def get_section(section_id, opts = {})
  send_get("get_section/#{section_id.to_s}", opts)
end

#get_sections(project_id, suite_id, opts = {}) ⇒ Object

Get sections for suite

Examples:

GET index.php?/api/v2/get_sections/:project_id&suite_id=:suite_id


Parameters:

  • suite_id (int)
  • opts (hash) (defaults to: {})

See Also:



127
128
129
# File 'lib/endpoints.rb', line 127

def get_sections(project_id, suite_id, opts = {})
  send_get("get_sections/#{project_id.to_s}&suite_id=#{suite_id.to_s}", opts)
end

#get_suite(suite_id, opts = {}) ⇒ Object

Return suite by suite id

Examples:

GET index.php?/api/v2/get_suite/:suite_id


Parameters:

  • suite_id (int)

    The suite id

  • opts (hash) (defaults to: {})

See Also:



73
74
75
# File 'lib/endpoints.rb', line 73

def get_suite(suite_id, opts = {})
  send_get("get_suite/#{suite_id.to_s}", opts)
end

#get_suites(project_id, opts = {}) ⇒ Object

Return all suites in project by project id

Examples:

GET index.php?/api/v2/get_suites/:project_id


Parameters:

  • project_id (int)

    The id of the project containing suites

  • opts (hash) (defaults to: {})

See Also:



82
83
84
# File 'lib/endpoints.rb', line 82

def get_suites(project_id, opts = {})
  send_get("get_suites/#{project_id.to_s}", opts)
end

#get_test(test_id, opts = {}) ⇒ Object

Returns an existing test

Examples:

GET index.php?/api/v2/get_test/:test_id


Parameters:

  • test_id (int)
  • opts (hash) (defaults to: {})

See Also:



430
431
432
# File 'lib/endpoints.rb', line 430

def get_test(test_id, opts = {})
  send_get("get_test/#{test_id.to_s}", opts)
end

#get_tests(run_id, opts = {}) ⇒ Object

Returns a list of tests for a test run

Examples:

GET index.php?/api/v2/get_tests/:run_id


Parameters:

  • run_id (int)
  • opts (hash) (defaults to: {})

See Also:



439
440
441
# File 'lib/endpoints.rb', line 439

def get_tests(run_id, opts = {})
  send_get("get_tests/#{run_id.to_s}", opts)
end

#update_case(case_id, opts = {}) ⇒ Object

Update test result by case id

Examples:

POST index.php?/api/v2/update_case/:case_id


Parameters:

  • case_id (int)

    The id of the test case

  • opts (hash) (defaults to: {})

See Also:



55
56
57
# File 'lib/endpoints.rb', line 55

def update_case(case_id, opts = {})
  send_post("update_case/#{case_id.to_s}", opts)
end

#update_milestone(milestone_id, opts = {}) ⇒ Object

Add milestone to project id

Examples:

POST index.php?/api/v2/update_milestone/:milestone_id


Parameters:

  • milestone_id (int)
  • opts (hash) (defaults to: {})

See Also:



173
174
175
# File 'lib/endpoints.rb', line 173

def update_milestone(milestone_id, opts = {})
  send_post("update_milestone/#{milestone_id.to_s}", opts)
end

#update_plan(plan_id, opts = {}) ⇒ Object

Update plan by plan id

Examples:

POST index.php?/api/v2/update_plan/:plan_id


Parameters:

  • plan_id (int)
  • opts (hash) (defaults to: {})

See Also:



227
228
229
# File 'lib/endpoints.rb', line 227

def update_plan(plan_id, opts = {})
  send_post("update_plan/#{plan_id.to_s}", opts)
end

#update_plan_entry(plan_id, entry_id, opts = {}) ⇒ Object

Update plan entry by plan id

Examples:

POST index.php?/api/v2/update_plan_entry/:plan_id/:entry_id


Parameters:

  • plan_id (int)
  • entry_id (int)

    Id of entry

  • opts (hash) (defaults to: {})

See Also:



237
238
239
# File 'lib/endpoints.rb', line 237

def update_plan_entry(plan_id, entry_id, opts = {})
  send_post("update_plan_entry/#{plan_id.to_s}/#{entry_id.to_s}", opts)
end

#update_project(project_id, opts) ⇒ Object

Update a project

Examples:

POST index.php?/api/v2/update_project/:project_id


Parameters:

  • project_id (int)

    The project you want to update

  • opts (hash)

See Also:



291
292
293
# File 'lib/endpoints.rb', line 291

def update_project(project_id, opts)
  send_post("update_project/#{project_id.to_s}", opts)
end

#update_run(run_id, opts = {}) ⇒ Object

Updates existing test run

Examples:

POST index.php?/api/v2/update_run/:run_id


Parameters:

  • run_id (int)
  • opts (hash) (defaults to: {})

See Also:



403
404
405
# File 'lib/endpoints.rb', line 403

def update_run(run_id, opts = {})
  send_post("update_run/#{run_id.to_s}", opts)
end

#update_suite(suite_id, opts = {}) ⇒ Object

update a test suite

Examples:

POST index.php?/api/v2/update_suite/:suite_id


Parameters:

  • suite_id (int)

    The suite id

  • opts (hash) (defaults to: {})

See Also:



100
101
102
# File 'lib/endpoints.rb', line 100

def update_suite(suite_id, opts = {})
  send_post("update_suite/#{suite_id.to_s}", opts)
end