Class: Io::Flow::V0::Models::TokenType

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

Returns a new instance of TokenType.



16211
16212
16213
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16211

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16209
16210
16211
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16209

def value
  @value
end

Class Method Details

.ALLObject



16231
16232
16233
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16231

def TokenType.ALL
  @@all ||= [TokenType.permanent, TokenType.one_time]
end

.apply(value) ⇒ Object

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



16216
16217
16218
16219
16220
16221
16222
16223
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16216

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

.from_string(value) ⇒ Object

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



16226
16227
16228
16229
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16226

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

.one_timeObject

Create a one time token for the card. This token can be used to either authorized payment or later exchange for a permanent token. Once used, this token cannot be used for future activity.



16243
16244
16245
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16243

def TokenType.one_time
  @@_one_time ||= TokenType.new('one_time')
end

.permanentObject

Create a permanent token for the card (stored up until normal purge interval)



16236
16237
16238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16236

def TokenType.permanent
  @@_permanent ||= TokenType.new('permanent')
end

Instance Method Details

#to_hashObject



16247
16248
16249
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16247

def to_hash
  value
end