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.
-
.highest_priority ⇒ Object
Get the highest priority center for the shipping lane.
-
.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.
17157 17158 17159 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17157 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
17155 17156 17157 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17155 def value @value end |
Class Method Details
.ALL ⇒ Object
17177 17178 17179 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17177 def LaneStrategy.ALL @@all ||= [LaneStrategy.oldest, LaneStrategy.fastest, LaneStrategy.lowest_cost, LaneStrategy.highest_priority] end |
.apply(value) ⇒ Object
Returns the instance of LaneStrategy for this value, creating a new instance for an unknown value
17162 17163 17164 17165 17166 17167 17168 17169 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17162 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
17188 17189 17190 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17188 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
17172 17173 17174 17175 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17172 def LaneStrategy.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) LaneStrategy.ALL.find { |v| v.value == value } end |
.highest_priority ⇒ Object
Get the highest priority center for the shipping lane
17198 17199 17200 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17198 def LaneStrategy.highest_priority @@_highest_priority ||= LaneStrategy.new('highest_priority') end |
.lowest_cost ⇒ Object
Optimize for lowest average cost across all tiers from the center on the lane
17193 17194 17195 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17193 def LaneStrategy.lowest_cost @@_lowest_cost ||= LaneStrategy.new('lowest_cost') end |
.oldest ⇒ Object
Use the oldest center by creation date.
17182 17183 17184 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17182 def LaneStrategy.oldest @@_oldest ||= LaneStrategy.new('oldest') end |
Instance Method Details
#to_hash ⇒ Object
17202 17203 17204 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17202 def to_hash value end |