Class: Io::Flow::V0::Models::TokenType
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TokenType
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
- .ALL ⇒ Object
-
.apply(value) ⇒ Object
Returns the instance of TokenType for this value, creating a new instance for an unknown value.
-
.from_string(value) ⇒ Object
Returns the instance of TokenType for this value, or nil if not found.
-
.one_time ⇒ Object
Create a one time token for the card.
-
.permanent ⇒ Object
Create a permanent token for the card (stored up until normal purge interval).
Instance Method Summary collapse
-
#initialize(value) ⇒ TokenType
constructor
A new instance of TokenType.
- #to_hash ⇒ Object
Constructor Details
#initialize(value) ⇒ TokenType
Returns a new instance of TokenType.
18829 18830 18831 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18829 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
18827 18828 18829 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18827 def value @value end |
Class Method Details
.ALL ⇒ Object
18849 18850 18851 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18849 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
18834 18835 18836 18837 18838 18839 18840 18841 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18834 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
18844 18845 18846 18847 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18844 def TokenType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) TokenType.ALL.find { |v| v.value == value } end |
.one_time ⇒ Object
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.
18861 18862 18863 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18861 def TokenType.one_time @@_one_time ||= TokenType.new('one_time') end |
.permanent ⇒ Object
Create a permanent token for the card (stored up until normal purge interval)
18854 18855 18856 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18854 def TokenType.permanent @@_permanent ||= TokenType.new('permanent') end |
Instance Method Details
#to_hash ⇒ Object
18865 18866 18867 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18865 def to_hash value end |