Method: Orchestrate::Client#initialize

Defined in:
lib/orchestrate/client.rb

#initialize(api_key, host = "https://api.orchestrate.io") {|The| ... } ⇒ Object

TODO:

api_key -> app_url, parse api_key from auth section of url

Instantiate a new Client for an Orchestrate application.

Parameters:

  • api_key (#to_s)

    The API Key for your Orchestrate application.

  • host (#to_s) (defaults to: "https://api.orchestrate.io")

    The host datacenter for your Orchestrate application.

Yield Parameters:

  • The (Faraday::Connection)

    setup for the faraday connection.

[View source]

28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/orchestrate/client.rb', line 28

def initialize(api_key, host="https://api.orchestrate.io", &block)
  @api_key = api_key
  @host = host
  @faraday_configuration = block
  @http = Faraday.new(@host) do |faraday|
    block = lambda{|f| f.adapter :net_http_persistent } unless block
    block.call faraday

    # faraday seems to want you do specify these twice.
    faraday.request :basic_auth, api_key, ''
    faraday.basic_auth api_key, ''
  end
end