Sha256: 1810d2756e2aec0dd5d9bd7df783f10c830a2dcc065fbc74ae248fe277d34a7e
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
class CoinGate::Merchant::Order STATUSES = %w(new pending confirming paid invalid canceled expired failed) def initialize(params) @order = params @order.each do |name, value| self.define_singleton_method name do value end end end STATUSES.each do |type| define_method "#{type}?" do status == type end end def to_hash @order end def self.find!(order_id, authentication={}, options={}) response_code, order = CoinGate.api_request("/orders/#{order_id}", :get, {}, authentication) if response_code == 200 self.new(order) end end def self.find(order_id, authentication={}, options={}) find!(order_id, authentication, options) rescue CoinGate::OrderNotFound false end def self.create!(params, authentication={}, options={}) response_code, order = CoinGate.api_request('/orders', :post, params, authentication) if response_code == 200 self.new(order) end end def self.create(params, authentication={}, options={}) create!(params, authentication, options) rescue CoinGate::OrderIsNotValid false end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coingate-2.0.0 | lib/coingate/merchant/order.rb |