Class: FriendlyShipping::Services::RL::BOLPackagesSerializer
- Inherits:
-
Object
- Object
- FriendlyShipping::Services::RL::BOLPackagesSerializer
- Defined in:
- lib/friendly_shipping/services/rl/bol_packages_serializer.rb
Overview
Serializes packages for R+L BOL API requests.
Class Method Summary collapse
-
.call(packages:, options:) ⇒ Array<Hash>
Serialized packages.
Class Method Details
.call(packages:, options:) ⇒ Array<Hash>
Returns serialized packages.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/friendly_shipping/services/rl/bol_packages_serializer.rb', line 11 def self.call(packages:, options:) packages.flat_map do |package| = .(package) package.items.map do |item| = .(item) { IsHazmat: false, Pieces: 1, PackageType: "BOX", NMFCItemNumber: .nmfc_primary_code, NMFCSubNumber: .nmfc_sub_code, Class: .freight_class, Weight: item.weight.convert_to(:pounds).value.ceil, Description: item.description.presence || "Commodities" }.compact end end end |