Class: Io::Flow::V0::Models::LevyStrategy
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::LevyStrategy
- 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 LevyStrategy for this value, creating a new instance for an unknown value.
- .average ⇒ Object
-
.from_string(value) ⇒ Object
Returns the instance of LevyStrategy for this value, or nil if not found.
- .maximum ⇒ Object
- .minimum ⇒ Object
Instance Method Summary collapse
-
#initialize(value) ⇒ LevyStrategy
constructor
A new instance of LevyStrategy.
- #to_hash ⇒ Object
Constructor Details
#initialize(value) ⇒ LevyStrategy
Returns a new instance of LevyStrategy.
13841 13842 13843 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13841 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
13839 13840 13841 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13839 def value @value end |
Class Method Details
.ALL ⇒ Object
13861 13862 13863 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13861 def LevyStrategy.ALL @@all ||= [LevyStrategy.minimum, LevyStrategy.average, LevyStrategy.maximum] end |
.apply(value) ⇒ Object
Returns the instance of LevyStrategy for this value, creating a new instance for an unknown value
13846 13847 13848 13849 13850 13851 13852 13853 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13846 def LevyStrategy.apply(value) if value.instance_of?(LevyStrategy) value else HttpClient::Preconditions.assert_class_or_nil('value', value, String) value.nil? ? nil : (from_string(value) || LevyStrategy.new(value)) end end |
.average ⇒ Object
13869 13870 13871 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13869 def LevyStrategy.average @@_average ||= LevyStrategy.new('average') end |
.from_string(value) ⇒ Object
Returns the instance of LevyStrategy for this value, or nil if not found
13856 13857 13858 13859 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13856 def LevyStrategy.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) LevyStrategy.ALL.find { |v| v.value == value } end |
.maximum ⇒ Object
13873 13874 13875 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13873 def LevyStrategy.maximum @@_maximum ||= LevyStrategy.new('maximum') end |
.minimum ⇒ Object
13865 13866 13867 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13865 def LevyStrategy.minimum @@_minimum ||= LevyStrategy.new('minimum') end |
Instance Method Details
#to_hash ⇒ Object
13877 13878 13879 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13877 def to_hash value end |