class RubyPayler::Connection

Network connection to Payler

Public Class Methods

new(url:, key:, debug: false) click to toggle source
# File lib/ruby_payler/connection.rb, line 7
def initialize(url:, key:, debug: false)
  @driver = Faraday.new(url: url, params: { key: key }) do |f|
    f.request :url_encoded # form-encode POST params

    f.response :mashify          # 3. mashify parsed JSON
    f.response :json             # 2. parse JSON
    f.response :logger if debug  # 1. log requests to STDOUT

    f.adapter Faraday.default_adapter # make requests with Net::HTTP
  end
end

Public Instance Methods

post(endpoint, params) click to toggle source
# File lib/ruby_payler/connection.rb, line 19
def post(endpoint, params)
  @driver.post(endpoint, params)
end