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.



21229
21230
21231
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21229

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



21227
21228
21229
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21227

def value
  @value
end

Class Method Details

.ALLObject



21249
21250
21251
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21249

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



21234
21235
21236
21237
21238
21239
21240
21241
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21234

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.



21255
21256
21257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21255

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.



21261
21262
21263
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21261

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



21244
21245
21246
21247
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21244

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



21265
21266
21267
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21265

def to_hash
  value
end