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.
11103 11104 11105 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11103 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
11101 11102 11103 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11101 def value @value end |
Class Method Details
.ALL ⇒ Object
11123 11124 11125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11123 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
11108 11109 11110 11111 11112 11113 11114 11115 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11108 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
11131 11132 11133 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11131 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
11118 11119 11120 11121 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11118 def LevyStrategy.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) LevyStrategy.ALL.find { |v| v.value == value } end |
.maximum ⇒ Object
11135 11136 11137 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11135 def LevyStrategy.maximum @@_maximum ||= LevyStrategy.new('maximum') end |
.minimum ⇒ Object
11127 11128 11129 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11127 def LevyStrategy.minimum @@_minimum ||= LevyStrategy.new('minimum') end |
Instance Method Details
#to_hash ⇒ Object
11139 11140 11141 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11139 def to_hash value end |