Class: ATM::Client
- Inherits:
-
Object
- Object
- ATM::Client
- Defined in:
- lib/atm_ruby/client.rb
Overview
ATM::Client client for working with Adaptavist Test Management.
Instance Attribute Summary collapse
-
#auth_header ⇒ Object
Returns the value of attribute auth_header.
Instance Method Summary collapse
- #gen_auth_token ⇒ Object
-
#initialize(**args) ⇒ Client
constructor
A new instance of Client.
- #set_access_token ⇒ Object
- #TestCase ⇒ Object
- #TestPlan ⇒ Object
- #TestRun ⇒ Object
Constructor Details
#initialize(**args) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/atm_ruby/client.rb', line 8 def initialize(**args) = ATM.config.to_hash.merge(args) .each do |key, value| singleton_class.class_eval { attr_accessor key } send("#{key}=", value) end case [:auth_type] when :basic then @auth_header = set_access_token else raise 'Currently only supports basic authentication' end end |
Instance Attribute Details
#auth_header ⇒ Object
Returns the value of attribute auth_header.
6 7 8 |
# File 'lib/atm_ruby/client.rb', line 6 def auth_header @auth_header end |
Instance Method Details
#gen_auth_token ⇒ Object
20 21 22 |
# File 'lib/atm_ruby/client.rb', line 20 def gen_auth_token (Base64.encode64(username + ':' + password)[0..-2]).to_s end |
#set_access_token ⇒ Object
24 25 26 27 |
# File 'lib/atm_ruby/client.rb', line 24 def set_access_token { 'Authorization' => "Basic #{gen_auth_token}", 'Content-Type' => 'application/json' } end |
#TestCase ⇒ Object
33 34 35 36 |
# File 'lib/atm_ruby/client.rb', line 33 def TestCase ATM::Services::TestCase.new(auth_header: auth_header, base_url: base_url, environment: environment, project_id: project_id) end |