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.
13439 13440 13441 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13439 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
13437 13438 13439 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13437 def value @value end |
Class Method Details
.ALL ⇒ Object
13459 13460 13461 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13459 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
13444 13445 13446 13447 13448 13449 13450 13451 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13444 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
13467 13468 13469 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13467 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
13454 13455 13456 13457 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13454 def LevyStrategy.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) LevyStrategy.ALL.find { |v| v.value == value } end |
.maximum ⇒ Object
13471 13472 13473 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13471 def LevyStrategy.maximum @@_maximum ||= LevyStrategy.new('maximum') end |
.minimum ⇒ Object
13463 13464 13465 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13463 def LevyStrategy.minimum @@_minimum ||= LevyStrategy.new('minimum') end |
Instance Method Details
#to_hash ⇒ Object
13475 13476 13477 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13475 def to_hash value end |