Class: Ultracart::Notification
- Inherits:
-
Object
- Object
- Ultracart::Notification
- Defined in:
- app/models/ultracart/notification.rb
Overview
Constant Summary collapse
- CURRENT_STAGE_MAPPING =
{ 'PO' => :pre_order, 'AR' => :account_receivable, 'SD' => :shipping, 'REJ' => :rejected, 'CO' => :completed_order}
Instance Attribute Summary collapse
-
#anchor_ids ⇒ Object
Returns the value of attribute anchor_ids.
-
#items ⇒ Object
Returns the value of attribute items.
-
#order_details ⇒ Object
Returns the value of attribute order_details.
Instance Method Summary collapse
-
#current_stage ⇒ Object
Stage that the order is in ——————————————————————————.
-
#initialize(notify_params) ⇒ Notification
constructor
——————————————————————————.
Constructor Details
#initialize(notify_params) ⇒ Notification
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/models/ultracart/notification.rb', line 10 def initialize(notify_params) #--- extract the order details and the items @order_details = (notify_params['export']['order']) @items = @order_details['item'] @items = Array.[](@items) if @items.class == HashWithIndifferentAccess or @items.class == Hash #--- remove the items hash from the order, so we can save the order details seperate @order_details.delete('item') #--- build up the anchor_ids array @anchor_ids = Array.new @items.each do |item| @anchor_ids << extract_anchor_id(item) end end |
Instance Attribute Details
#anchor_ids ⇒ Object
Returns the value of attribute anchor_ids.
3 4 5 |
# File 'app/models/ultracart/notification.rb', line 3 def anchor_ids @anchor_ids end |
#items ⇒ Object
Returns the value of attribute items.
3 4 5 |
# File 'app/models/ultracart/notification.rb', line 3 def items @items end |
#order_details ⇒ Object
Returns the value of attribute order_details.
3 4 5 |
# File 'app/models/ultracart/notification.rb', line 3 def order_details @order_details end |
Instance Method Details
#current_stage ⇒ Object
Stage that the order is in
29 30 31 |
# File 'app/models/ultracart/notification.rb', line 29 def current_stage return CURRENT_STAGE_MAPPING[@order_details['current_stage']] end |