Class: FriendlyShipping::Services::ShipEngineLTL::SerializePackages Deprecated
- Inherits:
-
Object
- Object
- FriendlyShipping::Services::ShipEngineLTL::SerializePackages
- Defined in:
- lib/friendly_shipping/services/ship_engine_ltl/serialize_packages.rb
Overview
Deprecated.
Use SerializeStructures instead.
Serializes packages for the rate quote API request.
Class Method Summary collapse
Class Method Details
.call(packages:, options:) ⇒ Array<Hash>
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/friendly_shipping/services/ship_engine_ltl/serialize_packages.rb', line 13 def call(packages:, options:) warn "[DEPRECATION] `SerializePackages` is deprecated. Please use `SerializeStructures` instead." packages.flat_map do |package| = .(package) package.items.map do |item| = .(item) { code: .packaging_code, freight_class: .freight_class, nmfc_code: .nmfc_code, description: item.description || "Commodities", dimensions: { width: item.width.convert_to(:inches).value.ceil, height: item.height.convert_to(:inches).value.ceil, length: item.length.convert_to(:inches).value.ceil, unit: "inches" }, weight: { value: item.weight.convert_to(:pounds).value.ceil, unit: "pounds" }, quantity: 1, # we don't support this yet stackable: .stackable, hazardous_materials: .hazardous_materials } end end end |