Class: Io::Flow::V0::Models::LaneStrategy
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::LaneStrategy
- 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 LaneStrategy for this value, creating a new instance for an unknown value.
-
.fastest ⇒ Object
Optimize for fastest average time in transit across all tiers from the center on the lane.
-
.from_string(value) ⇒ Object
Returns the instance of LaneStrategy for this value, or nil if not found.
-
.lowest_cost ⇒ Object
Optimize for lowest average cost across all tiers from the center on the lane.
-
.oldest ⇒ Object
Use the oldest center by creation date.
Instance Method Summary collapse
-
#initialize(value) ⇒ LaneStrategy
constructor
A new instance of LaneStrategy.
- #to_hash ⇒ Object
Constructor Details
#initialize(value) ⇒ LaneStrategy
Returns a new instance of LaneStrategy.
15590 15591 15592 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15590 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
15588 15589 15590 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15588 def value @value end |
Class Method Details
.ALL ⇒ Object
15610 15611 15612 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15610 def LaneStrategy.ALL @@all ||= [LaneStrategy.oldest, LaneStrategy.fastest, LaneStrategy.lowest_cost] end |
.apply(value) ⇒ Object
Returns the instance of LaneStrategy for this value, creating a new instance for an unknown value
15595 15596 15597 15598 15599 15600 15601 15602 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15595 def LaneStrategy.apply(value) if value.instance_of?(LaneStrategy) value else HttpClient::Preconditions.assert_class_or_nil('value', value, String) value.nil? ? nil : (from_string(value) || LaneStrategy.new(value)) end end |
.fastest ⇒ Object
Optimize for fastest average time in transit across all tiers from the center on the lane
15621 15622 15623 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15621 def LaneStrategy.fastest @@_fastest ||= LaneStrategy.new('fastest') end |
.from_string(value) ⇒ Object
Returns the instance of LaneStrategy for this value, or nil if not found
15605 15606 15607 15608 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15605 def LaneStrategy.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) LaneStrategy.ALL.find { |v| v.value == value } end |
.lowest_cost ⇒ Object
Optimize for lowest average cost across all tiers from the center on the lane
15626 15627 15628 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15626 def LaneStrategy.lowest_cost @@_lowest_cost ||= LaneStrategy.new('lowest_cost') end |
.oldest ⇒ Object
Use the oldest center by creation date.
15615 15616 15617 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15615 def LaneStrategy.oldest @@_oldest ||= LaneStrategy.new('oldest') end |
Instance Method Details
#to_hash ⇒ Object
15630 15631 15632 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15630 def to_hash value end |