Sha256: 712a3f47b41c3738d0b903ca5d00388238a9dd7af9a19e219ccbff859b320824
Contents?: true
Size: 1.95 KB
Versions: 1
Compression:
Stored size: 1.95 KB
Contents
require "net/http" require "net/https" require "json" require "paymill/version" module Paymill API_BASE = "api.paymill.com" API_VERSION = "v2" ROOT_PATH = File.dirname(__FILE__) @@api_key = nil autoload :Base, "paymill/base" autoload :Client, "paymill/client" autoload :Offer, "paymill/offer" autoload :Payment, "paymill/payment" autoload :Preauthorization, "paymill/preauthorization" autoload :Refund, "paymill/refund" autoload :Subscription, "paymill/subscription" autoload :Transaction, "paymill/transaction" autoload :Webhook, "paymill/webhook" module Operations autoload :All, "paymill/operations/all" autoload :Create, "paymill/operations/create" autoload :Find, "paymill/operations/find" autoload :Update, "paymill/operations/update" autoload :Delete, "paymill/operations/delete" end module Request autoload :Base, "paymill/request/base" autoload :Connection, "paymill/request/connection" autoload :Info, "paymill/request/info" autoload :Validator, "paymill/request/validator" end class PaymillError < StandardError; end class AuthenticationError < PaymillError; end class APIError < PaymillError; end # Returns the set api key # # @return [String] The api key def self.api_key @@api_key end # Sets the api key # # @param [String] api_key The api key def self.api_key=(api_key) @@api_key = api_key end # Makes a request against the Paymill API # # @param [Symbol] http_method The http method to use, must be one of :get, :post, :put and :delete # @param [String] api_url The API url to use # @param [Hash] data The data to send, e.g. used when creating new objects. # @return [Array] The parsed JSON response. def self.request(http_method, api_url, data) info = Request::Info.new(http_method, api_url, data) Request::Base.new(info).perform end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paymill-0.4.0 | lib/paymill.rb |