Class: Physical::Shipment

Inherits:
Object
  • Object
show all
Defined in:
lib/physical/shipment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, origin: nil, destination: nil, service_code: nil, pallets: [], structures: [], packages: [], options: {}) ⇒ Shipment

Returns a new instance of Shipment.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/physical/shipment.rb', line 14

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 = options

  return unless pallets.any?

  warn "[DEPRECATION] `pallets` is deprecated.  Please use `structures` instead."
  @pallets = pallets
end

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination.



5
6
7
# File 'lib/physical/shipment.rb', line 5

def destination
  @destination
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/physical/shipment.rb', line 5

def id
  @id
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/physical/shipment.rb', line 5

def options
  @options
end

#originObject (readonly)

Returns the value of attribute origin.



5
6
7
# File 'lib/physical/shipment.rb', line 5

def origin
  @origin
end

#packagesObject (readonly)

Returns the value of attribute packages.



5
6
7
# File 'lib/physical/shipment.rb', line 5

def packages
  @packages
end

#palletsObject (readonly)

Returns the value of attribute pallets.



5
6
7
# File 'lib/physical/shipment.rb', line 5

def pallets
  @pallets
end

#service_codeObject (readonly)

Returns the value of attribute service_code.



5
6
7
# File 'lib/physical/shipment.rb', line 5

def service_code
  @service_code
end

#structuresObject (readonly)

Returns the value of attribute structures.



5
6
7
# File 'lib/physical/shipment.rb', line 5

def structures
  @structures
end