Class: Stacktor::Identity::V2::Client

Inherits:
Core::Client show all
Defined in:
lib/stacktor/identity/v2/client.rb

Instance Method Summary collapse

Methods inherited from Core::Client

#before_request, #execute_request, #initialize, #settings, #url, #url=

Constructor Details

This class inherits a constructor from Stacktor::Core::Client

Instance Method Details

#authenticate_token(opts) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/stacktor/identity/v2/client.rb', line 10

def authenticate_token(opts)
  path = "/tokens"
  data = {
    auth: {
      tenantId: opts[:tenant_id],
      passwordCredentials: {
        username: opts[:username],
        password: opts[:password]
      }
    }
  }
  resp = self.execute_request(
    path: path,
    method: "POST",
    data: data
  )
  parse_token(resp)
  return resp
end