Class: ThePlaidApi::OauthIntrospectResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/oauth_introspect_response.rb

Overview

OAuth token introspect response

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(active:, request_id:, scope: SKIP, client_id: SKIP, exp: SKIP, iat: SKIP, sub: SKIP, aud: SKIP, iss: SKIP, token_type: SKIP, user_id: SKIP, additional_properties: nil) ⇒ OauthIntrospectResponse

Returns a new instance of OauthIntrospectResponse.



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 108

def initialize(active:, request_id:, scope: SKIP, client_id: SKIP,
               exp: SKIP, iat: SKIP, sub: SKIP, aud: SKIP, iss: SKIP,
               token_type: SKIP, user_id: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @active = active
  @scope = scope unless scope == SKIP
  @client_id = client_id unless client_id == SKIP
  @exp = exp unless exp == SKIP
  @iat = iat unless iat == SKIP
  @sub = sub unless sub == SKIP
  @aud = aud unless aud == SKIP
  @iss = iss unless iss == SKIP
  @token_type = token_type unless token_type == SKIP
  @user_id = user_id unless user_id == SKIP
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#activeTrueClass | FalseClass

Boolean indicator of whether or not the presented token is currently active. A ‘true` value indicates that the token has been issued, has not been revoked, and is within the time window of validity.

Returns:

  • (TrueClass | FalseClass)


16
17
18
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 16

def active
  @active
end

#audString

Audience of the token

Returns:

  • (String)


51
52
53
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 51

def aud
  @aud
end

#client_idString

Your Plaid API ‘client_id`. The `client_id` is required and may be provided either in the `PLAID-CLIENT-ID` header or as part of a request body.

Returns:

  • (String)


35
36
37
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 35

def client_id
  @client_id
end

#expInteger

Expiration time as UNIX timestamp since January 1 1970 UTC

Returns:

  • (Integer)


39
40
41
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 39

def exp
  @exp
end

#iatInteger

Issued at time as UNIX timestamp since January 1 1970 UTC

Returns:

  • (Integer)


43
44
45
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 43

def iat
  @iat
end

#issString

Issuer of the token

Returns:

  • (String)


55
56
57
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 55

def iss
  @iss
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


69
70
71
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 69

def request_id
  @request_id
end

#scopeString

A JSON string containing a space-separated list of scopes associated with this token, in the format described in [datatracker.ietf.org/doc/html/rfc6749#section-3.3](https://datatr acker.ietf.org/doc/html/rfc6749#section-3.3). Currently accepted values are: ‘user:read` allows reading user data. `user:write` allows writing user data. `exchange` allows exchanging a token using the `urn:plaid:params:oauth:user-token` grant type. `mcp:dashboard` allows access to the MCP dashboard server.

Returns:

  • (String)


29
30
31
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 29

def scope
  @scope
end

#subString

Subject of the token

Returns:

  • (String)


47
48
49
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 47

def sub
  @sub
end

#token_typeString

Type of the token

Returns:

  • (String)


59
60
61
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 59

def token_type
  @token_type
end

#user_idString

User ID of the token

Returns:

  • (String)


63
64
65
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 63

def user_id
  @user_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 129

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  active = hash.key?('active') ? hash['active'] : nil
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  scope = hash.key?('scope') ? hash['scope'] : SKIP
  client_id = hash.key?('client_id') ? hash['client_id'] : SKIP
  exp = hash.key?('exp') ? hash['exp'] : SKIP
  iat = hash.key?('iat') ? hash['iat'] : SKIP
  sub = hash.key?('sub') ? hash['sub'] : SKIP
  aud = hash.key?('aud') ? hash['aud'] : SKIP
  iss = hash.key?('iss') ? hash['iss'] : SKIP
  token_type = hash.key?('token_type') ? hash['token_type'] : SKIP
  user_id = hash.key?('user_id') ? hash['user_id'] : SKIP

  # 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.
  OauthIntrospectResponse.new(active: active,
                              request_id: request_id,
                              scope: scope,
                              client_id: client_id,
                              exp: exp,
                              iat: iat,
                              sub: sub,
                              aud: aud,
                              iss: iss,
                              token_type: token_type,
                              user_id: user_id,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 72

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['active'] = 'active'
  @_hash['scope'] = 'scope'
  @_hash['client_id'] = 'client_id'
  @_hash['exp'] = 'exp'
  @_hash['iat'] = 'iat'
  @_hash['sub'] = 'sub'
  @_hash['aud'] = 'aud'
  @_hash['iss'] = 'iss'
  @_hash['token_type'] = 'token_type'
  @_hash['user_id'] = 'user_id'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



104
105
106
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 104

def self.nullables
  []
end

.optionalsObject

An array for optional fields



89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 89

def self.optionals
  %w[
    scope
    client_id
    exp
    iat
    sub
    aud
    iss
    token_type
    user_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



177
178
179
180
181
182
183
184
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 177

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} active: #{@active.inspect}, scope: #{@scope.inspect}, client_id:"\
  " #{@client_id.inspect}, exp: #{@exp.inspect}, iat: #{@iat.inspect}, sub: #{@sub.inspect},"\
  " aud: #{@aud.inspect}, iss: #{@iss.inspect}, token_type: #{@token_type.inspect}, user_id:"\
  " #{@user_id.inspect}, request_id: #{@request_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



168
169
170
171
172
173
174
# File 'lib/the_plaid_api/models/oauth_introspect_response.rb', line 168

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} active: #{@active}, scope: #{@scope}, client_id: #{@client_id}, exp:"\
  " #{@exp}, iat: #{@iat}, sub: #{@sub}, aud: #{@aud}, iss: #{@iss}, token_type:"\
  " #{@token_type}, user_id: #{@user_id}, request_id: #{@request_id}, additional_properties:"\
  " #{@additional_properties}>"
end