ory-hydra-client 0.0.0.alpha39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +165 -0
- data/Rakefile +10 -0
- data/docs/AcceptConsentRequest.md +25 -0
- data/docs/AcceptLoginRequest.md +27 -0
- data/docs/AdminApi.md +1443 -0
- data/docs/CompletedRequest.md +17 -0
- data/docs/ConsentRequest.md +39 -0
- data/docs/ConsentRequestSession.md +19 -0
- data/docs/FlushInactiveOAuth2TokensRequest.md +17 -0
- data/docs/GenericError.md +23 -0
- data/docs/HealthNotReadyStatus.md +17 -0
- data/docs/HealthStatus.md +17 -0
- data/docs/JSONWebKey.md +49 -0
- data/docs/JSONWebKeySet.md +17 -0
- data/docs/JsonWebKeySetGeneratorRequest.md +21 -0
- data/docs/LoginRequest.md +33 -0
- data/docs/LogoutRequest.md +23 -0
- data/docs/OAuth2Client.md +79 -0
- data/docs/OAuth2TokenIntrospection.md +41 -0
- data/docs/Oauth2TokenResponse.md +27 -0
- data/docs/OauthTokenResponse.md +27 -0
- data/docs/OpenIDConnectContext.md +25 -0
- data/docs/PreviousConsentSession.md +27 -0
- data/docs/PublicApi.md +398 -0
- data/docs/RejectRequest.md +25 -0
- data/docs/UserinfoResponse.md +53 -0
- data/docs/Version.md +17 -0
- data/docs/WellKnown.md +65 -0
- data/lib/ory-hydra-client.rb +65 -0
- data/lib/ory-hydra-client/api/admin_api.rb +1879 -0
- data/lib/ory-hydra-client/api/public_api.rb +498 -0
- data/lib/ory-hydra-client/api_client.rb +386 -0
- data/lib/ory-hydra-client/api_error.rb +57 -0
- data/lib/ory-hydra-client/configuration.rb +255 -0
- data/lib/ory-hydra-client/models/accept_consent_request.rb +250 -0
- data/lib/ory-hydra-client/models/accept_login_request.rb +264 -0
- data/lib/ory-hydra-client/models/completed_request.rb +207 -0
- data/lib/ory-hydra-client/models/consent_request.rb +321 -0
- data/lib/ory-hydra-client/models/consent_request_session.rb +221 -0
- data/lib/ory-hydra-client/models/flush_inactive_o_auth2_tokens_request.rb +207 -0
- data/lib/ory-hydra-client/models/generic_error.rb +243 -0
- data/lib/ory-hydra-client/models/health_not_ready_status.rb +209 -0
- data/lib/ory-hydra-client/models/health_status.rb +207 -0
- data/lib/ory-hydra-client/models/json_web_key.rb +377 -0
- data/lib/ory-hydra-client/models/json_web_key_set.rb +209 -0
- data/lib/ory-hydra-client/models/json_web_key_set_generator_request.rb +242 -0
- data/lib/ory-hydra-client/models/login_request.rb +289 -0
- data/lib/ory-hydra-client/models/logout_request.rb +237 -0
- data/lib/ory-hydra-client/models/o_auth2_client.rb +551 -0
- data/lib/ory-hydra-client/models/o_auth2_token_introspection.rb +337 -0
- data/lib/ory-hydra-client/models/oauth2_token_response.rb +252 -0
- data/lib/ory-hydra-client/models/oauth_token_response.rb +258 -0
- data/lib/ory-hydra-client/models/open_id_connect_context.rb +253 -0
- data/lib/ory-hydra-client/models/previous_consent_session.rb +260 -0
- data/lib/ory-hydra-client/models/reject_request.rb +242 -0
- data/lib/ory-hydra-client/models/userinfo_response.rb +388 -0
- data/lib/ory-hydra-client/models/version.rb +207 -0
- data/lib/ory-hydra-client/models/well_known.rb +501 -0
- data/lib/ory-hydra-client/version.rb +15 -0
- data/ory-hydra-client.gemspec +39 -0
- data/spec/api/admin_api_spec.rb +395 -0
- data/spec/api/public_api_spec.rb +129 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/accept_consent_request_spec.rb +65 -0
- data/spec/models/accept_login_request_spec.rb +71 -0
- data/spec/models/completed_request_spec.rb +41 -0
- data/spec/models/consent_request_session_spec.rb +47 -0
- data/spec/models/consent_request_spec.rb +107 -0
- data/spec/models/flush_inactive_o_auth2_tokens_request_spec.rb +41 -0
- data/spec/models/generic_error_spec.rb +59 -0
- data/spec/models/health_not_ready_status_spec.rb +41 -0
- data/spec/models/health_status_spec.rb +41 -0
- data/spec/models/json_web_key_set_generator_request_spec.rb +53 -0
- data/spec/models/json_web_key_set_spec.rb +41 -0
- data/spec/models/json_web_key_spec.rb +137 -0
- data/spec/models/login_request_spec.rb +89 -0
- data/spec/models/logout_request_spec.rb +59 -0
- data/spec/models/o_auth2_client_spec.rb +227 -0
- data/spec/models/o_auth2_token_introspection_spec.rb +113 -0
- data/spec/models/oauth2_token_response_spec.rb +71 -0
- data/spec/models/oauth_token_response_spec.rb +71 -0
- data/spec/models/open_id_connect_context_spec.rb +65 -0
- data/spec/models/previous_consent_session_spec.rb +71 -0
- data/spec/models/reject_request_spec.rb +65 -0
- data/spec/models/userinfo_response_spec.rb +149 -0
- data/spec/models/version_spec.rb +41 -0
- data/spec/models/well_known_spec.rb +185 -0
- data/spec/spec_helper.rb +111 -0
- metadata +223 -0
@@ -0,0 +1,337 @@
|
|
1
|
+
=begin
|
2
|
+
#ORY Hydra
|
3
|
+
|
4
|
+
#Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v0.0.0-alpha.39
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module OryHydraClient
|
16
|
+
# https://tools.ietf.org/html/rfc7662
|
17
|
+
class OAuth2TokenIntrospection
|
18
|
+
# Active is a boolean indicator of whether or not the presented token is currently active. The specifics of a token's \"active\" state will vary depending on the implementation of the authorization server and the information it keeps about its tokens, but a \"true\" value return for the \"active\" property will generally indicate that a given token has been issued by this authorization server, has not been revoked by the resource owner, and is within its given time window of validity (e.g., after its issuance time and before its expiration time).
|
19
|
+
attr_accessor :active
|
20
|
+
|
21
|
+
# Audience contains a list of the token's intended audiences.
|
22
|
+
attr_accessor :aud
|
23
|
+
|
24
|
+
# ClientID is aclient identifier for the OAuth 2.0 client that requested this token.
|
25
|
+
attr_accessor :client_id
|
26
|
+
|
27
|
+
# Expires at is an integer timestamp, measured in the number of seconds since January 1 1970 UTC, indicating when this token will expire.
|
28
|
+
attr_accessor :exp
|
29
|
+
|
30
|
+
# Extra is arbitrary data set by the session.
|
31
|
+
attr_accessor :ext
|
32
|
+
|
33
|
+
# Issued at is an integer timestamp, measured in the number of seconds since January 1 1970 UTC, indicating when this token was originally issued.
|
34
|
+
attr_accessor :iat
|
35
|
+
|
36
|
+
# IssuerURL is a string representing the issuer of this token
|
37
|
+
attr_accessor :iss
|
38
|
+
|
39
|
+
# NotBefore is an integer timestamp, measured in the number of seconds since January 1 1970 UTC, indicating when this token is not to be used before.
|
40
|
+
attr_accessor :nbf
|
41
|
+
|
42
|
+
# ObfuscatedSubject is set when the subject identifier algorithm was set to \"pairwise\" during authorization. It is the `sub` value of the ID Token that was issued.
|
43
|
+
attr_accessor :obfuscated_subject
|
44
|
+
|
45
|
+
# Scope is a JSON string containing a space-separated list of scopes associated with this token.
|
46
|
+
attr_accessor :scope
|
47
|
+
|
48
|
+
# Subject of the token, as defined in JWT [RFC7519]. Usually a machine-readable identifier of the resource owner who authorized this token.
|
49
|
+
attr_accessor :sub
|
50
|
+
|
51
|
+
# TokenType is the introspected token's type, for example `access_token` or `refresh_token`.
|
52
|
+
attr_accessor :token_type
|
53
|
+
|
54
|
+
# Username is a human-readable identifier for the resource owner who authorized this token.
|
55
|
+
attr_accessor :username
|
56
|
+
|
57
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
58
|
+
def self.attribute_map
|
59
|
+
{
|
60
|
+
:'active' => :'active',
|
61
|
+
:'aud' => :'aud',
|
62
|
+
:'client_id' => :'client_id',
|
63
|
+
:'exp' => :'exp',
|
64
|
+
:'ext' => :'ext',
|
65
|
+
:'iat' => :'iat',
|
66
|
+
:'iss' => :'iss',
|
67
|
+
:'nbf' => :'nbf',
|
68
|
+
:'obfuscated_subject' => :'obfuscated_subject',
|
69
|
+
:'scope' => :'scope',
|
70
|
+
:'sub' => :'sub',
|
71
|
+
:'token_type' => :'token_type',
|
72
|
+
:'username' => :'username'
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
# Attribute type mapping.
|
77
|
+
def self.openapi_types
|
78
|
+
{
|
79
|
+
:'active' => :'Boolean',
|
80
|
+
:'aud' => :'Array<String>',
|
81
|
+
:'client_id' => :'String',
|
82
|
+
:'exp' => :'Integer',
|
83
|
+
:'ext' => :'Hash<String, Object>',
|
84
|
+
:'iat' => :'Integer',
|
85
|
+
:'iss' => :'String',
|
86
|
+
:'nbf' => :'Integer',
|
87
|
+
:'obfuscated_subject' => :'String',
|
88
|
+
:'scope' => :'String',
|
89
|
+
:'sub' => :'String',
|
90
|
+
:'token_type' => :'String',
|
91
|
+
:'username' => :'String'
|
92
|
+
}
|
93
|
+
end
|
94
|
+
|
95
|
+
# List of attributes with nullable: true
|
96
|
+
def self.openapi_nullable
|
97
|
+
Set.new([
|
98
|
+
])
|
99
|
+
end
|
100
|
+
|
101
|
+
# Initializes the object
|
102
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
103
|
+
def initialize(attributes = {})
|
104
|
+
if (!attributes.is_a?(Hash))
|
105
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::OAuth2TokenIntrospection` initialize method"
|
106
|
+
end
|
107
|
+
|
108
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
109
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
110
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
111
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::OAuth2TokenIntrospection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
112
|
+
end
|
113
|
+
h[k.to_sym] = v
|
114
|
+
}
|
115
|
+
|
116
|
+
if attributes.key?(:'active')
|
117
|
+
self.active = attributes[:'active']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.key?(:'aud')
|
121
|
+
if (value = attributes[:'aud']).is_a?(Array)
|
122
|
+
self.aud = value
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:'client_id')
|
127
|
+
self.client_id = attributes[:'client_id']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'exp')
|
131
|
+
self.exp = attributes[:'exp']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.key?(:'ext')
|
135
|
+
if (value = attributes[:'ext']).is_a?(Hash)
|
136
|
+
self.ext = value
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'iat')
|
141
|
+
self.iat = attributes[:'iat']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'iss')
|
145
|
+
self.iss = attributes[:'iss']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.key?(:'nbf')
|
149
|
+
self.nbf = attributes[:'nbf']
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.key?(:'obfuscated_subject')
|
153
|
+
self.obfuscated_subject = attributes[:'obfuscated_subject']
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.key?(:'scope')
|
157
|
+
self.scope = attributes[:'scope']
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes.key?(:'sub')
|
161
|
+
self.sub = attributes[:'sub']
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.key?(:'token_type')
|
165
|
+
self.token_type = attributes[:'token_type']
|
166
|
+
end
|
167
|
+
|
168
|
+
if attributes.key?(:'username')
|
169
|
+
self.username = attributes[:'username']
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
174
|
+
# @return Array for valid properties with the reasons
|
175
|
+
def list_invalid_properties
|
176
|
+
invalid_properties = Array.new
|
177
|
+
if @active.nil?
|
178
|
+
invalid_properties.push('invalid value for "active", active cannot be nil.')
|
179
|
+
end
|
180
|
+
|
181
|
+
invalid_properties
|
182
|
+
end
|
183
|
+
|
184
|
+
# Check to see if the all the properties in the model are valid
|
185
|
+
# @return true if the model is valid
|
186
|
+
def valid?
|
187
|
+
return false if @active.nil?
|
188
|
+
true
|
189
|
+
end
|
190
|
+
|
191
|
+
# Checks equality by comparing each attribute.
|
192
|
+
# @param [Object] Object to be compared
|
193
|
+
def ==(o)
|
194
|
+
return true if self.equal?(o)
|
195
|
+
self.class == o.class &&
|
196
|
+
active == o.active &&
|
197
|
+
aud == o.aud &&
|
198
|
+
client_id == o.client_id &&
|
199
|
+
exp == o.exp &&
|
200
|
+
ext == o.ext &&
|
201
|
+
iat == o.iat &&
|
202
|
+
iss == o.iss &&
|
203
|
+
nbf == o.nbf &&
|
204
|
+
obfuscated_subject == o.obfuscated_subject &&
|
205
|
+
scope == o.scope &&
|
206
|
+
sub == o.sub &&
|
207
|
+
token_type == o.token_type &&
|
208
|
+
username == o.username
|
209
|
+
end
|
210
|
+
|
211
|
+
# @see the `==` method
|
212
|
+
# @param [Object] Object to be compared
|
213
|
+
def eql?(o)
|
214
|
+
self == o
|
215
|
+
end
|
216
|
+
|
217
|
+
# Calculates hash code according to all attributes.
|
218
|
+
# @return [Integer] Hash code
|
219
|
+
def hash
|
220
|
+
[active, aud, client_id, exp, ext, iat, iss, nbf, obfuscated_subject, scope, sub, token_type, username].hash
|
221
|
+
end
|
222
|
+
|
223
|
+
# Builds the object from hash
|
224
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
225
|
+
# @return [Object] Returns the model itself
|
226
|
+
def self.build_from_hash(attributes)
|
227
|
+
new.build_from_hash(attributes)
|
228
|
+
end
|
229
|
+
|
230
|
+
# Builds the object from hash
|
231
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
232
|
+
# @return [Object] Returns the model itself
|
233
|
+
def build_from_hash(attributes)
|
234
|
+
return nil unless attributes.is_a?(Hash)
|
235
|
+
self.class.openapi_types.each_pair do |key, type|
|
236
|
+
if type =~ /\AArray<(.*)>/i
|
237
|
+
# check to ensure the input is an array given that the attribute
|
238
|
+
# is documented as an array but the input is not
|
239
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
240
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
241
|
+
end
|
242
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
243
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
244
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
245
|
+
end
|
246
|
+
|
247
|
+
self
|
248
|
+
end
|
249
|
+
|
250
|
+
# Deserializes the data based on type
|
251
|
+
# @param string type Data type
|
252
|
+
# @param string value Value to be deserialized
|
253
|
+
# @return [Object] Deserialized data
|
254
|
+
def _deserialize(type, value)
|
255
|
+
case type.to_sym
|
256
|
+
when :DateTime
|
257
|
+
DateTime.parse(value)
|
258
|
+
when :Date
|
259
|
+
Date.parse(value)
|
260
|
+
when :String
|
261
|
+
value.to_s
|
262
|
+
when :Integer
|
263
|
+
value.to_i
|
264
|
+
when :Float
|
265
|
+
value.to_f
|
266
|
+
when :Boolean
|
267
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
268
|
+
true
|
269
|
+
else
|
270
|
+
false
|
271
|
+
end
|
272
|
+
when :Object
|
273
|
+
# generic object (usually a Hash), return directly
|
274
|
+
value
|
275
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
276
|
+
inner_type = Regexp.last_match[:inner_type]
|
277
|
+
value.map { |v| _deserialize(inner_type, v) }
|
278
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
279
|
+
k_type = Regexp.last_match[:k_type]
|
280
|
+
v_type = Regexp.last_match[:v_type]
|
281
|
+
{}.tap do |hash|
|
282
|
+
value.each do |k, v|
|
283
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
else # model
|
287
|
+
OryHydraClient.const_get(type).build_from_hash(value)
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
# Returns the string representation of the object
|
292
|
+
# @return [String] String presentation of the object
|
293
|
+
def to_s
|
294
|
+
to_hash.to_s
|
295
|
+
end
|
296
|
+
|
297
|
+
# to_body is an alias to to_hash (backward compatibility)
|
298
|
+
# @return [Hash] Returns the object in the form of hash
|
299
|
+
def to_body
|
300
|
+
to_hash
|
301
|
+
end
|
302
|
+
|
303
|
+
# Returns the object in the form of hash
|
304
|
+
# @return [Hash] Returns the object in the form of hash
|
305
|
+
def to_hash
|
306
|
+
hash = {}
|
307
|
+
self.class.attribute_map.each_pair do |attr, param|
|
308
|
+
value = self.send(attr)
|
309
|
+
if value.nil?
|
310
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
311
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
312
|
+
end
|
313
|
+
|
314
|
+
hash[param] = _to_hash(value)
|
315
|
+
end
|
316
|
+
hash
|
317
|
+
end
|
318
|
+
|
319
|
+
# Outputs non-array value in the form of hash
|
320
|
+
# For object, use to_hash. Otherwise, just return the value
|
321
|
+
# @param [Object] value Any valid value
|
322
|
+
# @return [Hash] Returns the value in the form of hash
|
323
|
+
def _to_hash(value)
|
324
|
+
if value.is_a?(Array)
|
325
|
+
value.compact.map { |v| _to_hash(v) }
|
326
|
+
elsif value.is_a?(Hash)
|
327
|
+
{}.tap do |hash|
|
328
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
329
|
+
end
|
330
|
+
elsif value.respond_to? :to_hash
|
331
|
+
value.to_hash
|
332
|
+
else
|
333
|
+
value
|
334
|
+
end
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|
@@ -0,0 +1,252 @@
|
|
1
|
+
=begin
|
2
|
+
#ORY Hydra
|
3
|
+
|
4
|
+
#Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v0.0.0-alpha.39
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module OryHydraClient
|
16
|
+
# The Access Token Response
|
17
|
+
class Oauth2TokenResponse
|
18
|
+
attr_accessor :access_token
|
19
|
+
|
20
|
+
attr_accessor :expires_in
|
21
|
+
|
22
|
+
attr_accessor :id_token
|
23
|
+
|
24
|
+
attr_accessor :refresh_token
|
25
|
+
|
26
|
+
attr_accessor :scope
|
27
|
+
|
28
|
+
attr_accessor :token_type
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:'access_token' => :'access_token',
|
34
|
+
:'expires_in' => :'expires_in',
|
35
|
+
:'id_token' => :'id_token',
|
36
|
+
:'refresh_token' => :'refresh_token',
|
37
|
+
:'scope' => :'scope',
|
38
|
+
:'token_type' => :'token_type'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute type mapping.
|
43
|
+
def self.openapi_types
|
44
|
+
{
|
45
|
+
:'access_token' => :'String',
|
46
|
+
:'expires_in' => :'Integer',
|
47
|
+
:'id_token' => :'String',
|
48
|
+
:'refresh_token' => :'String',
|
49
|
+
:'scope' => :'String',
|
50
|
+
:'token_type' => :'String'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# List of attributes with nullable: true
|
55
|
+
def self.openapi_nullable
|
56
|
+
Set.new([
|
57
|
+
])
|
58
|
+
end
|
59
|
+
|
60
|
+
# Initializes the object
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
62
|
+
def initialize(attributes = {})
|
63
|
+
if (!attributes.is_a?(Hash))
|
64
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::Oauth2TokenResponse` initialize method"
|
65
|
+
end
|
66
|
+
|
67
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
68
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
69
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
70
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::Oauth2TokenResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
71
|
+
end
|
72
|
+
h[k.to_sym] = v
|
73
|
+
}
|
74
|
+
|
75
|
+
if attributes.key?(:'access_token')
|
76
|
+
self.access_token = attributes[:'access_token']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'expires_in')
|
80
|
+
self.expires_in = attributes[:'expires_in']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'id_token')
|
84
|
+
self.id_token = attributes[:'id_token']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'refresh_token')
|
88
|
+
self.refresh_token = attributes[:'refresh_token']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:'scope')
|
92
|
+
self.scope = attributes[:'scope']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:'token_type')
|
96
|
+
self.token_type = attributes[:'token_type']
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
101
|
+
# @return Array for valid properties with the reasons
|
102
|
+
def list_invalid_properties
|
103
|
+
invalid_properties = Array.new
|
104
|
+
invalid_properties
|
105
|
+
end
|
106
|
+
|
107
|
+
# Check to see if the all the properties in the model are valid
|
108
|
+
# @return true if the model is valid
|
109
|
+
def valid?
|
110
|
+
true
|
111
|
+
end
|
112
|
+
|
113
|
+
# Checks equality by comparing each attribute.
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def ==(o)
|
116
|
+
return true if self.equal?(o)
|
117
|
+
self.class == o.class &&
|
118
|
+
access_token == o.access_token &&
|
119
|
+
expires_in == o.expires_in &&
|
120
|
+
id_token == o.id_token &&
|
121
|
+
refresh_token == o.refresh_token &&
|
122
|
+
scope == o.scope &&
|
123
|
+
token_type == o.token_type
|
124
|
+
end
|
125
|
+
|
126
|
+
# @see the `==` method
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def eql?(o)
|
129
|
+
self == o
|
130
|
+
end
|
131
|
+
|
132
|
+
# Calculates hash code according to all attributes.
|
133
|
+
# @return [Integer] Hash code
|
134
|
+
def hash
|
135
|
+
[access_token, expires_in, id_token, refresh_token, scope, token_type].hash
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def self.build_from_hash(attributes)
|
142
|
+
new.build_from_hash(attributes)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Builds the object from hash
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
147
|
+
# @return [Object] Returns the model itself
|
148
|
+
def build_from_hash(attributes)
|
149
|
+
return nil unless attributes.is_a?(Hash)
|
150
|
+
self.class.openapi_types.each_pair do |key, type|
|
151
|
+
if type =~ /\AArray<(.*)>/i
|
152
|
+
# check to ensure the input is an array given that the attribute
|
153
|
+
# is documented as an array but the input is not
|
154
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
155
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
156
|
+
end
|
157
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
158
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
159
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
160
|
+
end
|
161
|
+
|
162
|
+
self
|
163
|
+
end
|
164
|
+
|
165
|
+
# Deserializes the data based on type
|
166
|
+
# @param string type Data type
|
167
|
+
# @param string value Value to be deserialized
|
168
|
+
# @return [Object] Deserialized data
|
169
|
+
def _deserialize(type, value)
|
170
|
+
case type.to_sym
|
171
|
+
when :DateTime
|
172
|
+
DateTime.parse(value)
|
173
|
+
when :Date
|
174
|
+
Date.parse(value)
|
175
|
+
when :String
|
176
|
+
value.to_s
|
177
|
+
when :Integer
|
178
|
+
value.to_i
|
179
|
+
when :Float
|
180
|
+
value.to_f
|
181
|
+
when :Boolean
|
182
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
183
|
+
true
|
184
|
+
else
|
185
|
+
false
|
186
|
+
end
|
187
|
+
when :Object
|
188
|
+
# generic object (usually a Hash), return directly
|
189
|
+
value
|
190
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
191
|
+
inner_type = Regexp.last_match[:inner_type]
|
192
|
+
value.map { |v| _deserialize(inner_type, v) }
|
193
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
194
|
+
k_type = Regexp.last_match[:k_type]
|
195
|
+
v_type = Regexp.last_match[:v_type]
|
196
|
+
{}.tap do |hash|
|
197
|
+
value.each do |k, v|
|
198
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
else # model
|
202
|
+
OryHydraClient.const_get(type).build_from_hash(value)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns the string representation of the object
|
207
|
+
# @return [String] String presentation of the object
|
208
|
+
def to_s
|
209
|
+
to_hash.to_s
|
210
|
+
end
|
211
|
+
|
212
|
+
# to_body is an alias to to_hash (backward compatibility)
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
214
|
+
def to_body
|
215
|
+
to_hash
|
216
|
+
end
|
217
|
+
|
218
|
+
# Returns the object in the form of hash
|
219
|
+
# @return [Hash] Returns the object in the form of hash
|
220
|
+
def to_hash
|
221
|
+
hash = {}
|
222
|
+
self.class.attribute_map.each_pair do |attr, param|
|
223
|
+
value = self.send(attr)
|
224
|
+
if value.nil?
|
225
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
226
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
227
|
+
end
|
228
|
+
|
229
|
+
hash[param] = _to_hash(value)
|
230
|
+
end
|
231
|
+
hash
|
232
|
+
end
|
233
|
+
|
234
|
+
# Outputs non-array value in the form of hash
|
235
|
+
# For object, use to_hash. Otherwise, just return the value
|
236
|
+
# @param [Object] value Any valid value
|
237
|
+
# @return [Hash] Returns the value in the form of hash
|
238
|
+
def _to_hash(value)
|
239
|
+
if value.is_a?(Array)
|
240
|
+
value.compact.map { |v| _to_hash(v) }
|
241
|
+
elsif value.is_a?(Hash)
|
242
|
+
{}.tap do |hash|
|
243
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
244
|
+
end
|
245
|
+
elsif value.respond_to? :to_hash
|
246
|
+
value.to_hash
|
247
|
+
else
|
248
|
+
value
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|