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(**options) ⇒ Client
constructor
A new instance of Client.
- #set_access_token ⇒ Object
- #TestCase ⇒ Object
- #TestPlan ⇒ Object
- #TestRun ⇒ Object
Constructor Details
#initialize(**options) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/atm_ruby/client.rb', line 8 def initialize(**) = ATM.config.to_hash.merge() .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
21 22 23 |
# File 'lib/atm_ruby/client.rb', line 21 def gen_auth_token (Base64.encode64(username + ':' + password)[0..-2]).to_s end |
#set_access_token ⇒ Object
25 26 27 28 |
# File 'lib/atm_ruby/client.rb', line 25 def set_access_token { 'Authorization' => "Basic #{gen_auth_token}", 'Content-Type' => 'application/json' } end |
#TestCase ⇒ Object
34 35 36 37 38 39 40 41 |
# 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 |