ory-hydra-client 1.2.0.alpha2 → 1.2.0.alpha3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,683 +0,0 @@
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: latest
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
- class Certificate
17
- # authority key Id
18
- attr_accessor :authority_key_id
19
-
20
- # BasicConstraintsValid indicates whether IsCA, MaxPathLen, and MaxPathLenZero are valid.
21
- attr_accessor :basic_constraints_valid
22
-
23
- # CRL Distribution Points
24
- attr_accessor :crl_distribution_points
25
-
26
- # Subject Alternate Name values. (Note that these values may not be valid if invalid values were contained within a parsed certificate. For example, an element of DNSNames may not be a valid DNS domain name.)
27
- attr_accessor :dns_names
28
-
29
- # email addresses
30
- attr_accessor :email_addresses
31
-
32
- # excluded DNS domains
33
- attr_accessor :excluded_dns_domains
34
-
35
- # excluded email addresses
36
- attr_accessor :excluded_email_addresses
37
-
38
- # excluded IP ranges
39
- attr_accessor :excluded_ip_ranges
40
-
41
- # excluded URI domains
42
- attr_accessor :excluded_uri_domains
43
-
44
- # ext key usage
45
- attr_accessor :ext_key_usage
46
-
47
- # Extensions contains raw X.509 extensions. When parsing certificates, this can be used to extract non-critical extensions that are not parsed by this package. When marshaling certificates, the Extensions field is ignored, see ExtraExtensions.
48
- attr_accessor :extensions
49
-
50
- # ExtraExtensions contains extensions to be copied, raw, into any marshaled certificates. Values override any extensions that would otherwise be produced based on the other fields. The ExtraExtensions field is not populated when parsing certificates, see Extensions.
51
- attr_accessor :extra_extensions
52
-
53
- # IP addresses
54
- attr_accessor :ip_addresses
55
-
56
- # is c a
57
- attr_accessor :is_ca
58
-
59
- attr_accessor :issuer
60
-
61
- # issuing certificate URL
62
- attr_accessor :issuing_certificate_url
63
-
64
- # KeyUsage KeyUsage KeyUsage KeyUsage represents the set of actions that are valid for a given key. It's a bitmap of the KeyUsage* constants.
65
- attr_accessor :key_usage
66
-
67
- # MaxPathLen and MaxPathLenZero indicate the presence and value of the BasicConstraints' \"pathLenConstraint\". When parsing a certificate, a positive non-zero MaxPathLen means that the field was specified, -1 means it was unset, and MaxPathLenZero being true mean that the field was explicitly set to zero. The case of MaxPathLen==0 with MaxPathLenZero==false should be treated equivalent to -1 (unset). When generating a certificate, an unset pathLenConstraint can be requested with either MaxPathLen == -1 or using the zero value for both MaxPathLen and MaxPathLenZero.
68
- attr_accessor :max_path_len
69
-
70
- # MaxPathLenZero indicates that BasicConstraintsValid==true and MaxPathLen==0 should be interpreted as an actual maximum path length of zero. Otherwise, that combination is interpreted as MaxPathLen not being set.
71
- attr_accessor :max_path_len_zero
72
-
73
- # not before Format: date-time Format: date-time Format: date-time
74
- attr_accessor :not_before
75
-
76
- # RFC 5280, 4.2.2.1 (Authority Information Access)
77
- attr_accessor :ocsp_server
78
-
79
- # permitted DNS domains
80
- attr_accessor :permitted_dns_domains
81
-
82
- # Name constraints
83
- attr_accessor :permitted_dns_domains_critical
84
-
85
- # permitted email addresses
86
- attr_accessor :permitted_email_addresses
87
-
88
- # permitted IP ranges
89
- attr_accessor :permitted_ip_ranges
90
-
91
- # permitted URI domains
92
- attr_accessor :permitted_uri_domains
93
-
94
- # policy identifiers
95
- attr_accessor :policy_identifiers
96
-
97
- # public key
98
- attr_accessor :public_key
99
-
100
- # PublicKeyAlgorithm PublicKeyAlgorithm PublicKeyAlgorithm public key algorithm
101
- attr_accessor :public_key_algorithm
102
-
103
- # raw
104
- attr_accessor :raw
105
-
106
- # raw issuer
107
- attr_accessor :raw_issuer
108
-
109
- # raw subject
110
- attr_accessor :raw_subject
111
-
112
- # raw subject public key info
113
- attr_accessor :raw_subject_public_key_info
114
-
115
- # raw t b s certificate
116
- attr_accessor :raw_tbs_certificate
117
-
118
- # Operations always take pointer arguments (*Int) rather than Int values, and each unique Int value requires its own unique *Int pointer. To \"copy\" an Int value, an existing (or newly allocated) Int must be set to a new value using the Int.Set method; shallow copies of Ints are not supported and may lead to errors.
119
- attr_accessor :serial_number
120
-
121
- # signature
122
- attr_accessor :signature
123
-
124
- # SignatureAlgorithm SignatureAlgorithm SignatureAlgorithm signature algorithm
125
- attr_accessor :signature_algorithm
126
-
127
- attr_accessor :subject
128
-
129
- # subject key Id
130
- attr_accessor :subject_key_id
131
-
132
- # u r is
133
- attr_accessor :ur_is
134
-
135
- # UnhandledCriticalExtensions contains a list of extension IDs that were not (fully) processed when parsing. Verify will fail if this slice is non-empty, unless verification is delegated to an OS library which understands all the critical extensions. Users can access these extensions using Extensions and can remove elements from this slice if they believe that they have been handled.
136
- attr_accessor :unhandled_critical_extensions
137
-
138
- # unknown ext key usage
139
- attr_accessor :unknown_ext_key_usage
140
-
141
- # version
142
- attr_accessor :version
143
-
144
- # Attribute mapping from ruby-style variable name to JSON key.
145
- def self.attribute_map
146
- {
147
- :'authority_key_id' => :'AuthorityKeyId',
148
- :'basic_constraints_valid' => :'BasicConstraintsValid',
149
- :'crl_distribution_points' => :'CRLDistributionPoints',
150
- :'dns_names' => :'DNSNames',
151
- :'email_addresses' => :'EmailAddresses',
152
- :'excluded_dns_domains' => :'ExcludedDNSDomains',
153
- :'excluded_email_addresses' => :'ExcludedEmailAddresses',
154
- :'excluded_ip_ranges' => :'ExcludedIPRanges',
155
- :'excluded_uri_domains' => :'ExcludedURIDomains',
156
- :'ext_key_usage' => :'ExtKeyUsage',
157
- :'extensions' => :'Extensions',
158
- :'extra_extensions' => :'ExtraExtensions',
159
- :'ip_addresses' => :'IPAddresses',
160
- :'is_ca' => :'IsCA',
161
- :'issuer' => :'Issuer',
162
- :'issuing_certificate_url' => :'IssuingCertificateURL',
163
- :'key_usage' => :'KeyUsage',
164
- :'max_path_len' => :'MaxPathLen',
165
- :'max_path_len_zero' => :'MaxPathLenZero',
166
- :'not_before' => :'NotBefore',
167
- :'ocsp_server' => :'OCSPServer',
168
- :'permitted_dns_domains' => :'PermittedDNSDomains',
169
- :'permitted_dns_domains_critical' => :'PermittedDNSDomainsCritical',
170
- :'permitted_email_addresses' => :'PermittedEmailAddresses',
171
- :'permitted_ip_ranges' => :'PermittedIPRanges',
172
- :'permitted_uri_domains' => :'PermittedURIDomains',
173
- :'policy_identifiers' => :'PolicyIdentifiers',
174
- :'public_key' => :'PublicKey',
175
- :'public_key_algorithm' => :'PublicKeyAlgorithm',
176
- :'raw' => :'Raw',
177
- :'raw_issuer' => :'RawIssuer',
178
- :'raw_subject' => :'RawSubject',
179
- :'raw_subject_public_key_info' => :'RawSubjectPublicKeyInfo',
180
- :'raw_tbs_certificate' => :'RawTBSCertificate',
181
- :'serial_number' => :'SerialNumber',
182
- :'signature' => :'Signature',
183
- :'signature_algorithm' => :'SignatureAlgorithm',
184
- :'subject' => :'Subject',
185
- :'subject_key_id' => :'SubjectKeyId',
186
- :'ur_is' => :'URIs',
187
- :'unhandled_critical_extensions' => :'UnhandledCriticalExtensions',
188
- :'unknown_ext_key_usage' => :'UnknownExtKeyUsage',
189
- :'version' => :'Version'
190
- }
191
- end
192
-
193
- # Attribute type mapping.
194
- def self.openapi_types
195
- {
196
- :'authority_key_id' => :'Array<Integer>',
197
- :'basic_constraints_valid' => :'Boolean',
198
- :'crl_distribution_points' => :'Array<String>',
199
- :'dns_names' => :'Array<String>',
200
- :'email_addresses' => :'Array<String>',
201
- :'excluded_dns_domains' => :'Array<String>',
202
- :'excluded_email_addresses' => :'Array<String>',
203
- :'excluded_ip_ranges' => :'Array<IPNet>',
204
- :'excluded_uri_domains' => :'Array<String>',
205
- :'ext_key_usage' => :'Array<Integer>',
206
- :'extensions' => :'Array<Extension>',
207
- :'extra_extensions' => :'Array<Extension>',
208
- :'ip_addresses' => :'Array<Array>',
209
- :'is_ca' => :'Boolean',
210
- :'issuer' => :'Name',
211
- :'issuing_certificate_url' => :'Array<String>',
212
- :'key_usage' => :'Integer',
213
- :'max_path_len' => :'Integer',
214
- :'max_path_len_zero' => :'Boolean',
215
- :'not_before' => :'DateTime',
216
- :'ocsp_server' => :'Array<String>',
217
- :'permitted_dns_domains' => :'Array<String>',
218
- :'permitted_dns_domains_critical' => :'Boolean',
219
- :'permitted_email_addresses' => :'Array<String>',
220
- :'permitted_ip_ranges' => :'Array<IPNet>',
221
- :'permitted_uri_domains' => :'Array<String>',
222
- :'policy_identifiers' => :'Array<Array>',
223
- :'public_key' => :'Object',
224
- :'public_key_algorithm' => :'Integer',
225
- :'raw' => :'Array<Integer>',
226
- :'raw_issuer' => :'Array<Integer>',
227
- :'raw_subject' => :'Array<Integer>',
228
- :'raw_subject_public_key_info' => :'Array<Integer>',
229
- :'raw_tbs_certificate' => :'Array<Integer>',
230
- :'serial_number' => :'Object',
231
- :'signature' => :'Array<Integer>',
232
- :'signature_algorithm' => :'Integer',
233
- :'subject' => :'Name',
234
- :'subject_key_id' => :'Array<Integer>',
235
- :'ur_is' => :'Array<URL>',
236
- :'unhandled_critical_extensions' => :'Array<Array>',
237
- :'unknown_ext_key_usage' => :'Array<Array>',
238
- :'version' => :'Integer'
239
- }
240
- end
241
-
242
- # List of attributes with nullable: true
243
- def self.openapi_nullable
244
- Set.new([
245
- ])
246
- end
247
-
248
- # Initializes the object
249
- # @param [Hash] attributes Model attributes in the form of hash
250
- def initialize(attributes = {})
251
- if (!attributes.is_a?(Hash))
252
- fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::Certificate` initialize method"
253
- end
254
-
255
- # check to see if the attribute exists and convert string to symbol for hash key
256
- attributes = attributes.each_with_object({}) { |(k, v), h|
257
- if (!self.class.attribute_map.key?(k.to_sym))
258
- fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::Certificate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
259
- end
260
- h[k.to_sym] = v
261
- }
262
-
263
- if attributes.key?(:'authority_key_id')
264
- if (value = attributes[:'authority_key_id']).is_a?(Array)
265
- self.authority_key_id = value
266
- end
267
- end
268
-
269
- if attributes.key?(:'basic_constraints_valid')
270
- self.basic_constraints_valid = attributes[:'basic_constraints_valid']
271
- end
272
-
273
- if attributes.key?(:'crl_distribution_points')
274
- if (value = attributes[:'crl_distribution_points']).is_a?(Array)
275
- self.crl_distribution_points = value
276
- end
277
- end
278
-
279
- if attributes.key?(:'dns_names')
280
- if (value = attributes[:'dns_names']).is_a?(Array)
281
- self.dns_names = value
282
- end
283
- end
284
-
285
- if attributes.key?(:'email_addresses')
286
- if (value = attributes[:'email_addresses']).is_a?(Array)
287
- self.email_addresses = value
288
- end
289
- end
290
-
291
- if attributes.key?(:'excluded_dns_domains')
292
- if (value = attributes[:'excluded_dns_domains']).is_a?(Array)
293
- self.excluded_dns_domains = value
294
- end
295
- end
296
-
297
- if attributes.key?(:'excluded_email_addresses')
298
- if (value = attributes[:'excluded_email_addresses']).is_a?(Array)
299
- self.excluded_email_addresses = value
300
- end
301
- end
302
-
303
- if attributes.key?(:'excluded_ip_ranges')
304
- if (value = attributes[:'excluded_ip_ranges']).is_a?(Array)
305
- self.excluded_ip_ranges = value
306
- end
307
- end
308
-
309
- if attributes.key?(:'excluded_uri_domains')
310
- if (value = attributes[:'excluded_uri_domains']).is_a?(Array)
311
- self.excluded_uri_domains = value
312
- end
313
- end
314
-
315
- if attributes.key?(:'ext_key_usage')
316
- if (value = attributes[:'ext_key_usage']).is_a?(Array)
317
- self.ext_key_usage = value
318
- end
319
- end
320
-
321
- if attributes.key?(:'extensions')
322
- if (value = attributes[:'extensions']).is_a?(Array)
323
- self.extensions = value
324
- end
325
- end
326
-
327
- if attributes.key?(:'extra_extensions')
328
- if (value = attributes[:'extra_extensions']).is_a?(Array)
329
- self.extra_extensions = value
330
- end
331
- end
332
-
333
- if attributes.key?(:'ip_addresses')
334
- if (value = attributes[:'ip_addresses']).is_a?(Array)
335
- self.ip_addresses = value
336
- end
337
- end
338
-
339
- if attributes.key?(:'is_ca')
340
- self.is_ca = attributes[:'is_ca']
341
- end
342
-
343
- if attributes.key?(:'issuer')
344
- self.issuer = attributes[:'issuer']
345
- end
346
-
347
- if attributes.key?(:'issuing_certificate_url')
348
- if (value = attributes[:'issuing_certificate_url']).is_a?(Array)
349
- self.issuing_certificate_url = value
350
- end
351
- end
352
-
353
- if attributes.key?(:'key_usage')
354
- self.key_usage = attributes[:'key_usage']
355
- end
356
-
357
- if attributes.key?(:'max_path_len')
358
- self.max_path_len = attributes[:'max_path_len']
359
- end
360
-
361
- if attributes.key?(:'max_path_len_zero')
362
- self.max_path_len_zero = attributes[:'max_path_len_zero']
363
- end
364
-
365
- if attributes.key?(:'not_before')
366
- self.not_before = attributes[:'not_before']
367
- end
368
-
369
- if attributes.key?(:'ocsp_server')
370
- if (value = attributes[:'ocsp_server']).is_a?(Array)
371
- self.ocsp_server = value
372
- end
373
- end
374
-
375
- if attributes.key?(:'permitted_dns_domains')
376
- if (value = attributes[:'permitted_dns_domains']).is_a?(Array)
377
- self.permitted_dns_domains = value
378
- end
379
- end
380
-
381
- if attributes.key?(:'permitted_dns_domains_critical')
382
- self.permitted_dns_domains_critical = attributes[:'permitted_dns_domains_critical']
383
- end
384
-
385
- if attributes.key?(:'permitted_email_addresses')
386
- if (value = attributes[:'permitted_email_addresses']).is_a?(Array)
387
- self.permitted_email_addresses = value
388
- end
389
- end
390
-
391
- if attributes.key?(:'permitted_ip_ranges')
392
- if (value = attributes[:'permitted_ip_ranges']).is_a?(Array)
393
- self.permitted_ip_ranges = value
394
- end
395
- end
396
-
397
- if attributes.key?(:'permitted_uri_domains')
398
- if (value = attributes[:'permitted_uri_domains']).is_a?(Array)
399
- self.permitted_uri_domains = value
400
- end
401
- end
402
-
403
- if attributes.key?(:'policy_identifiers')
404
- if (value = attributes[:'policy_identifiers']).is_a?(Array)
405
- self.policy_identifiers = value
406
- end
407
- end
408
-
409
- if attributes.key?(:'public_key')
410
- self.public_key = attributes[:'public_key']
411
- end
412
-
413
- if attributes.key?(:'public_key_algorithm')
414
- self.public_key_algorithm = attributes[:'public_key_algorithm']
415
- end
416
-
417
- if attributes.key?(:'raw')
418
- if (value = attributes[:'raw']).is_a?(Array)
419
- self.raw = value
420
- end
421
- end
422
-
423
- if attributes.key?(:'raw_issuer')
424
- if (value = attributes[:'raw_issuer']).is_a?(Array)
425
- self.raw_issuer = value
426
- end
427
- end
428
-
429
- if attributes.key?(:'raw_subject')
430
- if (value = attributes[:'raw_subject']).is_a?(Array)
431
- self.raw_subject = value
432
- end
433
- end
434
-
435
- if attributes.key?(:'raw_subject_public_key_info')
436
- if (value = attributes[:'raw_subject_public_key_info']).is_a?(Array)
437
- self.raw_subject_public_key_info = value
438
- end
439
- end
440
-
441
- if attributes.key?(:'raw_tbs_certificate')
442
- if (value = attributes[:'raw_tbs_certificate']).is_a?(Array)
443
- self.raw_tbs_certificate = value
444
- end
445
- end
446
-
447
- if attributes.key?(:'serial_number')
448
- self.serial_number = attributes[:'serial_number']
449
- end
450
-
451
- if attributes.key?(:'signature')
452
- if (value = attributes[:'signature']).is_a?(Array)
453
- self.signature = value
454
- end
455
- end
456
-
457
- if attributes.key?(:'signature_algorithm')
458
- self.signature_algorithm = attributes[:'signature_algorithm']
459
- end
460
-
461
- if attributes.key?(:'subject')
462
- self.subject = attributes[:'subject']
463
- end
464
-
465
- if attributes.key?(:'subject_key_id')
466
- if (value = attributes[:'subject_key_id']).is_a?(Array)
467
- self.subject_key_id = value
468
- end
469
- end
470
-
471
- if attributes.key?(:'ur_is')
472
- if (value = attributes[:'ur_is']).is_a?(Array)
473
- self.ur_is = value
474
- end
475
- end
476
-
477
- if attributes.key?(:'unhandled_critical_extensions')
478
- if (value = attributes[:'unhandled_critical_extensions']).is_a?(Array)
479
- self.unhandled_critical_extensions = value
480
- end
481
- end
482
-
483
- if attributes.key?(:'unknown_ext_key_usage')
484
- if (value = attributes[:'unknown_ext_key_usage']).is_a?(Array)
485
- self.unknown_ext_key_usage = value
486
- end
487
- end
488
-
489
- if attributes.key?(:'version')
490
- self.version = attributes[:'version']
491
- end
492
- end
493
-
494
- # Show invalid properties with the reasons. Usually used together with valid?
495
- # @return Array for valid properties with the reasons
496
- def list_invalid_properties
497
- invalid_properties = Array.new
498
- invalid_properties
499
- end
500
-
501
- # Check to see if the all the properties in the model are valid
502
- # @return true if the model is valid
503
- def valid?
504
- true
505
- end
506
-
507
- # Checks equality by comparing each attribute.
508
- # @param [Object] Object to be compared
509
- def ==(o)
510
- return true if self.equal?(o)
511
- self.class == o.class &&
512
- authority_key_id == o.authority_key_id &&
513
- basic_constraints_valid == o.basic_constraints_valid &&
514
- crl_distribution_points == o.crl_distribution_points &&
515
- dns_names == o.dns_names &&
516
- email_addresses == o.email_addresses &&
517
- excluded_dns_domains == o.excluded_dns_domains &&
518
- excluded_email_addresses == o.excluded_email_addresses &&
519
- excluded_ip_ranges == o.excluded_ip_ranges &&
520
- excluded_uri_domains == o.excluded_uri_domains &&
521
- ext_key_usage == o.ext_key_usage &&
522
- extensions == o.extensions &&
523
- extra_extensions == o.extra_extensions &&
524
- ip_addresses == o.ip_addresses &&
525
- is_ca == o.is_ca &&
526
- issuer == o.issuer &&
527
- issuing_certificate_url == o.issuing_certificate_url &&
528
- key_usage == o.key_usage &&
529
- max_path_len == o.max_path_len &&
530
- max_path_len_zero == o.max_path_len_zero &&
531
- not_before == o.not_before &&
532
- ocsp_server == o.ocsp_server &&
533
- permitted_dns_domains == o.permitted_dns_domains &&
534
- permitted_dns_domains_critical == o.permitted_dns_domains_critical &&
535
- permitted_email_addresses == o.permitted_email_addresses &&
536
- permitted_ip_ranges == o.permitted_ip_ranges &&
537
- permitted_uri_domains == o.permitted_uri_domains &&
538
- policy_identifiers == o.policy_identifiers &&
539
- public_key == o.public_key &&
540
- public_key_algorithm == o.public_key_algorithm &&
541
- raw == o.raw &&
542
- raw_issuer == o.raw_issuer &&
543
- raw_subject == o.raw_subject &&
544
- raw_subject_public_key_info == o.raw_subject_public_key_info &&
545
- raw_tbs_certificate == o.raw_tbs_certificate &&
546
- serial_number == o.serial_number &&
547
- signature == o.signature &&
548
- signature_algorithm == o.signature_algorithm &&
549
- subject == o.subject &&
550
- subject_key_id == o.subject_key_id &&
551
- ur_is == o.ur_is &&
552
- unhandled_critical_extensions == o.unhandled_critical_extensions &&
553
- unknown_ext_key_usage == o.unknown_ext_key_usage &&
554
- version == o.version
555
- end
556
-
557
- # @see the `==` method
558
- # @param [Object] Object to be compared
559
- def eql?(o)
560
- self == o
561
- end
562
-
563
- # Calculates hash code according to all attributes.
564
- # @return [Integer] Hash code
565
- def hash
566
- [authority_key_id, basic_constraints_valid, crl_distribution_points, dns_names, email_addresses, excluded_dns_domains, excluded_email_addresses, excluded_ip_ranges, excluded_uri_domains, ext_key_usage, extensions, extra_extensions, ip_addresses, is_ca, issuer, issuing_certificate_url, key_usage, max_path_len, max_path_len_zero, not_before, ocsp_server, permitted_dns_domains, permitted_dns_domains_critical, permitted_email_addresses, permitted_ip_ranges, permitted_uri_domains, policy_identifiers, public_key, public_key_algorithm, raw, raw_issuer, raw_subject, raw_subject_public_key_info, raw_tbs_certificate, serial_number, signature, signature_algorithm, subject, subject_key_id, ur_is, unhandled_critical_extensions, unknown_ext_key_usage, version].hash
567
- end
568
-
569
- # Builds the object from hash
570
- # @param [Hash] attributes Model attributes in the form of hash
571
- # @return [Object] Returns the model itself
572
- def self.build_from_hash(attributes)
573
- new.build_from_hash(attributes)
574
- end
575
-
576
- # Builds the object from hash
577
- # @param [Hash] attributes Model attributes in the form of hash
578
- # @return [Object] Returns the model itself
579
- def build_from_hash(attributes)
580
- return nil unless attributes.is_a?(Hash)
581
- self.class.openapi_types.each_pair do |key, type|
582
- if type =~ /\AArray<(.*)>/i
583
- # check to ensure the input is an array given that the attribute
584
- # is documented as an array but the input is not
585
- if attributes[self.class.attribute_map[key]].is_a?(Array)
586
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
587
- end
588
- elsif !attributes[self.class.attribute_map[key]].nil?
589
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
590
- end # or else data not found in attributes(hash), not an issue as the data can be optional
591
- end
592
-
593
- self
594
- end
595
-
596
- # Deserializes the data based on type
597
- # @param string type Data type
598
- # @param string value Value to be deserialized
599
- # @return [Object] Deserialized data
600
- def _deserialize(type, value)
601
- case type.to_sym
602
- when :DateTime
603
- DateTime.parse(value)
604
- when :Date
605
- Date.parse(value)
606
- when :String
607
- value.to_s
608
- when :Integer
609
- value.to_i
610
- when :Float
611
- value.to_f
612
- when :Boolean
613
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
614
- true
615
- else
616
- false
617
- end
618
- when :Object
619
- # generic object (usually a Hash), return directly
620
- value
621
- when /\AArray<(?<inner_type>.+)>\z/
622
- inner_type = Regexp.last_match[:inner_type]
623
- value.map { |v| _deserialize(inner_type, v) }
624
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
625
- k_type = Regexp.last_match[:k_type]
626
- v_type = Regexp.last_match[:v_type]
627
- {}.tap do |hash|
628
- value.each do |k, v|
629
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
630
- end
631
- end
632
- else # model
633
- OryHydraClient.const_get(type).build_from_hash(value)
634
- end
635
- end
636
-
637
- # Returns the string representation of the object
638
- # @return [String] String presentation of the object
639
- def to_s
640
- to_hash.to_s
641
- end
642
-
643
- # to_body is an alias to to_hash (backward compatibility)
644
- # @return [Hash] Returns the object in the form of hash
645
- def to_body
646
- to_hash
647
- end
648
-
649
- # Returns the object in the form of hash
650
- # @return [Hash] Returns the object in the form of hash
651
- def to_hash
652
- hash = {}
653
- self.class.attribute_map.each_pair do |attr, param|
654
- value = self.send(attr)
655
- if value.nil?
656
- is_nullable = self.class.openapi_nullable.include?(attr)
657
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
658
- end
659
-
660
- hash[param] = _to_hash(value)
661
- end
662
- hash
663
- end
664
-
665
- # Outputs non-array value in the form of hash
666
- # For object, use to_hash. Otherwise, just return the value
667
- # @param [Object] value Any valid value
668
- # @return [Hash] Returns the value in the form of hash
669
- def _to_hash(value)
670
- if value.is_a?(Array)
671
- value.compact.map { |v| _to_hash(v) }
672
- elsif value.is_a?(Hash)
673
- {}.tap do |hash|
674
- value.each { |k, v| hash[k] = _to_hash(v) }
675
- end
676
- elsif value.respond_to? :to_hash
677
- value.to_hash
678
- else
679
- value
680
- end
681
- end
682
- end
683
- end