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.
10925 10926 10927 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10925 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
10923 10924 10925 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10923 def value @value end |
Class Method Details
.ALL ⇒ Object
10945 10946 10947 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10945 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
10930 10931 10932 10933 10934 10935 10936 10937 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10930 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
10950 10951 10952 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10950 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
10940 10941 10942 10943 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10940 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
10955 10956 10957 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10955 def TierStrategy.lowest_cost @@_lowest_cost ||= TierStrategy.new('lowest_cost') end |
Instance Method Details
#to_hash ⇒ Object
10959 10960 10961 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10959 def to_hash value end |