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.
20527 20528 20529 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20527 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
20525 20526 20527 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20525 def value @value end |
Class Method Details
.ALL ⇒ Object
20547 20548 20549 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20547 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
20532 20533 20534 20535 20536 20537 20538 20539 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20532 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
20555 20556 20557 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20555 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
20542 20543 20544 20545 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20542 def LevyStrategy.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) LevyStrategy.ALL.find { |v| v.value == value } end |
.maximum ⇒ Object
20559 20560 20561 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20559 def LevyStrategy.maximum @@_maximum ||= LevyStrategy.new('maximum') end |
.minimum ⇒ Object
20551 20552 20553 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20551 def LevyStrategy.minimum @@_minimum ||= LevyStrategy.new('minimum') end |
Instance Method Details
#to_hash ⇒ Object
20563 20564 20565 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20563 def to_hash value end |