Class: SolidusEasypost::ShipmentBuilder
- Inherits:
-
Object
- Object
- SolidusEasypost::ShipmentBuilder
- Defined in:
- lib/solidus_easypost/shipment_builder.rb
Class Method Summary collapse
- .from_package(package) ⇒ Object
- .from_return_authorization(return_authorization) ⇒ Object
- .from_shipment(shipment) ⇒ Object
Class Method Details
.from_package(package) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/solidus_easypost/shipment_builder.rb', line 6 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 |
.from_return_authorization(return_authorization) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/solidus_easypost/shipment_builder.rb', line 22 def () ::EasyPost::Shipment.create( from_address: AddressBuilder.from_stock_location(.stock_location), to_address: AddressBuilder.from_address(.order.ship_address), parcel: ParcelBuilder.(), is_return: true ) end |
.from_shipment(shipment) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/solidus_easypost/shipment_builder.rb', line 14 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 |