Class: FriendlyShipping::Services::UpsFreight::RatesItemOptions

Inherits:
ItemOptions
  • Object
show all
Defined in:
lib/friendly_shipping/services/ups_freight/rates_item_options.rb

Overview

Options for Items in a UPS Freight shipment.

Direct Known Subclasses

LabelItemOptions

Constant Summary collapse

PACKAGING_TYPES =

Maps friendly names to packaging types.

{
  bag: { code: "BAG", description: "Bag" },
  bale: { code: "BAL", description: "Bale" },
  barrel: { code: "BAR", description: "Barrel" },
  bundle: { code: "BDL", description: "Bundle" },
  bin: { code: "BIN", description: "Bin" },
  box: { code: "BOX", description: "Box" },
  basket: { code: "BSK", description: "Basket" },
  bunch: { code: "BUN", description: "Bunch" },
  cabinet: { code: "CAB", description: "Cabinet" },
  can: { code: "CAN", description: "Can" },
  carrier: { code: "CAR", description: "Carrier" },
  case: { code: "CAS", description: "Case" },
  carboy: { code: "CBY", description: "Carboy" },
  container: { code: "CON", description: "Container" },
  crate: { code: "CRT", description: "Crate" },
  cask: { code: "CSK", description: "Cask" },
  carton: { code: "CTN", description: "Carton" },
  cylinder: { code: "CYL", description: "Cylinder" },
  drum: { code: "DRM", description: "Drum" },
  loose: { code: "LOO", description: "Loose" },
  other: { code: "OTH", description: "Other" },
  pail: { code: "PAL", description: "Pail" },
  pieces: { code: "PCS", description: "Pieces" },
  package: { code: "PKG", description: "Package" },
  pipe_line: { code: "PLN", description: "Pipe Line" },
  pallet: { code: "PLT", description: "Pallet" },
  rack: { code: "RCK", description: "Rack" },
  reel: { code: "REL", description: "Reel" },
  roll: { code: "ROL", description: "Roll" },
  skid: { code: "SKD", description: "Skid" },
  spool: { code: "SPL", description: "Spool" },
  tube: { code: "TBE", description: "Tube" },
  tank: { code: "TNK", description: "Tank" },
  totes: { code: "TOT", description: "Totes" },
  unit: { code: "UNT", description: "Unit" },
  van_pack: { code: "VPK", description: "Van Pack" },
  wrapped: { code: "WRP", description: "Wrapped" }
}.freeze

Instance Attribute Summary collapse

Attributes inherited from ItemOptions

#item_id

Instance Method Summary collapse

Constructor Details

#initialize(packaging: :carton, freight_class: nil, nmfc_code: nil, **kwargs) ⇒ RatesItemOptions

Returns a new instance of RatesItemOptions.

Parameters:

  • packaging (Symbol) (defaults to: :carton)

    how the item is packaged (see PACKAGING_TYPES)

  • freight_class (String) (defaults to: nil)

    the freight class of this item, for example '55' or '92.5'

  • nmfc_code (String) (defaults to: nil)

    the national motor freight corporation code for this item, for example '13050 sub 4'

  • kwargs (Hash)


66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/friendly_shipping/services/ups_freight/rates_item_options.rb', line 66

def initialize(
  packaging: :carton,
  freight_class: nil,
  nmfc_code: nil,
  **kwargs
)
  @packaging_code = PACKAGING_TYPES.fetch(packaging).fetch(:code)
  @packaging_description = PACKAGING_TYPES.fetch(packaging).fetch(:description)
  @freight_class = freight_class
  @nmfc_code = nmfc_code
  super(**kwargs)
end

Instance Attribute Details

#freight_classString (readonly)

Returns:

  • (String)


56
57
58
# File 'lib/friendly_shipping/services/ups_freight/rates_item_options.rb', line 56

def freight_class
  @freight_class
end

#nmfc_codeString (readonly)

Returns:

  • (String)


59
60
61
# File 'lib/friendly_shipping/services/ups_freight/rates_item_options.rb', line 59

def nmfc_code
  @nmfc_code
end

#packaging_codeString (readonly)

Returns:

  • (String)


50
51
52
# File 'lib/friendly_shipping/services/ups_freight/rates_item_options.rb', line 50

def packaging_code
  @packaging_code
end

#packaging_descriptionString (readonly)

Returns:

  • (String)


53
54
55
# File 'lib/friendly_shipping/services/ups_freight/rates_item_options.rb', line 53

def packaging_description
  @packaging_description
end