Class: Plaid::LinkTokenGetResponse
- Defined in:
- lib/plaid/models/link_token_get_response.rb
Overview
LinkTokenGetResponse defines the response schema for ‘/link/token/get`
Instance Attribute Summary collapse
-
#created_at ⇒ DateTime
The creation timestamp for the ‘link_token`, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.
-
#expiration ⇒ DateTime
The expiration timestamp 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`.
-
#metadata ⇒ LinkTokenGetMetadataResponse
An object specifying the arguments originally provided to the ‘/link/token/create` call.
-
#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:, created_at:, expiration:, metadata:, request_id:, additional_properties: nil) ⇒ LinkTokenGetResponse
constructor
A new instance of LinkTokenGetResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
- #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:, created_at:, expiration:, metadata:, request_id:, additional_properties: nil) ⇒ LinkTokenGetResponse
Returns a new instance of LinkTokenGetResponse.
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/plaid/models/link_token_get_response.rb', line 64 def initialize(link_token:, created_at:, expiration:, metadata:, request_id:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @link_token = link_token @created_at = created_at @expiration = expiration @metadata = @request_id = request_id @additional_properties = additional_properties end |
Instance Attribute Details
#created_at ⇒ DateTime
The creation timestamp for the ‘link_token`, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.
22 23 24 |
# File 'lib/plaid/models/link_token_get_response.rb', line 22 def created_at @created_at end |
#expiration ⇒ DateTime
The expiration timestamp for the ‘link_token`, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.
27 28 29 |
# File 'lib/plaid/models/link_token_get_response.rb', line 27 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_get_response.rb', line 17 def link_token @link_token end |
#metadata ⇒ LinkTokenGetMetadataResponse
An object specifying the arguments originally provided to the ‘/link/token/create` call.
32 33 34 |
# File 'lib/plaid/models/link_token_get_response.rb', line 32 def @metadata 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.
38 39 40 |
# File 'lib/plaid/models/link_token_get_response.rb', line 38 def request_id @request_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/plaid/models/link_token_get_response.rb', line 78 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. link_token = hash.key?('link_token') ? hash['link_token'] : nil created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) end expiration = if hash.key?('expiration') (DateTimeHelper.from_rfc3339(hash['expiration']) if hash['expiration']) end = LinkTokenGetMetadataResponse.from_hash(hash['metadata']) if hash['metadata'] 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. LinkTokenGetResponse.new(link_token: link_token, created_at: created_at, expiration: expiration, metadata: , request_id: request_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 |
# File 'lib/plaid/models/link_token_get_response.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['link_token'] = 'link_token' @_hash['created_at'] = 'created_at' @_hash['expiration'] = 'expiration' @_hash['metadata'] = 'metadata' @_hash['request_id'] = 'request_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
57 58 59 60 61 62 |
# File 'lib/plaid/models/link_token_get_response.rb', line 57 def self.nullables %w[ created_at expiration ] end |
.optionals ⇒ Object
An array for optional fields
52 53 54 |
# File 'lib/plaid/models/link_token_get_response.rb', line 52 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
125 126 127 128 129 130 |
# File 'lib/plaid/models/link_token_get_response.rb', line 125 def inspect class_name = self.class.name.split('::').last "<#{class_name} link_token: #{@link_token.inspect}, created_at: #{@created_at.inspect},"\ " expiration: #{@expiration.inspect}, metadata: #{@metadata.inspect}, request_id:"\ " #{@request_id.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_created_at ⇒ Object
108 109 110 |
# File 'lib/plaid/models/link_token_get_response.rb', line 108 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_expiration ⇒ Object
112 113 114 |
# File 'lib/plaid/models/link_token_get_response.rb', line 112 def to_custom_expiration DateTimeHelper.to_rfc3339(expiration) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
117 118 119 120 121 122 |
# File 'lib/plaid/models/link_token_get_response.rb', line 117 def to_s class_name = self.class.name.split('::').last "<#{class_name} link_token: #{@link_token}, created_at: #{@created_at}, expiration:"\ " #{@expiration}, metadata: #{@metadata}, request_id: #{@request_id}, additional_properties:"\ " #{@additional_properties}>" end |