Sha256: 353058e4b67bdf0667b25bd4ede175c75945a43cb8b75234e44ab39643b32793
Contents?: true
Size: 1.73 KB
Versions: 1
Compression:
Stored size: 1.73 KB
Contents
# frozen_string_literal: true module FriendlyShipping module Services class ShipEngineLTL # Serializes packages for the rate quote API request. # @deprecated Use {SerializeStructures} instead. class SerializePackages class << self # @param packages [Array<Physical::Package>] # @param options [QuoteOptions] # @return [Array<Hash>] def call(packages:, options:) warn "[DEPRECATION] `SerializePackages` is deprecated. Please use `SerializeStructures` instead." 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.9.0 | lib/friendly_shipping/services/ship_engine_ltl/serialize_packages.rb |