Class: Io::Flow::V0::Models::MeasurementSystem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::MeasurementSystem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
- .ALL ⇒ Object
-
.apply(value) ⇒ Object
Returns the instance of MeasurementSystem for this value, creating a new instance for an unknown value.
-
.from_string(value) ⇒ Object
Returns the instance of MeasurementSystem for this value, or nil if not found.
- .imperial ⇒ Object
- .metric ⇒ Object
Instance Method Summary collapse
-
#initialize(value) ⇒ MeasurementSystem
constructor
A new instance of MeasurementSystem.
- #to_hash ⇒ Object
Constructor Details
#initialize(value) ⇒ MeasurementSystem
Returns a new instance of MeasurementSystem.
12980 12981 12982 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12980 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
12978 12979 12980 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12978 def value @value end |
Class Method Details
.ALL ⇒ Object
13000 13001 13002 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13000 def MeasurementSystem.ALL @@all ||= [MeasurementSystem.imperial, MeasurementSystem.metric] end |
.apply(value) ⇒ Object
Returns the instance of MeasurementSystem for this value, creating a new instance for an unknown value
12985 12986 12987 12988 12989 12990 12991 12992 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12985 def MeasurementSystem.apply(value) if value.instance_of?(MeasurementSystem) value else HttpClient::Preconditions.assert_class_or_nil('value', value, String) value.nil? ? nil : (from_string(value) || MeasurementSystem.new(value)) end end |
.from_string(value) ⇒ Object
Returns the instance of MeasurementSystem for this value, or nil if not found
12995 12996 12997 12998 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12995 def MeasurementSystem.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) MeasurementSystem.ALL.find { |v| v.value == value } end |
.imperial ⇒ Object
13004 13005 13006 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13004 def MeasurementSystem.imperial @@_imperial ||= MeasurementSystem.new('imperial') end |
.metric ⇒ Object
13008 13009 13010 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13008 def MeasurementSystem.metric @@_metric ||= MeasurementSystem.new('metric') end |
Instance Method Details
#to_hash ⇒ Object
13012 13013 13014 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13012 def to_hash value end |