Class: Google4R::Checkout::Unit

Inherits:
Object
  • Object
show all
Defined in:
lib/google4r/checkout/shared.rb

Overview

This is a base class for defining the unit of weight and dimension

Direct Known Subclasses

Dimension, Weight

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUnit

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

#unitObject

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

#valueObject

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