Class: FriendlyShipping::Services::TForceFreight::ItemOptions
- Inherits:
-
ItemOptions
- Object
- ItemOptions
- FriendlyShipping::Services::TForceFreight::ItemOptions
- Defined in:
- lib/friendly_shipping/services/tforce_freight/item_options.rb
Overview
Options for items in a shipment.
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
-
#freight_class ⇒ String
readonly
The freight class.
-
#hazardous ⇒ Boolean
readonly
Whether or not the item is hazardous.
-
#nmfc_primary_code ⇒ String
readonly
The NMFC primary code.
-
#nmfc_sub_code ⇒ String
readonly
The NMFC sub code.
-
#packaging_code ⇒ Symbol
readonly
The code for this item's packaging.
-
#packaging_description ⇒ String
readonly
The description for this item's packaging.
Attributes inherited from ItemOptions
Instance Method Summary collapse
-
#initialize(packaging: :carton, freight_class: nil, nmfc_primary_code: nil, nmfc_sub_code: nil, hazardous: false, **kwargs) ⇒ ItemOptions
constructor
A new instance of ItemOptions.
Constructor Details
#initialize(packaging: :carton, freight_class: nil, nmfc_primary_code: nil, nmfc_sub_code: nil, hazardous: false, **kwargs) ⇒ ItemOptions
Returns a new instance of ItemOptions.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/friendly_shipping/services/tforce_freight/item_options.rb', line 74 def initialize( packaging: :carton, freight_class: nil, nmfc_primary_code: nil, nmfc_sub_code: nil, hazardous: false, **kwargs ) @packaging_code = PACKAGING_TYPES.fetch(packaging).fetch(:code) @packaging_description = PACKAGING_TYPES.fetch(packaging).fetch(:description) @freight_class = freight_class @nmfc_primary_code = nmfc_primary_code @nmfc_sub_code = nmfc_sub_code @hazardous = hazardous super(**kwargs) end |
Instance Attribute Details
#freight_class ⇒ String (readonly)
Returns the freight class.
56 57 58 |
# File 'lib/friendly_shipping/services/tforce_freight/item_options.rb', line 56 def freight_class @freight_class end |
#hazardous ⇒ Boolean (readonly)
Returns whether or not the item is hazardous.
65 66 67 |
# File 'lib/friendly_shipping/services/tforce_freight/item_options.rb', line 65 def hazardous @hazardous end |
#nmfc_primary_code ⇒ String (readonly)
Returns the NMFC primary code.
59 60 61 |
# File 'lib/friendly_shipping/services/tforce_freight/item_options.rb', line 59 def nmfc_primary_code @nmfc_primary_code end |
#nmfc_sub_code ⇒ String (readonly)
Returns the NMFC sub code.
62 63 64 |
# File 'lib/friendly_shipping/services/tforce_freight/item_options.rb', line 62 def nmfc_sub_code @nmfc_sub_code end |
#packaging_code ⇒ Symbol (readonly)
Returns the code for this item's packaging.
50 51 52 |
# File 'lib/friendly_shipping/services/tforce_freight/item_options.rb', line 50 def packaging_code @packaging_code end |
#packaging_description ⇒ String (readonly)
Returns the description for this item's packaging.
53 54 55 |
# File 'lib/friendly_shipping/services/tforce_freight/item_options.rb', line 53 def packaging_description @packaging_description end |