Class: FriendlyShipping::Services::UpsFreight::RatesStructureOptions

Inherits:
FriendlyShipping::StructureOptions show all
Defined in:
lib/friendly_shipping/services/ups_freight/rates_structure_options.rb

Overview

Options for structures/pallets within a UPS Freight shipment.

Direct Known Subclasses

LabelStructureOptions

Constant Summary collapse

HANDLING_UNIT_TYPES =

Maps friendly names to handling unit types.

{
  pallet: { code: "PLT", description: "Pallet", handling_unit_tag: 'One' },
  skid: { code: "SKD", description: "Skid", handling_unit_tag: 'One' },
  carboy: { code: "CBY", description: "Carboy", handling_unit_tag: 'One' },
  totes: { code: "TOT", description: "Totes", handling_unit_tag: 'One' },
  other: { code: "OTH", description: "Other", handling_unit_tag: 'Two' },
  loose: { code: "LOO", description: "Loose", handling_unit_tag: 'Two' }
}.freeze

Instance Attribute Summary collapse

Attributes inherited from FriendlyShipping::StructureOptions

#structure_id

Instance Method Summary collapse

Methods inherited from FriendlyShipping::StructureOptions

#options_for_package

Constructor Details

#initialize(handling_unit: :pallet, **kwargs) ⇒ RatesStructureOptions

Returns a new instance of RatesStructureOptions.

Parameters:

  • handling_unit (Symbol) (defaults to: :pallet)

    how this shipment is divided (see HANDLING_UNIT_TYPES)

  • kwargs (Hash)


32
33
34
35
36
37
38
39
40
# File 'lib/friendly_shipping/services/ups_freight/rates_structure_options.rb', line 32

def initialize(
  handling_unit: :pallet,
  **kwargs
)
  @handling_unit_code = HANDLING_UNIT_TYPES.fetch(handling_unit).fetch(:code)
  @handling_unit_description = HANDLING_UNIT_TYPES.fetch(handling_unit).fetch(:description)
  @handling_unit_tag = "HandlingUnit#{HANDLING_UNIT_TYPES.fetch(handling_unit).fetch(:handling_unit_tag)}"
  super(**kwargs.reverse_merge(package_options_class: RatesPackageOptions))
end

Instance Attribute Details

#handling_unit_codeString (readonly)

Returns:

  • (String)


25
26
27
# File 'lib/friendly_shipping/services/ups_freight/rates_structure_options.rb', line 25

def handling_unit_code
  @handling_unit_code
end

#handling_unit_descriptionString (readonly)

Returns:

  • (String)


19
20
21
# File 'lib/friendly_shipping/services/ups_freight/rates_structure_options.rb', line 19

def handling_unit_description
  @handling_unit_description
end

#handling_unit_tagString (readonly)

Returns:

  • (String)


22
23
24
# File 'lib/friendly_shipping/services/ups_freight/rates_structure_options.rb', line 22

def handling_unit_tag
  @handling_unit_tag
end