Sha256: 3abd551ab8b9598b7b7785ecfaecbb96108ec72dbe192515360adc695721fb90
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
# frozen_string_literal: true module FriendlyShipping module Services class ShipEngineLTL class SerializeStructures class << self # @param structures [Array<Physical::Structure>] # @param options [FriendlyShipping::Services::ShipEngineLTL::QuoteOptions] # @return [Array<Hash>] def call(structures:, options:) structures.flat_map do |structure| structure_options = options.options_for_structure(structure) structure.packages.map do |package| package_options = structure_options.options_for_package(package) { code: package_options.packaging_code, freight_class: package_options.freight_class, nmfc_code: package_options.nmfc_code, description: package.description || "Commodities", dimensions: { width: package.width.convert_to(:inches).value.ceil, height: package.height.convert_to(:inches).value.ceil, length: package.length.convert_to(:inches).value.ceil, unit: "inches" }, weight: { value: package.weight.convert_to(:pounds).value.ceil, unit: "pounds" }, quantity: 1, # we don't support this yet stackable: package_options.stackable, hazardous_materials: package_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_structures.rb |