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.
16780 16781 16782 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16780 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
16778 16779 16780 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16778 def value @value end |
Class Method Details
.ALL ⇒ Object
16800 16801 16802 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16800 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
16785 16786 16787 16788 16789 16790 16791 16792 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16785 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
16808 16809 16810 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16808 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
16795 16796 16797 16798 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16795 def LevyStrategy.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) LevyStrategy.ALL.find { |v| v.value == value } end |
.maximum ⇒ Object
16812 16813 16814 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16812 def LevyStrategy.maximum @@_maximum ||= LevyStrategy.new('maximum') end |
.minimum ⇒ Object
16804 16805 16806 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16804 def LevyStrategy.minimum @@_minimum ||= LevyStrategy.new('minimum') end |
Instance Method Details
#to_hash ⇒ Object
16816 16817 16818 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16816 def to_hash value end |