Sha256: bebebca000945e1c2435ea49c84b85713a3cc06c9f7c409084a8da5958f0ce07
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
# frozen_string_literal: true module FriendlyShipping module Services class ShipEngineLTL class SerializePackages class << self # @param [Array<Physical::Package>] packages # @param [FriendlyShipping::Services::ShipEngineLTL::QuoteOptions] options def call(packages:, options:) packages.flat_map do |package| package_options = options.options_for_package(package) package.items.map do |item| item_options = package_options.options_for_item(item) { code: item_options.packaging_code, freight_class: item_options.freight_class, nmfc_code: item_options.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: item_options.stackable, hazardous_materials: item_options.hazardous_materials } end end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
friendly_shipping-0.8.1 | lib/friendly_shipping/services/ship_engine_ltl/serialize_packages.rb |