Class: Google4R::Checkout::Unit
- Inherits:
-
Object
- Object
- Google4R::Checkout::Unit
- Defined in:
- lib/google4r/checkout/shared.rb
Overview
This is a base class for defining the unit of weight and dimension
Instance Attribute Summary collapse
-
#unit ⇒ Object
This specifies the unit of measurement that corresponds to a shipping package’s length, width or height.
-
#value ⇒ Object
This specifies the numeric value of a unit of measurement corresponding to an item or a shipping package.
Class Method Summary collapse
-
.create_from_element(element) ⇒ Object
Creates a new Unit from the given REXML::Element instance.
Instance Method Summary collapse
-
#initialize ⇒ Unit
constructor
A new instance of Unit.
Constructor Details
#initialize ⇒ Unit
Returns a new instance of Unit.
1108 1109 1110 |
# File 'lib/google4r/checkout/shared.rb', line 1108 def initialize raise "Google::Checkout::Unit is an abstract class!" end |
Instance Attribute Details
#unit ⇒ Object
This specifies the unit of measurement that corresponds to a shipping package’s length, width or height. The only valid value for this attribute is IN.
1102 1103 1104 |
# File 'lib/google4r/checkout/shared.rb', line 1102 def unit @unit end |
#value ⇒ Object
This specifies the numeric value of a unit of measurement corresponding to an item or a shipping package. (float)
1106 1107 1108 |
# File 'lib/google4r/checkout/shared.rb', line 1106 def value @value end |
Class Method Details
.create_from_element(element) ⇒ Object
Creates a new Unit from the given REXML::Element instance.
1113 1114 1115 1116 |
# File 'lib/google4r/checkout/shared.rb', line 1113 def self.create_from_element(element) result = self.new(BigDecimal.new(element.attributes['value'].to_s)) return result end |