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.



16684
16685
16686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16684

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16682
16683
16684
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16682

def value
  @value
end

Class Method Details

.ALLObject



16704
16705
16706
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16704

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



16689
16690
16691
16692
16693
16694
16695
16696
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16689

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.



16710
16711
16712
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16710

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.



16716
16717
16718
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16716

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



16699
16700
16701
16702
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16699

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



16720
16721
16722
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16720

def to_hash
  value
end