Sha256: 0977da6b76f39c9ce46049dd73ce7c498928ff6f6a00d34ca4ca6c3aae93efb0
Contents?: true
Size: 1.06 KB
Versions: 31
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module FriendlyShipping module Services class UpsFreight class GenerateCommodityInformation def self.call(shipment:, options:) shipment.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) { # This is a required field Description: item.description || 'Commodities', Weight: { UnitOfMeasurement: { Code: 'LBS' # Only Pounds are supported }, Value: item.weight.convert_to(:pounds).value.to_f.round(2).to_s }, NumberOfPieces: '1', # We won't support this yet. PackagingType: { Code: item_options.packaging_code }, FreightClass: item_options.freight_class } end end end end end end end
Version data entries
31 entries across 31 versions & 1 rubygems