class ATM::Client

ATM::Client client for working with Adaptavist Test Management.

Attributes

auth_header[RW]

Public Class Methods

new(**options) click to toggle source
# File lib/atm_ruby/client.rb, line 8
def initialize(**options)
  options = ATM.config.to_hash.merge(options)
  options.each do |key, value|
    singleton_class.class_eval { attr_accessor key }
    send("#{key}=", value)
  end

  case options[:auth_type]
  when :basic then @auth_header = set_access_token
  else raise 'Currently only supports basic authentication'
  end
end

Public Instance Methods

TestCase() click to toggle source
# File lib/atm_ruby/client.rb, line 34
def TestCase
  ATM::Services::TestCase.new(
    auth_header: auth_header,
    base_url: base_url,
    environment: environment,
    project_id: project_id
  )
end
TestPlan() click to toggle source
# File lib/atm_ruby/client.rb, line 30
def TestPlan
  ATM::Services::TestPlan.new(auth_header: auth_header, base_url: base_url)
end
TestRun() click to toggle source
# File lib/atm_ruby/client.rb, line 43
def TestRun
  ATM::Services::TestRun.new(
    auth_header: auth_header,
    base_url: base_url,
    environment: environment,
    test_run_id: test_run_id
  )
end
gen_auth_token() click to toggle source
# File lib/atm_ruby/client.rb, line 21
def gen_auth_token
  (Base64.encode64(username + ':' + password)[0..-2]).to_s
end
set_access_token() click to toggle source
# File lib/atm_ruby/client.rb, line 25
def set_access_token
  { 'Authorization' => "Basic #{gen_auth_token}",
    'Content-Type' => 'application/json' }
end