Class: Io::Flow::V0::Models::LanePreselectPreference

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) ⇒ LanePreselectPreference

Returns a new instance of LanePreselectPreference.



21981
21982
21983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21981

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



21979
21980
21981
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21979

def value
  @value
end

Class Method Details

.ALLObject



22001
22002
22003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22001

def LanePreselectPreference.ALL
  @@all ||= [LanePreselectPreference.lowest_cost, LanePreselectPreference.default_tier]
end

.apply(value) ⇒ Object

Returns the instance of LanePreselectPreference for this value, creating a new instance for an unknown value



21986
21987
21988
21989
21990
21991
21992
21993
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21986

def LanePreselectPreference.apply(value)
  if value.instance_of?(LanePreselectPreference)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || LanePreselectPreference.new(value))
  end
end

.default_tierObject

Manually designate a tier in the shipping lane as the default



22011
22012
22013
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22011

def LanePreselectPreference.default_tier
  @@_default_tier ||= LanePreselectPreference.new('default_tier')
end

.from_string(value) ⇒ Object

Returns the instance of LanePreselectPreference for this value, or nil if not found



21996
21997
21998
21999
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21996

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

.lowest_costObject

Preselect the lowest cost tier in the shipping lane



22006
22007
22008
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22006

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

Instance Method Details

#to_hashObject



22015
22016
22017
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22015

def to_hash
  value
end