Class: Io::Flow::V0::Models::TierStrategy
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TierStrategy
- 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 TierStrategy for this value, creating a new instance for an unknown value.
-
.fastest ⇒ Object
Optimize for fastest first, then cheapest.
-
.from_string(value) ⇒ Object
Returns the instance of TierStrategy for this value, or nil if not found.
-
.lowest_cost ⇒ Object
Optimize for lowest cost first, then fastest.
Instance Method Summary collapse
-
#initialize(value) ⇒ TierStrategy
constructor
A new instance of TierStrategy.
- #to_hash ⇒ Object
Constructor Details
#initialize(value) ⇒ TierStrategy
Returns a new instance of TierStrategy.
13467 13468 13469 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13467 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
13465 13466 13467 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13465 def value @value end |
Class Method Details
.ALL ⇒ Object
13487 13488 13489 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13487 def TierStrategy.ALL @@all ||= [TierStrategy.fastest, TierStrategy.lowest_cost] end |
.apply(value) ⇒ Object
Returns the instance of TierStrategy for this value, creating a new instance for an unknown value
13472 13473 13474 13475 13476 13477 13478 13479 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13472 def TierStrategy.apply(value) if value.instance_of?(TierStrategy) value else HttpClient::Preconditions.assert_class_or_nil('value', value, String) value.nil? ? nil : (from_string(value) || TierStrategy.new(value)) end end |
.fastest ⇒ Object
Optimize for fastest first, then cheapest
13492 13493 13494 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13492 def TierStrategy.fastest @@_fastest ||= TierStrategy.new('fastest') end |
.from_string(value) ⇒ Object
Returns the instance of TierStrategy for this value, or nil if not found
13482 13483 13484 13485 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13482 def TierStrategy.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) TierStrategy.ALL.find { |v| v.value == value } end |
.lowest_cost ⇒ Object
Optimize for lowest cost first, then fastest
13497 13498 13499 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13497 def TierStrategy.lowest_cost @@_lowest_cost ||= TierStrategy.new('lowest_cost') end |
Instance Method Details
#to_hash ⇒ Object
13501 13502 13503 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13501 def to_hash value end |