Class: Physical::Shipment
- Inherits:
-
Object
- Object
- Physical::Shipment
- Defined in:
- lib/physical/shipment.rb
Overview
Represents a physical shipment containing structures and/or packages.
Instance Attribute Summary collapse
-
#destination ⇒ Physical::Location
readonly
This shipment's destination location.
-
#id ⇒ String
readonly
A unique identifier for this shipment.
-
#options ⇒ Hash
readonly
Additional custom options for this shipment.
-
#origin ⇒ Physical::Location
readonly
This shipment's origin location.
-
#packages ⇒ Array<Physical::Package>
readonly
This shipment's packages which hold items.
-
#pallets ⇒ Array<Physical::Pallet>
readonly
This shipment's pallets (DEPRECATED: use #structures instead).
-
#service_code ⇒ String
readonly
The shipment carrier's service code.
-
#structures ⇒ Array<Physical::Structure>
readonly
This shipment's structures (pallets, skids, etc.) which hold packages.
Instance Method Summary collapse
-
#initialize(id: nil, origin: nil, destination: nil, service_code: nil, pallets: [], structures: [], packages: [], options: {}) ⇒ Shipment
constructor
A new instance of Shipment.
Constructor Details
#initialize(id: nil, origin: nil, destination: nil, service_code: nil, pallets: [], structures: [], packages: [], options: {}) ⇒ Shipment
Returns a new instance of Shipment.
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/physical/shipment.rb', line 46 def initialize(id: nil, origin: nil, destination: nil, service_code: nil, pallets: [], structures: [], packages: [], options: {}) @id = id || SecureRandom.uuid @origin = origin @destination = destination @service_code = service_code @structures = structures @packages = packages @options = @pallets = pallets warn "[DEPRECATION] `pallets` is deprecated. Please use `structures` instead." if pallets.any? end |
Instance Attribute Details
#destination ⇒ Physical::Location (readonly)
This shipment's destination location
16 17 18 |
# File 'lib/physical/shipment.rb', line 16 def destination @destination end |
#id ⇒ String (readonly)
A unique identifier for this shipment
8 9 10 |
# File 'lib/physical/shipment.rb', line 8 def id @id end |
#options ⇒ Hash (readonly)
Additional custom options for this shipment
36 37 38 |
# File 'lib/physical/shipment.rb', line 36 def @options end |
#origin ⇒ Physical::Location (readonly)
This shipment's origin location
12 13 14 |
# File 'lib/physical/shipment.rb', line 12 def origin @origin end |
#packages ⇒ Array<Physical::Package> (readonly)
This shipment's packages which hold items
32 33 34 |
# File 'lib/physical/shipment.rb', line 32 def packages @packages end |
#pallets ⇒ Array<Physical::Pallet> (readonly)
This shipment's pallets (DEPRECATED: use #structures instead)
24 25 26 |
# File 'lib/physical/shipment.rb', line 24 def pallets @pallets end |
#service_code ⇒ String (readonly)
The shipment carrier's service code
20 21 22 |
# File 'lib/physical/shipment.rb', line 20 def service_code @service_code end |
#structures ⇒ Array<Physical::Structure> (readonly)
This shipment's structures (pallets, skids, etc.) which hold packages
28 29 30 |
# File 'lib/physical/shipment.rb', line 28 def structures @structures end |