class Stacktor::Identity::V2::Client

Public Instance Methods

authenticate_token(opts) click to toggle source
# 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

Private Instance Methods

build_headers() click to toggle source
# File lib/stacktor/identity/v2/client.rb, line 32
def build_headers
  {
    'Content-Type' => 'application/json'
  }
end
parse_token(resp) click to toggle source
# File lib/stacktor/identity/v2/client.rb, line 38
def parse_token(resp)
  if resp[:success]
    resp[:token] = Token.new(resp[:body], self)
  end
end