lib/physical/shipment.rb in physical-0.4.9 vs lib/physical/shipment.rb in physical-0.5.0

- old
+ new

@@ -5,19 +5,25 @@ attr_reader :id, :origin, :destination, :service_code, :pallets, + :structures, :packages, :options - def initialize(id: nil, origin: nil, destination: nil, service_code: nil, pallets: [], packages: [], options: {}) + 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 - @pallets = pallets + @structures = structures @packages = packages @options = options + + return unless pallets.any? + + warn "[DEPRECATION] `pallets` is deprecated. Please use `structures` instead." + @pallets = pallets end end end