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.
8556 8557 8558 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8556 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
8554 8555 8556 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8554 def value @value end |
Class Method Details
.ALL ⇒ Object
8576 8577 8578 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8576 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
8561 8562 8563 8564 8565 8566 8567 8568 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8561 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
8584 8585 8586 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8584 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
8571 8572 8573 8574 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8571 def LevyStrategy.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) LevyStrategy.ALL.find { |v| v.value == value } end |
.maximum ⇒ Object
8588 8589 8590 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8588 def LevyStrategy.maximum @@_maximum ||= LevyStrategy.new('maximum') end |
.minimum ⇒ Object
8580 8581 8582 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8580 def LevyStrategy.minimum @@_minimum ||= LevyStrategy.new('minimum') end |
Instance Method Details
#to_hash ⇒ Object
8592 8593 8594 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8592 def to_hash value end |