Sha256: dd55975e3660c0b0edb953b823eb062304da43c0c765ac4416979aaeaebd23d9
Contents?: true
Size: 648 Bytes
Versions: 1
Compression:
Stored size: 648 Bytes
Contents
# frozen_string_literal: true module SolidusEasypost module Spree module Stock module PackageDecorator def easypost_parcel total_weight = contents.sum do |item| item.quantity * item.variant.weight end ::EasyPost::Parcel.create weight: total_weight end def easypost_shipment ::EasyPost::Shipment.create( to_address: order.ship_address.easypost_address, from_address: stock_location.easypost_address, parcel: easypost_parcel ) end ::Spree::Stock::Package.prepend self end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus_easypost-2.0.0 | app/decorators/models/solidus_easypost/spree/stock/package_decorator.rb |