Sha256: 2f8c5da2b568897d0da72b8effeb944cf0912b71b06c1c3fe4403f0b8b6a8e7a
Contents?: true
Size: 1.5 KB
Versions: 4
Compression:
Stored size: 1.5 KB
Contents
module FbGraph class Order < Node attr_accessor :application, :from, :to, :amount, :status, :country, :created_time, :updated_time def initialize(identifier, attributes = {}) super if application = attributes[:application] @application = Application.new(app[:id], app) end if from = attributes[:from] @from = User.new(from[:id], from) end if to = attributes[:to] @to = User.new(to[:id], to) end @status = attributes[:status] @country = attributes[:country] if attributes[:created_time] @created_time = Time.parse(attributes[:created_time]).utc end if attributes[:updated_time] @updated_time = Time.parse(attributes[:updated_time]).utc end end def settled!(options = {}) update options.merge(:status => :settled) end def refunded!(options = {}) update options.merge(:status => :refunded, :refund_funding_source => true) end def canceled!(options = {}) update options.merge(:status => :canceled) end def update(attributes = {}) _attributes_ = attributes.dup params = { :access_token => self.access_token, :status => _attributes_.delete(:status), :message => _attributes_.delete(:message), :refund_funding_source => _attributes_.delete(:refund_funding_source), :refund_reason => _attributes_.delete(:refund_reason), :params => _attributes_.to_json } post params end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fb_graph-1.8.4 | lib/fb_graph/order.rb |
fb_graph-1.8.3 | lib/fb_graph/order.rb |
fb_graph-1.8.2 | lib/fb_graph/order.rb |
fb_graph-1.8.1 | lib/fb_graph/order.rb |