Method: PlatformAPI.connect

Defined in:
lib/platform-api/client.rb

.connect(api_key, options = nil) ⇒ Client

Get a Client configured to use HTTP Basic authentication.

Parameters:

  • api_key (String)

    The API key to use when connecting.

  • options (Hash<Symbol,String>) (defaults to: nil)

    Optionally, custom settings to use with the client. Allowed options are default_headers, cache and host.

Returns:

  • (Client)

    A client configured to use the API with HTTP Basic authentication.



20
21
22
23
24
25
26
# File 'lib/platform-api/client.rb', line 20

def self.connect(api_key, options=nil)
  options = custom_options(options)
  puts "OPTIONS", options
  url = "https://:#{api_key}@#{options[:host]}"
  client = Heroics.client_from_schema(SCHEMA, url, options)
  Client.new(client)
end