module Besepa::Utils::Connection

Public Instance Methods

connection(options={}) click to toggle source

Returns a Faraday::Connection object

@param options [Hash] A hash of options @return [Faraday::Connection]

# File lib/besepa/utils/connection.rb, line 14
def connection(options={})
  options = options.merge(Besepa.options)
  Faraday.new ( options[:endpoint] ) do |conn|
    conn.request :json
    conn.response :json, :content_type => /\bjson$/
    conn.authorization( 'Bearer', options[:api_key])
    conn.adapter :net_http
  end
end