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



19560
19561
19562
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19560

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



19558
19559
19560
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19558

def value
  @value
end

Class Method Details

.ALLObject



19580
19581
19582
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19580

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



19565
19566
19567
19568
19569
19570
19571
19572
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19565

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.



19586
19587
19588
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19586

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.



19592
19593
19594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19592

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



19575
19576
19577
19578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19575

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



19596
19597
19598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19596

def to_hash
  value
end