Class: Dina::Shipment
- Inherits:
-
Object
- Object
- Dina::Shipment
- Defined in:
- lib/dina/components/shipment.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
with properties receiverName, companyName, addressLine1, addressLine2, city, provinceState, zipCode, country.
-
#contentRemarks ⇒ Object
Returns the value of attribute contentRemarks.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#itemCount ⇒ Object
Returns the value of attribute itemCount.
-
#packingMethod ⇒ Object
Returns the value of attribute packingMethod.
-
#shipmentRemarks ⇒ Object
Returns the value of attribute shipmentRemarks.
-
#shippedOn ⇒ Object
Returns the value of attribute shippedOn.
-
#status ⇒ Object
Returns the value of attribute status.
-
#trackingNumber ⇒ Object
Returns the value of attribute trackingNumber.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #add_address(address:) ⇒ Object
-
#initialize ⇒ Shipment
constructor
A new instance of Shipment.
- #to_hash ⇒ Object
Constructor Details
#initialize ⇒ Shipment
Returns a new instance of Shipment.
14 15 16 |
# File 'lib/dina/components/shipment.rb', line 14 def initialize @address = {} end |
Instance Attribute Details
#address ⇒ Object
with properties receiverName, companyName, addressLine1, addressLine2, city, provinceState, zipCode, country
12 13 14 |
# File 'lib/dina/components/shipment.rb', line 12 def address @address end |
#contentRemarks ⇒ Object
Returns the value of attribute contentRemarks.
3 4 5 |
# File 'lib/dina/components/shipment.rb', line 3 def contentRemarks @contentRemarks end |
#currency ⇒ Object
Returns the value of attribute currency.
5 6 7 |
# File 'lib/dina/components/shipment.rb', line 5 def currency @currency end |
#itemCount ⇒ Object
Returns the value of attribute itemCount.
6 7 8 |
# File 'lib/dina/components/shipment.rb', line 6 def itemCount @itemCount end |
#packingMethod ⇒ Object
Returns the value of attribute packingMethod.
9 10 11 |
# File 'lib/dina/components/shipment.rb', line 9 def packingMethod @packingMethod end |
#shipmentRemarks ⇒ Object
Returns the value of attribute shipmentRemarks.
11 12 13 |
# File 'lib/dina/components/shipment.rb', line 11 def shipmentRemarks @shipmentRemarks end |
#shippedOn ⇒ Object
Returns the value of attribute shippedOn.
7 8 9 |
# File 'lib/dina/components/shipment.rb', line 7 def shippedOn @shippedOn end |
#status ⇒ Object
Returns the value of attribute status.
8 9 10 |
# File 'lib/dina/components/shipment.rb', line 8 def status @status end |
#trackingNumber ⇒ Object
Returns the value of attribute trackingNumber.
10 11 12 |
# File 'lib/dina/components/shipment.rb', line 10 def trackingNumber @trackingNumber end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/dina/components/shipment.rb', line 4 def value @value end |
Instance Method Details
#add_address(address:) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/dina/components/shipment.rb', line 18 def add_address(address:) if !address.instance_of?(Address) raise PropertyValueInvalid, "Address must be of type Address." end @address.merge!(address.to_hash) end |
#to_hash ⇒ Object
25 26 27 28 29 |
# File 'lib/dina/components/shipment.rb', line 25 def to_hash hash = {} instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) } hash.deep_symbolize_keys end |