Class: Io::Flow::V0::Models::TierEstimateType

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

Returns a new instance of TierEstimateType.



13421
13422
13423
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13421

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13419
13420
13421
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13419

def value
  @value
end

Class Method Details

.ALLObject



13441
13442
13443
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13441

def TierEstimateType.ALL
  @@all ||= [TierEstimateType.calculated, TierEstimateType.custom]
end

.apply(value) ⇒ Object

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



13426
13427
13428
13429
13430
13431
13432
13433
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13426

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

.calculatedObject

Displays the calculated delivery window estimate next to the shipping tier name.



13447
13448
13449
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13447

def TierEstimateType.calculated
  @@_calculated ||= TierEstimateType.new('calculated')
end

.customObject

Shows a custom label next to the shipping tier name instead of a delivery window estimate.



13453
13454
13455
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13453

def TierEstimateType.custom
  @@_custom ||= TierEstimateType.new('custom')
end

.from_string(value) ⇒ Object

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



13436
13437
13438
13439
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13436

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

Instance Method Details

#to_hashObject



13457
13458
13459
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13457

def to_hash
  value
end