Sha256: cedae6853a5154da80c798515cba7216829486878ac807e98971f9d9ae845d91
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true module SolidusEasypost class ShipmentBuilder class << self def from_package(package) ::EasyPost::Shipment.create( to_address: AddressBuilder.from_address(package.order.ship_address), from_address: AddressBuilder.from_stock_location(package.stock_location), parcel: ParcelBuilder.from_package(package), ) end def from_shipment(shipment) ::EasyPost::Shipment.create( to_address: AddressBuilder.from_address(shipment.order.ship_address), from_address: AddressBuilder.from_stock_location(shipment.stock_location), parcel: ParcelBuilder.from_package(shipment.to_package), ) end def from_return_authorization(return_authorization) ::EasyPost::Shipment.create( from_address: AddressBuilder.from_stock_location(return_authorization.stock_location), to_address: AddressBuilder.from_address(return_authorization.order.ship_address), parcel: ParcelBuilder.from_return_authorization(return_authorization), is_return: true ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus_easypost-3.0.0 | lib/solidus_easypost/shipment_builder.rb |