Class: ZgenClient
- Inherits:
-
Object
- Object
- ZgenClient
- Defined in:
- lib/zgen_client.rb
Overview
The Zgen Client main class.
Constant Summary collapse
- @@users_login_endpoint =
"users/login"
- @@test_execution_endpoint =
"v1/Incident/TestCaseExecution"
- @@attachment_endpoint =
"v1/Incident/attachment"
Instance Method Summary collapse
-
#initialize(api_host:, api_port:, user_email:, user_password:, user_customer_name:, proxy_host: nil, proxy_port: nil, timeout: 30, is_https: false) ⇒ ZgenClient
constructor
Returns a new instance of ZgenClient.
-
#post_attachment(test_result_id:, evidence:) ⇒ String
Send an attachment as the evidence of a test execution result that was previosly saved using #post_test_execution.
-
#post_test_execution(project_id:, execution_code:, cycle_start_date:, test_result_ok:, date:, test_result_comments: "", tags: [], incident_id: nil, status: nil, status_date: nil) ⇒ String
Create a test case result with the information passed from a test case.
Constructor Details
#initialize(api_host:, api_port:, user_email:, user_password:, user_customer_name:, proxy_host: nil, proxy_port: nil, timeout: 30, is_https: false) ⇒ ZgenClient
Returns a new instance of ZgenClient.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/zgen_client.rb', line 24 def initialize(api_host:, api_port:, user_email:, user_password:, user_customer_name:, proxy_host: nil, proxy_port: nil, timeout: 30, is_https: false) @api_host = api_host @api_port = api_port @user_email = user_email @user_password = user_password @user_customer_name = user_customer_name @proxy_host = proxy_host @proxy_port = proxy_port @timeout = timeout @is_https = is_https @token = nil @user_id = nil end |
Instance Method Details
#post_attachment(test_result_id:, evidence:) ⇒ String
Send an attachment as the evidence of a test execution result that was previosly saved using #post_test_execution.
64 65 66 67 68 69 70 |
# File 'lib/zgen_client.rb', line 64 def (test_result_id:, evidence:) url = "#{build_base_url()}/#{@@attachment_endpoint}" headers = { :Authorization => "Bearer #{get_token()}" } body = { :File => evidence, :TestResultId => test_result_id } response = RestClient.post(url, body, headers) JSON.parse(response.body)["attachmentID"] end |
#post_test_execution(project_id:, execution_code:, cycle_start_date:, test_result_ok:, date:, test_result_comments: "", tags: [], incident_id: nil, status: nil, status_date: nil) ⇒ String
Create a test case result with the information passed from a test case.
51 52 53 54 55 56 57 |
# File 'lib/zgen_client.rb', line 51 def post_test_execution(project_id:, execution_code:, cycle_start_date:, test_result_ok:, date:, test_result_comments: "", tags: [], incident_id: nil, status: nil, status_date: nil) url = "#{build_base_url()}/#{@@test_execution_endpoint}" headers = { :Authorization => "Bearer #{get_token()}", content_type: "application/json" } body = { projectID: project_id, executionCode: execution_code, cycleStartDate: cycle_start_date, testResultOK: test_result_ok, testerUserID: @user_id, testResultComments: test_result_comments, date: date, tags: , incidentID: incident_id, status: status, statusDate: status_date }.to_json response = RestClient.post(url, body, headers) JSON.parse(response.body)["testResultID"] end |