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
7803 7804 7805 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7803 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
7801 7802 7803 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7801 def value @value end |
Class Method Details
.ALL ⇒ Object
7823 7824 7825 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7823 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
7808 7809 7810 7811 7812 7813 7814 7815 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7808 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
7831 7832 7833 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7831 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
7818 7819 7820 7821 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7818 def LevyStrategy.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) LevyStrategy.ALL.find { |v| v.value == value } end |
.maximum ⇒ Object
7835 7836 7837 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7835 def LevyStrategy.maximum @@_maximum ||= LevyStrategy.new('maximum') end |
.minimum ⇒ Object
7827 7828 7829 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7827 def LevyStrategy.minimum @@_minimum ||= LevyStrategy.new('minimum') end |
Instance Method Details
#to_hash ⇒ Object
7839 7840 7841 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7839 def to_hash value end |