class BalihooLpcClient::Request::Authentication

Public Instance Methods

authenticate!() click to toggle source
# File lib/balihoo_lpc_client/request/authentication.rb, line 4
def authenticate!
  response = self.class.post('/genClientAPIKey', opts).parsed_response
  handle_errors_with(klass: AuthenticationError, response: response)
  handle_success(response: response)
end

Private Instance Methods

handle_success(response:) click to toggle source
# File lib/balihoo_lpc_client/request/authentication.rb, line 24
def handle_success(response:)
  auth = Response::Authentication.new(response)
  config.client_id = auth.client_id
  config.client_api_key = auth.client_api_key
  auth
end
opts() click to toggle source
# File lib/balihoo_lpc_client/request/authentication.rb, line 12
def opts
  {
    query: {
      brandKey: api.config.brand_key,
      apiKey: api.config.api_key,
      locationKey: api.config.location_key,
      userId: api.config.user_id,
      groupId: api.config.group_id
    }
  }
end