Class: Gemgento::Order
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Gemgento::Order
- Defined in:
- app/models/gemgento/order.rb
Overview
Instance Attribute Summary collapse
-
#push_cart_customer ⇒ Object
Returns the value of attribute push_cart_customer.
-
#subscribe ⇒ Object
Returns the value of attribute subscribe.
-
#tax ⇒ Object
Returns the value of attribute tax.
-
#total ⇒ Object
Returns the value of attribute total.
Class Method Summary collapse
-
.find_or_fetch(increment_id) ⇒ Gemgento::Order
Find or fetch an order by increment_id.
Instance Method Summary collapse
-
#mark_quote_converted ⇒ Void
Set associated quote converted_at.
- #placed_at ⇒ Object
-
#to_param ⇒ String
Return the increment_id instead of id.
Instance Attribute Details
#push_cart_customer ⇒ Object
Returns the value of attribute push_cart_customer.
21 22 23 |
# File 'app/models/gemgento/order.rb', line 21 def push_cart_customer @push_cart_customer end |
#subscribe ⇒ Object
Returns the value of attribute subscribe.
21 22 23 |
# File 'app/models/gemgento/order.rb', line 21 def subscribe @subscribe end |
#tax ⇒ Object
Returns the value of attribute tax.
21 22 23 |
# File 'app/models/gemgento/order.rb', line 21 def tax @tax end |
#total ⇒ Object
Returns the value of attribute total.
21 22 23 |
# File 'app/models/gemgento/order.rb', line 21 def total @total end |
Class Method Details
.find_or_fetch(increment_id) ⇒ Gemgento::Order
Find or fetch an order by increment_id.
47 48 49 |
# File 'app/models/gemgento/order.rb', line 47 def self.find_or_fetch(increment_id) Gemgento::Order.find_by(increment_id: increment_id) || Gemgento::Magento::OrderAdapter.find(increment_id).import end |
Instance Method Details
#mark_quote_converted ⇒ Void
Set associated quote converted_at.
39 40 41 |
# File 'app/models/gemgento/order.rb', line 39 def mark_quote_converted quote.update(converted_at: Time.now) end |
#placed_at ⇒ Object
51 52 53 |
# File 'app/models/gemgento/order.rb', line 51 def placed_at super || self.created_at end |
#to_param ⇒ String
Return the increment_id instead of id. This is for privacy purposes.
32 33 34 |
# File 'app/models/gemgento/order.rb', line 32 def to_param self.increment_id end |