Class: FriendlyShipping::Services::RL::RateQuotePackagesSerializer
- Inherits:
-
Object
- Object
- FriendlyShipping::Services::RL::RateQuotePackagesSerializer
- Defined in:
- lib/friendly_shipping/services/rl/rate_quote_packages_serializer.rb
Overview
Serializes packages for R+L rate quote API requests.
Class Method Summary collapse
-
.call(packages:, options:) ⇒ Array<Hash>
Serialized packages.
Class Method Details
.call(packages:, options:) ⇒ Array<Hash>
Returns serialized packages.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/friendly_shipping/services/rl/rate_quote_packages_serializer.rb', line 12 def call(packages:, options:) item_hashes = packages.flat_map do |package| = .(package) package.items.map do |item| = .(item) { Class: .freight_class, Height: item.height.convert_to(:inches), Length: item.length.convert_to(:inches), Weight: item.weight.convert_to(:pounds), Width: item.width.convert_to(:inches) } end end group_items(item_hashes) end |