class CoinGate::Merchant::Order

Constants

STATUSES

Public Class Methods

create(params, authentication={}, options={}) click to toggle source
# File lib/coingate/merchant/order.rb, line 46
def self.create(params, authentication={}, options={})
  create!(params, authentication, options)
rescue CoinGate::OrderIsNotValid
  false
end
create!(params, authentication={}, options={}) click to toggle source
# File lib/coingate/merchant/order.rb, line 38
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
find(order_id, authentication={}, options={}) click to toggle source
# File lib/coingate/merchant/order.rb, line 32
def self.find(order_id, authentication={}, options={})
  find!(order_id, authentication, options)
rescue CoinGate::OrderNotFound
  false
end
find!(order_id, authentication={}, options={}) click to toggle source
# File lib/coingate/merchant/order.rb, line 24
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
new(params) click to toggle source
# File lib/coingate/merchant/order.rb, line 4
def initialize(params)
  @order = params

  @order.each do |name, value|
    self.define_singleton_method name do
      value
    end
  end
end

Public Instance Methods

to_hash() click to toggle source
# File lib/coingate/merchant/order.rb, line 20
def to_hash
  @order
end