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.
1088 1089 1090 |
# File 'lib/google4r/checkout/shared.rb', line 1088 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.
1082 1083 1084 |
# File 'lib/google4r/checkout/shared.rb', line 1082 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)
1086 1087 1088 |
# File 'lib/google4r/checkout/shared.rb', line 1086 def value @value end |
Class Method Details
.create_from_element(element) ⇒ Object
Creates a new Unit from the given REXML::Element instance.
1093 1094 1095 1096 |
# File 'lib/google4r/checkout/shared.rb', line 1093 def self.create_from_element(element) result = self.new(element.attributes['value'].to_f) return result end |