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.



18013
18014
18015
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18013

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18011
18012
18013
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18011

def value
  @value
end

Class Method Details

.ALLObject



18033
18034
18035
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18033

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



18018
18019
18020
18021
18022
18023
18024
18025
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18018

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



18043
18044
18045
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18043

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



18028
18029
18030
18031
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18028

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



18038
18039
18040
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18038

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

Instance Method Details

#to_hashObject



18047
18048
18049
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18047

def to_hash
  value
end