Class: Jirafe::Callback::Events::Order
- Inherits:
-
Jirafe::Callback::Event
- Object
- JirafeCallback
- Jirafe::Callback::Event
- Jirafe::Callback::Events::Order
- Includes:
- DataHelper, Model
- Defined in:
- lib/jirafe/callback/events/order.rb
Constant Summary
Constants inherited from Jirafe::Callback::Event
Jirafe::Callback::Event::GLOBAL_ACTION
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#customer ⇒ Object
Returns the value of attribute customer.
-
#discount_amount ⇒ Object
Returns the value of attribute discount_amount.
-
#grand_total ⇒ Object
Returns the value of attribute grand_total.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#items ⇒ Object
Returns the value of attribute items.
-
#shipping_amount ⇒ Object
Returns the value of attribute shipping_amount.
-
#status ⇒ Object
Returns the value of attribute status.
-
#sub_total ⇒ Object
Returns the value of attribute sub_total.
-
#tax_amount ⇒ Object
Returns the value of attribute tax_amount.
-
#visitor_identifier ⇒ Object
Returns the value of attribute visitor_identifier.
Attributes inherited from Jirafe::Callback::Event
Instance Method Summary collapse
Methods included from DataHelper
#format_amount, #format_discount_amount
Methods included from Model
#attributes, #attributes_for_change, #create, included, #initialize, #reinitialize, #update
Methods inherited from Jirafe::Callback::Event
events_url, send, #to_json, trust_callback?
Methods inherited from JirafeCallback
Methods included from ResponseParser
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
7 8 9 |
# File 'lib/jirafe/callback/events/order.rb', line 7 def created_at @created_at end |
#customer ⇒ Object
Returns the value of attribute customer.
7 8 9 |
# File 'lib/jirafe/callback/events/order.rb', line 7 def customer @customer end |
#discount_amount ⇒ Object
Returns the value of attribute discount_amount.
7 8 9 |
# File 'lib/jirafe/callback/events/order.rb', line 7 def discount_amount @discount_amount end |
#grand_total ⇒ Object
Returns the value of attribute grand_total.
7 8 9 |
# File 'lib/jirafe/callback/events/order.rb', line 7 def grand_total @grand_total end |
#identifier ⇒ Object
Returns the value of attribute identifier.
7 8 9 |
# File 'lib/jirafe/callback/events/order.rb', line 7 def identifier @identifier end |
#items ⇒ Object
Returns the value of attribute items.
7 8 9 |
# File 'lib/jirafe/callback/events/order.rb', line 7 def items @items end |
#shipping_amount ⇒ Object
Returns the value of attribute shipping_amount.
7 8 9 |
# File 'lib/jirafe/callback/events/order.rb', line 7 def shipping_amount @shipping_amount end |
#status ⇒ Object
Returns the value of attribute status.
7 8 9 |
# File 'lib/jirafe/callback/events/order.rb', line 7 def status @status end |
#sub_total ⇒ Object
Returns the value of attribute sub_total.
7 8 9 |
# File 'lib/jirafe/callback/events/order.rb', line 7 def sub_total @sub_total end |
#tax_amount ⇒ Object
Returns the value of attribute tax_amount.
7 8 9 |
# File 'lib/jirafe/callback/events/order.rb', line 7 def tax_amount @tax_amount end |
#visitor_identifier ⇒ Object
Returns the value of attribute visitor_identifier.
7 8 9 |
# File 'lib/jirafe/callback/events/order.rb', line 7 def visitor_identifier @visitor_identifier end |
Instance Method Details
#action_map ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/jirafe/callback/events/order.rb', line 24 def action_map { :create => "orderCreate", :update => "orderUpdate", :import => "orderImport" } end |
#data ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/jirafe/callback/events/order.rb', line 32 def data { "orderId" => identifier, "status" => status_map[status], "customerHash" => customer, "vistorId" => visitor_identifier, "time" => created_at || Time.now.to_i, "grandTotal" => format_amount(grand_total), "subTotal" => format_amount(sub_total), "taxAmount" => format_amount(tax_amount), "shippingAmount" => format_amount(shipping_amount), "discountAmount" => format_discount_amount(discount_amount), "items" => items.map { |item| item.data } } end |
#status_map ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jirafe/callback/events/order.rb', line 10 def status_map { :new => "new", :payment_pending => "pendingPayment", :processing => "processing", :complete => "complete", :closed => "closed", :canceled => "canceled", :held => "held", :payment_review => "paymentReview", :unknown => "unknown" } end |