Module: SolidusEasypost::Spree::ShipmentDecorator
- Defined in:
- app/decorators/models/solidus_easypost/spree/shipment_decorator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.prepended(base) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/decorators/models/solidus_easypost/spree/shipment_decorator.rb', line 6 def self.prepended(base) base.state_machine.before_transition( to: :shipped, do: :buy_easypost_rate, if: -> { SolidusEasypost.configuration.purchase_labels } ) base.delegate( :easy_post_rate_id, :easy_post_shipment_id, to: :selected_shipping_rate, prefix: :selected, allow_nil: true, ) end |
Instance Method Details
#easypost_postage_label_url ⇒ Object
28 29 30 |
# File 'app/decorators/models/solidus_easypost/spree/shipment_decorator.rb', line 28 def easypost_postage_label_url easypost_shipment&.postage_label&.label_url end |
#easypost_shipment ⇒ Object
22 23 24 25 26 |
# File 'app/decorators/models/solidus_easypost/spree/shipment_decorator.rb', line 22 def easypost_shipment return unless selected_easy_post_shipment_id @easypost_shipment ||= ::EasyPost::Shipment.retrieve(selected_easy_post_shipment_id) end |