Class: AdvisorsCommandClient::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/advisors_command_client/connection.rb

Defined Under Namespace

Classes: WsseAuth

Instance Method Summary collapse

Constructor Details

#initialize(username, api_key, url) ⇒ Connection

Returns a new instance of Connection.



11
12
13
14
15
# File 'lib/advisors_command_client/connection.rb', line 11

def initialize(username, api_key, url)
  @username = username
  @api_key = api_key
  @url = url
end

Instance Method Details

#buildObject



17
18
19
20
21
22
23
24
# File 'lib/advisors_command_client/connection.rb', line 17

def build
  Faraday.new(@url) do |faraday|
    faraday.request :json
    faraday.use AdvisorsCommandClient::Connection::WsseAuth, @username, @api_key
    faraday.adapter :typhoeus
    faraday.response :json, content_type: /\bjson$/
  end
end