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.
17951 17952 17953 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17951 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
17949 17950 17951 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17949 def value @value end |
Class Method Details
.ALL ⇒ Object
17971 17972 17973 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17971 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
17956 17957 17958 17959 17960 17961 17962 17963 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17956 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
17966 17967 17968 17969 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17966 def MeasurementSystem.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) MeasurementSystem.ALL.find { |v| v.value == value } end |
.imperial ⇒ Object
17975 17976 17977 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17975 def MeasurementSystem.imperial @@_imperial ||= MeasurementSystem.new('imperial') end |
.metric ⇒ Object
17979 17980 17981 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17979 def MeasurementSystem.metric @@_metric ||= MeasurementSystem.new('metric') end |
Instance Method Details
#to_hash ⇒ Object
17983 17984 17985 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17983 def to_hash value end |