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.
17268 17269 17270 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17268 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
17266 17267 17268 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17266 def value @value end |
Class Method Details
.ALL ⇒ Object
17288 17289 17290 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17288 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
17273 17274 17275 17276 17277 17278 17279 17280 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17273 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
17296 17297 17298 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17296 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
17283 17284 17285 17286 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17283 def LevyStrategy.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) LevyStrategy.ALL.find { |v| v.value == value } end |
.maximum ⇒ Object
17300 17301 17302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17300 def LevyStrategy.maximum @@_maximum ||= LevyStrategy.new('maximum') end |
.minimum ⇒ Object
17292 17293 17294 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17292 def LevyStrategy.minimum @@_minimum ||= LevyStrategy.new('minimum') end |
Instance Method Details
#to_hash ⇒ Object
17304 17305 17306 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17304 def to_hash value end |