Class: Plaid::LinkTokenCreateResponse
- Defined in:
- lib/plaid/models/link_token_create_response.rb
Overview
LinkTokenCreateResponse defines the response schema for ‘/link/token/create`
Instance Attribute Summary collapse
-
#expiration ⇒ DateTime
The expiration date for the ‘link_token`, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.
-
#link_token ⇒ String
A ‘link_token`, which can be supplied to Link in order to initialize it and receive a `public_token`, which can be exchanged for an `access_token`.
-
#request_id ⇒ String
A unique identifier for the request, which can be used for troubleshooting.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(link_token:, expiration:, request_id:, additional_properties: nil) ⇒ LinkTokenCreateResponse
constructor
A new instance of LinkTokenCreateResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_expiration ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(link_token:, expiration:, request_id:, additional_properties: nil) ⇒ LinkTokenCreateResponse
Returns a new instance of LinkTokenCreateResponse.
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/plaid/models/link_token_create_response.rb', line 53 def initialize(link_token:, expiration:, request_id:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @link_token = link_token @expiration = expiration @request_id = request_id @additional_properties = additional_properties end |
Instance Attribute Details
#expiration ⇒ DateTime
The expiration date for the ‘link_token`, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format. A `link_token` created to generate a `public_token` that will be exchanged for a new `access_token` expires after 4 hours. A `link_token` created for an existing Item (such as when updating an existing `access_token` by launching Link in update mode) expires after 30 minutes.
26 27 28 |
# File 'lib/plaid/models/link_token_create_response.rb', line 26 def expiration @expiration end |
#link_token ⇒ String
A ‘link_token`, which can be supplied to Link in order to initialize it and receive a `public_token`, which can be exchanged for an `access_token`.
17 18 19 |
# File 'lib/plaid/models/link_token_create_response.rb', line 17 def link_token @link_token end |
#request_id ⇒ String
A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.
32 33 34 |
# File 'lib/plaid/models/link_token_create_response.rb', line 32 def request_id @request_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/plaid/models/link_token_create_response.rb', line 65 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. link_token = hash.key?('link_token') ? hash['link_token'] : nil expiration = if hash.key?('expiration') (DateTimeHelper.from_rfc3339(hash['expiration']) if hash['expiration']) end request_id = hash.key?('request_id') ? hash['request_id'] : nil # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. LinkTokenCreateResponse.new(link_token: link_token, expiration: expiration, request_id: request_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 |
# File 'lib/plaid/models/link_token_create_response.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['link_token'] = 'link_token' @_hash['expiration'] = 'expiration' @_hash['request_id'] = 'request_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/plaid/models/link_token_create_response.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 |
# File 'lib/plaid/models/link_token_create_response.rb', line 44 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
101 102 103 104 105 |
# File 'lib/plaid/models/link_token_create_response.rb', line 101 def inspect class_name = self.class.name.split('::').last "<#{class_name} link_token: #{@link_token.inspect}, expiration: #{@expiration.inspect},"\ " request_id: #{@request_id.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_expiration ⇒ Object
89 90 91 |
# File 'lib/plaid/models/link_token_create_response.rb', line 89 def to_custom_expiration DateTimeHelper.to_rfc3339(expiration) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
94 95 96 97 98 |
# File 'lib/plaid/models/link_token_create_response.rb', line 94 def to_s class_name = self.class.name.split('::').last "<#{class_name} link_token: #{@link_token}, expiration: #{@expiration}, request_id:"\ " #{@request_id}, additional_properties: #{@additional_properties}>" end |