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.



27628
27629
27630
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27628

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



27626
27627
27628
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27626

def value
  @value
end

Class Method Details

.ALLObject



27648
27649
27650
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27648

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



27633
27634
27635
27636
27637
27638
27639
27640
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27633

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.



27654
27655
27656
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27654

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.



27660
27661
27662
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27660

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



27643
27644
27645
27646
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27643

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



27664
27665
27666
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27664

def to_hash
  value
end