Method: Rev::HttpClient#initialize

Defined in:
lib/rev-api/http_client.rb

#initialize(client_api_key, user_api_key, host) ⇒ HttpClient

Create a new HttpClient, connecting to given host, and using the given Client and User API Keys.

Parameters:

  • client_api_key (String)

    the client API key to use for authenticating

  • user_api_key (String)

    the user API key to use for authenticating

  • host (String)

    the host to send requests to. Should be one of Rev::Api::PRODCUTION_HOST or Rev::Api::SANDBOX_HOST



16
17
18
19
20
21
22
23
24
25
# File 'lib/rev-api/http_client.rb', line 16

def initialize(client_api_key, user_api_key, host)
  endpoint_uri = "https://#{host}/api/v1"
  self.class.base_uri(endpoint_uri)

  auth_string = "Rev #{client_api_key}:#{user_api_key}"
  @default_headers = {
    'Authorization' => auth_string,
    'User-Agent' => USER_AGENT # to track usage of SDK
  }
end