Class: Dhl::Intraship::ShipmentItem
- Inherits:
-
Object
- Object
- Dhl::Intraship::ShipmentItem
- Defined in:
- lib/dhl-intraship/shipment_item.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#length ⇒ Object
Returns the value of attribute length.
- #package_type ⇒ Object
-
#weight ⇒ Object
Returns the value of attribute weight.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
- #append_to_xml(xml) ⇒ Object
-
#initialize(attributes = {}) ⇒ ShipmentItem
constructor
A new instance of ShipmentItem.
Constructor Details
#initialize(attributes = {}) ⇒ ShipmentItem
Returns a new instance of ShipmentItem.
11 12 13 14 15 16 17 18 |
# File 'lib/dhl-intraship/shipment_item.rb', line 11 def initialize(attributes = {}) attributes.each do |key, value| setter = :"#{key.to_s}=" if self.respond_to?(setter) self.send(setter, value) end end end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
5 6 7 |
# File 'lib/dhl-intraship/shipment_item.rb', line 5 def height @height end |
#length ⇒ Object
Returns the value of attribute length.
5 6 7 |
# File 'lib/dhl-intraship/shipment_item.rb', line 5 def length @length end |
#package_type ⇒ Object
7 8 9 |
# File 'lib/dhl-intraship/shipment_item.rb', line 7 def package_type @package_type || 'PK' end |
#weight ⇒ Object
Returns the value of attribute weight.
5 6 7 |
# File 'lib/dhl-intraship/shipment_item.rb', line 5 def weight @weight end |
#width ⇒ Object
Returns the value of attribute width.
5 6 7 |
# File 'lib/dhl-intraship/shipment_item.rb', line 5 def width @width end |
Instance Method Details
#append_to_xml(xml) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/dhl-intraship/shipment_item.rb', line 20 def append_to_xml(xml) xml.ShipmentItem do |xml| xml.WeightInKG(weight) xml.LengthInCM(length) unless length.nil? xml.WidthInCM(width) unless width.nil? xml.HeightInCM(height) unless height.nil? xml.PackageType(package_type) end end |