Sha256: b4c03c6829905b1fb5cc579cf0a161f631160c103712e6f3f28944c27fc3a920

Contents?: true

Size: 1.64 KB

Versions: 3

Compression:

Stored size: 1.64 KB

Contents

module SynapsePay
  class Order < APIResource
    attr_accessor :account_type
    attr_accessor :amount
    attr_accessor :date
    attr_accessor :date_settled
    attr_accessor :discount
    attr_accessor :facilitator_fee
    attr_accessor :fee
    attr_accessor :id
    attr_accessor :is_buyer
    attr_accessor :note
    attr_accessor :resource_uri
    attr_accessor :seller
    attr_accessor :status
    attr_accessor :status_url
    attr_accessor :supp_id
    attr_accessor :ticket_number
    attr_accessor :tip
    attr_accessor :total

    def update(params={}, headers={})
      params = ParamsBuilder.merge({
        :order_id => id,
      }, params)
      method = APIMethod.new(:post, "/order/update", params, headers, self)
      json = @client.execute(method)
      self.refresh_from(json[:order], method, @client)
    end

    def void(params={}, headers={})
      params = ParamsBuilder.merge({
        :order_id => id,
      }, params)
      method = APIMethod.new(:post, "/order/void", params, headers, self)
      json = @client.execute(method)
      self.refresh_from(json[:order], method, @client)
    end

    # Everything below here is used behind the scenes.
    APIResource.register_api_subclass(self, "order")
    @api_attributes = {
      :account_type => {},
      :amount => {},
      :date => {},
      :date_settled => {},
      :discount => {},
      :facilitator_fee => {},
      :fee => {},
      :id => {},
      :is_buyer => {},
      :note => {},
      :resource_uri => {},
      :seller => {},
      :status => {},
      :status_url => {},
      :supp_id => {},
      :ticket_number => {},
      :tip => {},
      :total => {},
    }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
synapse_pay-0.0.8 lib/synapse_pay/resources/order.rb
synapse_pay-0.0.7 lib/synapse_pay/resources/order.rb
synapse_pay-0.0.6 lib/synapse_pay/resources/order.rb