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, #raw_attributes
Instance Method Summary collapse
- #cancel!(options = {}) ⇒ Object (also: #canceled!)
-
#initialize(identifier, attributes = {}) ⇒ Order
constructor
A new instance of Order.
- #refund!(options = {}) ⇒ Object (also: #refunded!)
- #settle!(options = {}) ⇒ Object (also: #settled!)
- #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 25 |
# File 'lib/fb_graph/order.rb', line 5 def initialize(identifier, attributes = {}) super if app = 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 @amount = attributes[:amount] @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
#cancel!(options = {}) ⇒ Object Also known as: canceled!
37 38 39 |
# File 'lib/fb_graph/order.rb', line 37 def cancel!( = {}) update .merge(:status => :canceled) end |
#refund!(options = {}) ⇒ Object Also known as: refunded!
32 33 34 |
# File 'lib/fb_graph/order.rb', line 32 def refund!( = {}) update .merge(:status => :refunded) end |
#settle!(options = {}) ⇒ Object Also known as: settled!
27 28 29 |
# File 'lib/fb_graph/order.rb', line 27 def settle!( = {}) update .merge(:status => :settled) end |
#update(attributes = {}) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fb_graph/order.rb', line 42 def update(attributes = {}) _attributes_ = attributes.dup params = { :access_token => _attributes_.delete(: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_ } super params end |