module Paymill

Constants

API_BASE
API_VERSION
VERSION

Public Class Methods

api_key() click to toggle source
# File lib/paymill.rb, line 33
def self.api_key
  @@api_key
end
api_key=( api_key ) click to toggle source
# File lib/paymill.rb, line 37
def self.api_key=( api_key )
  @@api_key = api_key
end
api_version() click to toggle source
# File lib/paymill.rb, line 29
def self.api_version
  API_VERSION
end
request( payload ) click to toggle source
# File lib/paymill.rb, line 41
def self.request( payload )
  raise AuthenticationError unless Paymill.api_key
  https ||= Net::HTTP.new( API_BASE, Net::HTTP.https_default_port)
  https.use_ssl = true

  response = https.start do
    https.request( payload )
  end

  raise PaymillError, response.body unless response.class.eql? Net::HTTPOK
  JSON.parse( response.body )
end