class Io::Flow::V0::Models::UnitOfMeasurement
Attributes
value[R]
Public Class Methods
ALL()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 28110 def UnitOfMeasurement.ALL @@all ||= [UnitOfMeasurement.millimeter, UnitOfMeasurement.centimeter, UnitOfMeasurement.inch, UnitOfMeasurement.foot, UnitOfMeasurement.cubic_inch, UnitOfMeasurement.cubic_meter, UnitOfMeasurement.gram, UnitOfMeasurement.kilogram, UnitOfMeasurement.meter, UnitOfMeasurement.ounce, UnitOfMeasurement.pound] end
apply(value)
click to toggle source
Returns the instance of UnitOfMeasurement
for this value, creating a new instance for an unknown value
# File lib/flow_commerce/flow_api_v0_client.rb, line 28095 def UnitOfMeasurement.apply(value) if value.instance_of?(UnitOfMeasurement) value else HttpClient::Preconditions.assert_class_or_nil('value', value, String) value.nil? ? nil : (from_string(value) || UnitOfMeasurement.new(value)) end end
centimeter()
click to toggle source
Equivalent to CENTI(METRE).
# File lib/flow_commerce/flow_api_v0_client.rb, line 28120 def UnitOfMeasurement.centimeter @@_centimeter ||= UnitOfMeasurement.new('centimeter') end
cubic_inch()
click to toggle source
A unit of volume equal to one cubic inch (in³).
# File lib/flow_commerce/flow_api_v0_client.rb, line 28135 def UnitOfMeasurement.cubic_inch @@_cubic_inch ||= UnitOfMeasurement.new('cubic_inch') end
cubic_meter()
click to toggle source
The metric unit for volume quantities (m³).
# File lib/flow_commerce/flow_api_v0_client.rb, line 28140 def UnitOfMeasurement.cubic_meter @@_cubic_meter ||= UnitOfMeasurement.new('cubic_meter') end
foot()
click to toggle source
A unit of length equal to 0.3048 m (standard name ft).
# File lib/flow_commerce/flow_api_v0_client.rb, line 28130 def UnitOfMeasurement.foot @@_foot ||= UnitOfMeasurement.new('foot') end
from_string(value)
click to toggle source
Returns the instance of UnitOfMeasurement
for this value, or nil if not found
# File lib/flow_commerce/flow_api_v0_client.rb, line 28105 def UnitOfMeasurement.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) UnitOfMeasurement.ALL.find { |v| v.value == value } end
gram()
click to toggle source
A unit of mass equal to 1 / 1000 kilogram (standard name g).
# File lib/flow_commerce/flow_api_v0_client.rb, line 28145 def UnitOfMeasurement.gram @@_gram ||= UnitOfMeasurement.new('gram') end
inch()
click to toggle source
A unit of length equal to 0.0254 m (standard name in).
# File lib/flow_commerce/flow_api_v0_client.rb, line 28125 def UnitOfMeasurement.inch @@_inch ||= UnitOfMeasurement.new('inch') end
kilogram()
click to toggle source
The base unit for mass quantities (kg).
# File lib/flow_commerce/flow_api_v0_client.rb, line 28150 def UnitOfMeasurement.kilogram @@_kilogram ||= UnitOfMeasurement.new('kilogram') end
meter()
click to toggle source
The base unit for length quantities (m).
# File lib/flow_commerce/flow_api_v0_client.rb, line 28155 def UnitOfMeasurement.meter @@_meter ||= UnitOfMeasurement.new('meter') end
millimeter()
click to toggle source
Equivalent to MILLI(METRE).
# File lib/flow_commerce/flow_api_v0_client.rb, line 28115 def UnitOfMeasurement.millimeter @@_millimeter ||= UnitOfMeasurement.new('millimeter') end
new(value)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 28090 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end
ounce()
click to toggle source
A unit of mass equal to 1 / 16 POUND (standard name oz).
# File lib/flow_commerce/flow_api_v0_client.rb, line 28160 def UnitOfMeasurement.ounce @@_ounce ||= UnitOfMeasurement.new('ounce') end
pound()
click to toggle source
A unit of mass equal to 453.59237 grams (avoirdupois pound, standard name lb).
# File lib/flow_commerce/flow_api_v0_client.rb, line 28165 def UnitOfMeasurement.pound @@_pound ||= UnitOfMeasurement.new('pound') end
Public Instance Methods
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 28169 def to_hash value end