class QuickPay::API::Client

Constants

DEFAULT_HEADERS
Request

Public Class Methods

new(username: nil, password: nil, base_uri: "https://api.quickpay.net", options: {}) click to toggle source
# File lib/quickpay/api/client.rb, line 16
def initialize(username: nil, password: nil, base_uri: "https://api.quickpay.net", options: {})
  opts = {
    read_timeout: options.fetch(:read_timeout, 60),
    write_timeout: options.fetch(:write_timeout, 60),
    connect_timeout: options.fetch(:connect_timeout, 60),
    json_opts: options.fetch(:json_opts, nil)
  }

  opts[:username] = Excon::Utils.escape_uri(username) if username
  opts[:password] = Excon::Utils.escape_uri(password) if password

  @connection = Excon.new(base_uri, opts)
end

Private Instance Methods

scrub_body(body, content_type) click to toggle source
# File lib/quickpay/api/client.rb, line 72
def scrub_body(body, content_type)
  return "" if body.to_s.empty?

  if ["application/json", "application/x-www-form-urlencoded"].include?(content_type)
    body
  else
    "<scrubbed for Content-Type #{content_type}>"
  end
end