Class: ShippingScale::Package
- Defined in:
- lib/shipping_scale/packaging/package.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#ounces ⇒ Object
readonly
Returns the value of attribute ounces.
-
#pounds ⇒ Object
readonly
Returns the value of attribute pounds.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
-
#zip_origination ⇒ Object
readonly
Returns the value of attribute zip_origination.
Attributes inherited from Packaging
Class Method Summary collapse
Instance Method Summary collapse
- #build_xml(package) ⇒ Object
-
#initialize(**options) ⇒ Package
constructor
A new instance of Package.
Methods inherited from Packaging
Constructor Details
#initialize(**options) ⇒ Package
Returns a new instance of Package.
22 23 24 25 26 27 28 29 30 |
# File 'lib/shipping_scale/packaging/package.rb', line 22 def initialize(**) @weight = [:weight] @pounds = ([:pounds]) ? [:pounds] : get_pounds @ounces = ([:ounces]) ? [:ounces] : get_ounces @zip_origination = ([:zip_origination]) ? [:zip_origination] : ShippingScale.config.zip_origination @zip_destination = ([:zip_destination]) ? [:zip_destination] : ShippingScale.config.zip_destination @packages = [self] end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
11 12 13 |
# File 'lib/shipping_scale/packaging/package.rb', line 11 def height @height end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
11 12 13 |
# File 'lib/shipping_scale/packaging/package.rb', line 11 def length @length end |
#ounces ⇒ Object (readonly)
Returns the value of attribute ounces.
11 12 13 |
# File 'lib/shipping_scale/packaging/package.rb', line 11 def ounces @ounces end |
#pounds ⇒ Object (readonly)
Returns the value of attribute pounds.
11 12 13 |
# File 'lib/shipping_scale/packaging/package.rb', line 11 def pounds @pounds end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
11 12 13 |
# File 'lib/shipping_scale/packaging/package.rb', line 11 def weight @weight end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
11 12 13 |
# File 'lib/shipping_scale/packaging/package.rb', line 11 def width @width end |
#zip_origination ⇒ Object (readonly)
Returns the value of attribute zip_origination.
11 12 13 |
# File 'lib/shipping_scale/packaging/package.rb', line 11 def zip_origination @zip_origination end |
Class Method Details
.shipment(details) ⇒ Object
5 6 7 8 |
# File 'lib/shipping_scale/packaging/package.rb', line 5 def shipment(details) packages = details.map { |package| new(package) } ShippingScale::Shipment.new(packages) end |
Instance Method Details
#build_xml(package) ⇒ Object
32 33 34 35 36 |
# File 'lib/shipping_scale/packaging/package.rb', line 32 def build_xml(package) attrs.each do |k, v| package.tag!(k.to_s.upper_camelcase, v) end end |