Class: FbGraph::Order
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#application ⇒ Object
Returns the value of attribute application.
-
#country ⇒ Object
Returns the value of attribute country.
-
#created_time ⇒ Object
Returns the value of attribute created_time.
-
#from ⇒ Object
Returns the value of attribute from.
-
#status ⇒ Object
Returns the value of attribute status.
-
#to ⇒ Object
Returns the value of attribute to.
-
#updated_time ⇒ Object
Returns the value of attribute updated_time.
Attributes inherited from Node
#access_token, #endpoint, #identifier
Instance Method Summary collapse
- #canceled!(options = {}) ⇒ Object
-
#initialize(identifier, attributes = {}) ⇒ Order
constructor
A new instance of Order.
- #refunded!(options = {}) ⇒ Object
- #settled!(options = {}) ⇒ Object
- #update(attributes = {}) ⇒ Object
Methods inherited from Node
#connection, #destroy, fetch, #fetch
Methods included from Comparison
Constructor Details
#initialize(identifier, attributes = {}) ⇒ Order
Returns a new instance of Order.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fb_graph/order.rb', line 5 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 |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
3 4 5 |
# File 'lib/fb_graph/order.rb', line 3 def amount @amount end |
#application ⇒ Object
Returns the value of attribute application.
3 4 5 |
# File 'lib/fb_graph/order.rb', line 3 def application @application end |
#country ⇒ Object
Returns the value of attribute country.
3 4 5 |
# File 'lib/fb_graph/order.rb', line 3 def country @country end |
#created_time ⇒ Object
Returns the value of attribute created_time.
3 4 5 |
# File 'lib/fb_graph/order.rb', line 3 def created_time @created_time end |
#from ⇒ Object
Returns the value of attribute from.
3 4 5 |
# File 'lib/fb_graph/order.rb', line 3 def from @from end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/fb_graph/order.rb', line 3 def status @status end |
#to ⇒ Object
Returns the value of attribute to.
3 4 5 |
# File 'lib/fb_graph/order.rb', line 3 def to @to end |
#updated_time ⇒ Object
Returns the value of attribute updated_time.
3 4 5 |
# File 'lib/fb_graph/order.rb', line 3 def updated_time @updated_time end |
Instance Method Details
#canceled!(options = {}) ⇒ Object
34 35 36 |
# File 'lib/fb_graph/order.rb', line 34 def canceled!( = {}) update .merge(:status => :canceled) end |
#refunded!(options = {}) ⇒ Object
30 31 32 |
# File 'lib/fb_graph/order.rb', line 30 def refunded!( = {}) update .merge(:status => :refunded, :refund_funding_source => true) end |
#settled!(options = {}) ⇒ Object
26 27 28 |
# File 'lib/fb_graph/order.rb', line 26 def settled!( = {}) update .merge(:status => :settled) end |
#update(attributes = {}) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fb_graph/order.rb', line 38 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 |