class WellsFargo::API

Attributes

credentials[R]
url[R]

Public Class Methods

new(url, credentials) click to toggle source
# File lib/wells_fargo/api.rb, line 14
def initialize(url, credentials)
  @url = url
  @credentials = credentials
end

Public Instance Methods

execute(method, path, params) click to toggle source
# File lib/wells_fargo/api.rb, line 19
def execute(method, path, params)
  raw_response = connection.request(method: method, path: path, **params)

  Response.new(raw_response)
end

Private Instance Methods

auth_token() click to toggle source
# File lib/wells_fargo/api.rb, line 44
def auth_token
  Base64.strict_encode64(
    "#{credentials[:consumer_key]}:#{credentials[:consumer_secret]}"
  )
end
connection() click to toggle source
# File lib/wells_fargo/api.rb, line 27
def connection
  @connection ||= Excon.new(
    url,
    client_cert: credentials[:client_cert],
    client_key: credentials[:client_key],
    ssl_verify_peer: false,
    headers: default_headers
  )
end
default_headers() click to toggle source
# File lib/wells_fargo/api.rb, line 37
def default_headers
  {
    'Authorization' => "Basic #{auth_token}",
    'gateway-company-id' => credentials[:gateway_company_id]
  }
end