Module: SolidusEasypost::Spree::CartonDecorator
- Defined in:
- app/decorators/models/solidus_easypost/spree/carton_decorator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.prepended(base) ⇒ Object
6 7 8 |
# File 'app/decorators/models/solidus_easypost/spree/carton_decorator.rb', line 6 def self.prepended(base) base.after_create :track_via_easypost end |
Instance Method Details
#easypost_tracker ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/decorators/models/solidus_easypost/spree/carton_decorator.rb', line 10 def easypost_tracker return @easypost_tracker if @easypost_tracker if easy_post_tracker_id.present? @easypost_tracker = EasyPost::Tracker.retrieve(easy_post_tracker_id) else @easypost_tracker = EasyPost::Tracker.create( tracking_code: tracking, carrier: shipping_method.carrier, ) update!(easy_post_tracker_id: @easypost_tracker.id) end @easypost_tracker end |