Class: FriendlyShipping::Services::Ups::LabelItemOptions

Inherits:
ItemOptions
  • Object
show all
Defined in:
lib/friendly_shipping/services/ups/label_item_options.rb

Constant Summary collapse

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

Instance Attribute Summary collapse

Attributes inherited from ItemOptions

#item_id

Instance Method Summary collapse

Constructor Details

#initialize(commodity_code: nil, country_of_origin: nil, product_unit_of_measure: :number, **kwargs) ⇒ LabelItemOptions

Returns a new instance of LabelItemOptions.



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/friendly_shipping/services/ups/label_item_options.rb', line 55

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

Instance Attribute Details

#commodity_codeObject (readonly)

Returns the value of attribute commodity_code.



52
53
54
# File 'lib/friendly_shipping/services/ups/label_item_options.rb', line 52

def commodity_code
  @commodity_code
end

#country_of_originObject (readonly)

Returns the value of attribute country_of_origin.



52
53
54
# File 'lib/friendly_shipping/services/ups/label_item_options.rb', line 52

def country_of_origin
  @country_of_origin
end

Instance Method Details

#product_unit_of_measure_codeObject



67
68
69
# File 'lib/friendly_shipping/services/ups/label_item_options.rb', line 67

def product_unit_of_measure_code
  PRODUCT_UNIT_OF_MEASURE_CODES[product_unit_of_measure]
end