Class: Io::Flow::V0::Models::LaneStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ LaneStrategy

Returns a new instance of LaneStrategy.



17694
17695
17696
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17694

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17692
17693
17694
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17692

def value
  @value
end

Class Method Details

.ALLObject



17714
17715
17716
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17714

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



17699
17700
17701
17702
17703
17704
17705
17706
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17699

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

.fastestObject

Optimize for fastest average time in transit across all tiers from the center on the lane



17725
17726
17727
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17725

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



17709
17710
17711
17712
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17709

def LaneStrategy.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  LaneStrategy.ALL.find { |v| v.value == value }
end

.highest_priorityObject

Get the highest priority center for the shipping lane



17735
17736
17737
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17735

def LaneStrategy.highest_priority
  @@_highest_priority ||= LaneStrategy.new('highest_priority')
end

.lowest_costObject

Optimize for lowest average cost across all tiers from the center on the lane



17730
17731
17732
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17730

def LaneStrategy.lowest_cost
  @@_lowest_cost ||= LaneStrategy.new('lowest_cost')
end

.oldestObject

Use the oldest center by creation date.



17719
17720
17721
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17719

def LaneStrategy.oldest
  @@_oldest ||= LaneStrategy.new('oldest')
end

Instance Method Details

#to_hashObject



17739
17740
17741
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17739

def to_hash
  value
end