Sha256: 1fae27518a1990fa0610752348f396bdc4c375f74d07edc936bf5e459d475a39
Contents?: true
Size: 895 Bytes
Versions: 3
Compression:
Stored size: 895 Bytes
Contents
require 'faraday' require 'forwardable' require 'addressable/uri' require 'payable/middleware' module Payable class Client extend Forwardable attr_reader :company_id, :api_key def initialize(company_id: Payable.config.company_id, api_key: Payable.config.api_key) @company_id = company_id or raise MissingRequiredSetting, "company_id" @api_key = api_key or raise MissingRequiredSetting, "api_key" end def connection @connection ||= Faraday.new Payable.api_url do |conn| conn.basic_auth company_id, api_key conn.request :json conn.response :json conn.response :logger, Payable.config.logger, bodies: true if Payable.config.logger conn.response :symbolize_keys conn.response :raise_error conn.adapter Faraday.default_adapter end end def_delegators :connection, :get, :post end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
payable-api-0.1.2 | lib/payable/client.rb |
payable-api-0.1.1 | lib/payable/client.rb |
payable-api-0.1.0 | lib/payable/client.rb |