Class: Gemgento::Magento::OrderStatusAdapter
- Inherits:
-
Object
- Object
- Gemgento::Magento::OrderStatusAdapter
- Defined in:
- app/adapters/gemgento/magento/order_status_adapter.rb
Instance Attribute Summary collapse
-
#order ⇒ Object
Returns the value of attribute order.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #import ⇒ Object
-
#initialize(source, order) ⇒ OrderStatusAdapter
constructor
A new instance of OrderStatusAdapter.
Constructor Details
#initialize(source, order) ⇒ OrderStatusAdapter
Returns a new instance of OrderStatusAdapter.
8 9 10 11 |
# File 'app/adapters/gemgento/magento/order_status_adapter.rb', line 8 def initialize(source, order) @source = source @order = order end |
Instance Attribute Details
#order ⇒ Object
Returns the value of attribute order.
4 5 6 |
# File 'app/adapters/gemgento/magento/order_status_adapter.rb', line 4 def order @order end |
#source ⇒ Object
Returns the value of attribute source.
4 5 6 |
# File 'app/adapters/gemgento/magento/order_status_adapter.rb', line 4 def source @source end |
Instance Method Details
#import ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'app/adapters/gemgento/magento/order_status_adapter.rb', line 13 def import order_status = Gemgento::OrderStatus.find_or_initialize_by(order_id: self.order.id, status: self.source[:status], comment: self.source[:comment]) order_status.is_active = self.source[:is_active] order_status.is_customer_notified = self.source[:is_customer_notified].to_i order_status.created_at = self.source[:created_at] order_status.save! order_status end |