Class: Gemgento::Magento::ShipmentTrackAdapter
- Inherits:
-
Object
- Object
- Gemgento::Magento::ShipmentTrackAdapter
- Defined in:
- app/adapters/gemgento/magento/shipment_track_adapter.rb
Instance Attribute Summary collapse
- #shipment ⇒ Gemgento::Shipment
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #import ⇒ Gemgento::ShipmentTrackAdapter
-
#initialize(source, shipment = nil) ⇒ ShipmentTrackAdapter
constructor
A new instance of ShipmentTrackAdapter.
Constructor Details
#initialize(source, shipment = nil) ⇒ ShipmentTrackAdapter
Returns a new instance of ShipmentTrackAdapter.
8 9 10 11 |
# File 'app/adapters/gemgento/magento/shipment_track_adapter.rb', line 8 def initialize(source, shipment = nil) @source = source @shipment = shipment end |
Instance Attribute Details
#shipment ⇒ Gemgento::Shipment
26 27 28 |
# File 'app/adapters/gemgento/magento/shipment_track_adapter.rb', line 26 def shipment @shipment end |
#source ⇒ Object
Returns the value of attribute source.
4 5 6 |
# File 'app/adapters/gemgento/magento/shipment_track_adapter.rb', line 4 def source @source end |
Instance Method Details
#import ⇒ Gemgento::ShipmentTrackAdapter
14 15 16 17 18 19 20 21 22 23 |
# File 'app/adapters/gemgento/magento/shipment_track_adapter.rb', line 14 def import shipment_track = Gemgento::ShipmentTrack.find_or_initialize_by(magento_id: self.source[:track_id]) shipment_track.shipment = self.shipment shipment_track.carrier_code = self.source[:carrier_code] shipment_track.title = self.source[:title] shipment_track.number = self.source[:number] shipment_track.save! return shipment_track end |