Class: Spree::Shipstation::ShipmentNotice
- Inherits:
-
Object
- Object
- Spree::Shipstation::ShipmentNotice
- Defined in:
- lib/spree/shipstation/shipment_notice.rb
Instance Attribute Summary collapse
-
#shipment_number ⇒ Object
readonly
Returns the value of attribute shipment_number.
-
#shipment_tracking ⇒ Object
readonly
Returns the value of attribute shipment_tracking.
-
#store ⇒ Object
readonly
Returns the value of attribute store.
Class Method Summary collapse
Instance Method Summary collapse
- #apply ⇒ Object
-
#initialize(shipment_number:, shipment_tracking:, store:) ⇒ ShipmentNotice
constructor
A new instance of ShipmentNotice.
Constructor Details
#initialize(shipment_number:, shipment_tracking:, store:) ⇒ ShipmentNotice
Returns a new instance of ShipmentNotice.
20 21 22 23 24 |
# File 'lib/spree/shipstation/shipment_notice.rb', line 20 def initialize(shipment_number:, shipment_tracking:, store:) @shipment_number = shipment_number @shipment_tracking = shipment_tracking @store = store end |
Instance Attribute Details
#shipment_number ⇒ Object (readonly)
Returns the value of attribute shipment_number.
6 7 8 |
# File 'lib/spree/shipstation/shipment_notice.rb', line 6 def shipment_number @shipment_number end |
#shipment_tracking ⇒ Object (readonly)
Returns the value of attribute shipment_tracking.
6 7 8 |
# File 'lib/spree/shipstation/shipment_notice.rb', line 6 def shipment_tracking @shipment_tracking end |
#store ⇒ Object (readonly)
Returns the value of attribute store.
6 7 8 |
# File 'lib/spree/shipstation/shipment_notice.rb', line 6 def store @store end |
Class Method Details
.from_payload(params, store:) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/spree/shipstation/shipment_notice.rb', line 9 def from_payload(params, store:) new( # ShipStation's webhook param is named `order_number` but its value is the # shipment number — it mirrors the <OrderNumber> field from the export XML. shipment_number: params[:order_number], shipment_tracking: params[:tracking_number], store: store ) end |
Instance Method Details
#apply ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/spree/shipstation/shipment_notice.rb', line 26 def apply raise ShipmentNotFoundError, shipment_number unless shipment ::Spree::Shipment.transaction do ship_shipment end shipment end |