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.



20952
20953
20954
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20952

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20950
20951
20952
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20950

def value
  @value
end

Class Method Details

.ALLObject



20972
20973
20974
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20972

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



20957
20958
20959
20960
20961
20962
20963
20964
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20957

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



20967
20968
20969
20970
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20967

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.



20984
20985
20986
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20984

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)



20977
20978
20979
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20977

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

Instance Method Details

#to_hashObject



20988
20989
20990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20988

def to_hash
  value
end