Sha256: 3c103c1f05f0b7fbd7121eb852a473b5278bc9c165963d2ed42f100c04080fc3

Contents?: true

Size: 1.7 KB

Versions: 20

Compression:

Stored size: 1.7 KB

Contents

# frozen_string_literal: true

require 'friendly_shipping/item_options'

module FriendlyShipping
  module Services
    class Ups
      class LabelItemOptions < FriendlyShipping::ItemOptions
        PRODUCT_UNIT_OF_MEASURE_CODES = {
          barrel: 'BA',
          bundle: 'BE',
          bag: 'BG',
          bunch: 'BH',
          box: 'BOX',
          bolt: 'BT',
          butt: 'BU',
          canister: 'CI',
          centimeter: 'CM',
          container: 'CON',
          crate: 'CR',
          case: 'CS',
          carton: 'CT',
          cylinder: 'CY',
          dozen: 'DOZ',
          each: 'EA',
          envelope: 'EN',
          feet: 'FT',
          kilogram: 'KG',
          kilograms: 'KGS',
          pound: 'LB',
          pounds: 'LBS',
          liter: 'L',
          meter: 'M',
          number: 'NMB',
          packet: 'PA',
          pallet: 'PAL',
          piece: 'PC',
          pieces: 'PCS',
          proof_liters: 'PF',
          package: 'PKG',
          pair: 'PR',
          pairs: 'PRS',
          roll: 'RL',
          set: 'SET',
          square_meters: 'SME',
          square_yards: 'SYD',
          tube: 'TU',
          yard: 'YD',
          other: 'OTH'
        }.freeze

        attr_reader :commodity_code

        def initialize(
          commodity_code: nil,
          product_unit_of_measure: :number,
          **kwargs
        )
          @commodity_code = commodity_code
          @product_unit_of_measure = product_unit_of_measure
          super(**kwargs)
        end

        def product_unit_of_measure_code
          PRODUCT_UNIT_OF_MEASURE_CODES[product_unit_of_measure]
        end

        private

        attr_reader :product_unit_of_measure
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
friendly_shipping-0.7.3 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.7.2 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.7.1 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.7.0 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.6.5 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.6.4 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.6.3 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.6.2 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.6.1 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.6.0 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.5.3 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.5.2 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.5.1 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.5 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.4.14 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.4.13 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.4.12 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.4.11 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.4.10 lib/friendly_shipping/services/ups/label_item_options.rb
friendly_shipping-0.4.9 lib/friendly_shipping/services/ups/label_item_options.rb