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.
895 896 897 |
# File 'lib/google4r/checkout/shared.rb', line 895 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.
889 890 891 |
# File 'lib/google4r/checkout/shared.rb', line 889 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)
893 894 895 |
# File 'lib/google4r/checkout/shared.rb', line 893 def value @value end |
Class Method Details
.create_from_element(element) ⇒ Object
Creates a new Unit from the given REXML::Element instance.
900 901 902 903 |
# File 'lib/google4r/checkout/shared.rb', line 900 def self.create_from_element(element) result = self.new(element.attributes['value'].to_f) return result end |