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



16474
16475
16476
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16474

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16472
16473
16474
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16472

def value
  @value
end

Class Method Details

.ALLObject



16494
16495
16496
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16494

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



16479
16480
16481
16482
16483
16484
16485
16486
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16479

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



16505
16506
16507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16505

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



16489
16490
16491
16492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16489

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



16515
16516
16517
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16515

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



16510
16511
16512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16510

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

.oldestObject

Use the oldest center by creation date.



16499
16500
16501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16499

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

Instance Method Details

#to_hashObject



16519
16520
16521
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16519

def to_hash
  value
end