Class: Io::Flow::V0::Models::ZeroAmountIndicator

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) ⇒ ZeroAmountIndicator

Returns a new instance of ZeroAmountIndicator.



20232
20233
20234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20232

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20230
20231
20232
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20230

def value
  @value
end

Class Method Details

.ALLObject



20252
20253
20254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20252

def ZeroAmountIndicator.ALL
  @@all ||= [ZeroAmountIndicator.zero, ZeroAmountIndicator.free]
end

.apply(value) ⇒ Object

Returns the instance of ZeroAmountIndicator for this value, creating a new instance for an unknown value



20237
20238
20239
20240
20241
20242
20243
20244
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20237

def ZeroAmountIndicator.apply(value)
  if value.instance_of?(ZeroAmountIndicator)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || ZeroAmountIndicator.new(value))
  end
end

.freeObject

Show the word FREE in the label



20262
20263
20264
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20262

def ZeroAmountIndicator.free
  @@_free ||= ZeroAmountIndicator.new('free')
end

.from_string(value) ⇒ Object

Returns the instance of ZeroAmountIndicator for this value, or nil if not found



20247
20248
20249
20250
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20247

def ZeroAmountIndicator.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  ZeroAmountIndicator.ALL.find { |v| v.value == value }
end

.zeroObject

Show the number 0.00 in the label



20257
20258
20259
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20257

def ZeroAmountIndicator.zero
  @@_zero ||= ZeroAmountIndicator.new('zero')
end

Instance Method Details

#to_hashObject



20266
20267
20268
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20266

def to_hash
  value
end