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.



12878
12879
12880
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12878

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12876
12877
12878
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12876

def value
  @value
end

Class Method Details

.ALLObject



12898
12899
12900
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12898

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



12883
12884
12885
12886
12887
12888
12889
12890
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12883

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.



12904
12905
12906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12904

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.



12910
12911
12912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12910

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



12893
12894
12895
12896
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12893

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



12914
12915
12916
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12914

def to_hash
  value
end