ory-hydra-client 0.0.0.alpha39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +165 -0
  4. data/Rakefile +10 -0
  5. data/docs/AcceptConsentRequest.md +25 -0
  6. data/docs/AcceptLoginRequest.md +27 -0
  7. data/docs/AdminApi.md +1443 -0
  8. data/docs/CompletedRequest.md +17 -0
  9. data/docs/ConsentRequest.md +39 -0
  10. data/docs/ConsentRequestSession.md +19 -0
  11. data/docs/FlushInactiveOAuth2TokensRequest.md +17 -0
  12. data/docs/GenericError.md +23 -0
  13. data/docs/HealthNotReadyStatus.md +17 -0
  14. data/docs/HealthStatus.md +17 -0
  15. data/docs/JSONWebKey.md +49 -0
  16. data/docs/JSONWebKeySet.md +17 -0
  17. data/docs/JsonWebKeySetGeneratorRequest.md +21 -0
  18. data/docs/LoginRequest.md +33 -0
  19. data/docs/LogoutRequest.md +23 -0
  20. data/docs/OAuth2Client.md +79 -0
  21. data/docs/OAuth2TokenIntrospection.md +41 -0
  22. data/docs/Oauth2TokenResponse.md +27 -0
  23. data/docs/OauthTokenResponse.md +27 -0
  24. data/docs/OpenIDConnectContext.md +25 -0
  25. data/docs/PreviousConsentSession.md +27 -0
  26. data/docs/PublicApi.md +398 -0
  27. data/docs/RejectRequest.md +25 -0
  28. data/docs/UserinfoResponse.md +53 -0
  29. data/docs/Version.md +17 -0
  30. data/docs/WellKnown.md +65 -0
  31. data/lib/ory-hydra-client.rb +65 -0
  32. data/lib/ory-hydra-client/api/admin_api.rb +1879 -0
  33. data/lib/ory-hydra-client/api/public_api.rb +498 -0
  34. data/lib/ory-hydra-client/api_client.rb +386 -0
  35. data/lib/ory-hydra-client/api_error.rb +57 -0
  36. data/lib/ory-hydra-client/configuration.rb +255 -0
  37. data/lib/ory-hydra-client/models/accept_consent_request.rb +250 -0
  38. data/lib/ory-hydra-client/models/accept_login_request.rb +264 -0
  39. data/lib/ory-hydra-client/models/completed_request.rb +207 -0
  40. data/lib/ory-hydra-client/models/consent_request.rb +321 -0
  41. data/lib/ory-hydra-client/models/consent_request_session.rb +221 -0
  42. data/lib/ory-hydra-client/models/flush_inactive_o_auth2_tokens_request.rb +207 -0
  43. data/lib/ory-hydra-client/models/generic_error.rb +243 -0
  44. data/lib/ory-hydra-client/models/health_not_ready_status.rb +209 -0
  45. data/lib/ory-hydra-client/models/health_status.rb +207 -0
  46. data/lib/ory-hydra-client/models/json_web_key.rb +377 -0
  47. data/lib/ory-hydra-client/models/json_web_key_set.rb +209 -0
  48. data/lib/ory-hydra-client/models/json_web_key_set_generator_request.rb +242 -0
  49. data/lib/ory-hydra-client/models/login_request.rb +289 -0
  50. data/lib/ory-hydra-client/models/logout_request.rb +237 -0
  51. data/lib/ory-hydra-client/models/o_auth2_client.rb +551 -0
  52. data/lib/ory-hydra-client/models/o_auth2_token_introspection.rb +337 -0
  53. data/lib/ory-hydra-client/models/oauth2_token_response.rb +252 -0
  54. data/lib/ory-hydra-client/models/oauth_token_response.rb +258 -0
  55. data/lib/ory-hydra-client/models/open_id_connect_context.rb +253 -0
  56. data/lib/ory-hydra-client/models/previous_consent_session.rb +260 -0
  57. data/lib/ory-hydra-client/models/reject_request.rb +242 -0
  58. data/lib/ory-hydra-client/models/userinfo_response.rb +388 -0
  59. data/lib/ory-hydra-client/models/version.rb +207 -0
  60. data/lib/ory-hydra-client/models/well_known.rb +501 -0
  61. data/lib/ory-hydra-client/version.rb +15 -0
  62. data/ory-hydra-client.gemspec +39 -0
  63. data/spec/api/admin_api_spec.rb +395 -0
  64. data/spec/api/public_api_spec.rb +129 -0
  65. data/spec/api_client_spec.rb +226 -0
  66. data/spec/configuration_spec.rb +42 -0
  67. data/spec/models/accept_consent_request_spec.rb +65 -0
  68. data/spec/models/accept_login_request_spec.rb +71 -0
  69. data/spec/models/completed_request_spec.rb +41 -0
  70. data/spec/models/consent_request_session_spec.rb +47 -0
  71. data/spec/models/consent_request_spec.rb +107 -0
  72. data/spec/models/flush_inactive_o_auth2_tokens_request_spec.rb +41 -0
  73. data/spec/models/generic_error_spec.rb +59 -0
  74. data/spec/models/health_not_ready_status_spec.rb +41 -0
  75. data/spec/models/health_status_spec.rb +41 -0
  76. data/spec/models/json_web_key_set_generator_request_spec.rb +53 -0
  77. data/spec/models/json_web_key_set_spec.rb +41 -0
  78. data/spec/models/json_web_key_spec.rb +137 -0
  79. data/spec/models/login_request_spec.rb +89 -0
  80. data/spec/models/logout_request_spec.rb +59 -0
  81. data/spec/models/o_auth2_client_spec.rb +227 -0
  82. data/spec/models/o_auth2_token_introspection_spec.rb +113 -0
  83. data/spec/models/oauth2_token_response_spec.rb +71 -0
  84. data/spec/models/oauth_token_response_spec.rb +71 -0
  85. data/spec/models/open_id_connect_context_spec.rb +65 -0
  86. data/spec/models/previous_consent_session_spec.rb +71 -0
  87. data/spec/models/reject_request_spec.rb +65 -0
  88. data/spec/models/userinfo_response_spec.rb +149 -0
  89. data/spec/models/version_spec.rb +41 -0
  90. data/spec/models/well_known_spec.rb +185 -0
  91. data/spec/spec_helper.rb +111 -0
  92. metadata +223 -0
@@ -0,0 +1,209 @@
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
+ class HealthNotReadyStatus
17
+ # Errors contains a list of errors that caused the not ready status.
18
+ attr_accessor :errors
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'errors' => :'errors'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'errors' => :'Hash<String, String>'
31
+ }
32
+ end
33
+
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new([
37
+ ])
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ if (!attributes.is_a?(Hash))
44
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::HealthNotReadyStatus` initialize method"
45
+ end
46
+
47
+ # check to see if the attribute exists and convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}) { |(k, v), h|
49
+ if (!self.class.attribute_map.key?(k.to_sym))
50
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::HealthNotReadyStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
+ end
52
+ h[k.to_sym] = v
53
+ }
54
+
55
+ if attributes.key?(:'errors')
56
+ if (value = attributes[:'errors']).is_a?(Hash)
57
+ self.errors = value
58
+ end
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ invalid_properties
67
+ end
68
+
69
+ # Check to see if the all the properties in the model are valid
70
+ # @return true if the model is valid
71
+ def valid?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ errors == o.errors
81
+ end
82
+
83
+ # @see the `==` method
84
+ # @param [Object] Object to be compared
85
+ def eql?(o)
86
+ self == o
87
+ end
88
+
89
+ # Calculates hash code according to all attributes.
90
+ # @return [Integer] Hash code
91
+ def hash
92
+ [errors].hash
93
+ end
94
+
95
+ # Builds the object from hash
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ # @return [Object] Returns the model itself
98
+ def self.build_from_hash(attributes)
99
+ new.build_from_hash(attributes)
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ self.class.openapi_types.each_pair do |key, type|
108
+ if type =~ /\AArray<(.*)>/i
109
+ # check to ensure the input is an array given that the attribute
110
+ # is documented as an array but the input is not
111
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
112
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
113
+ end
114
+ elsif !attributes[self.class.attribute_map[key]].nil?
115
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
117
+ end
118
+
119
+ self
120
+ end
121
+
122
+ # Deserializes the data based on type
123
+ # @param string type Data type
124
+ # @param string value Value to be deserialized
125
+ # @return [Object] Deserialized data
126
+ def _deserialize(type, value)
127
+ case type.to_sym
128
+ when :DateTime
129
+ DateTime.parse(value)
130
+ when :Date
131
+ Date.parse(value)
132
+ when :String
133
+ value.to_s
134
+ when :Integer
135
+ value.to_i
136
+ when :Float
137
+ value.to_f
138
+ when :Boolean
139
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
140
+ true
141
+ else
142
+ false
143
+ end
144
+ when :Object
145
+ # generic object (usually a Hash), return directly
146
+ value
147
+ when /\AArray<(?<inner_type>.+)>\z/
148
+ inner_type = Regexp.last_match[:inner_type]
149
+ value.map { |v| _deserialize(inner_type, v) }
150
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
151
+ k_type = Regexp.last_match[:k_type]
152
+ v_type = Regexp.last_match[:v_type]
153
+ {}.tap do |hash|
154
+ value.each do |k, v|
155
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
156
+ end
157
+ end
158
+ else # model
159
+ OryHydraClient.const_get(type).build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ if value.nil?
182
+ is_nullable = self.class.openapi_nullable.include?(attr)
183
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
184
+ end
185
+
186
+ hash[param] = _to_hash(value)
187
+ end
188
+ hash
189
+ end
190
+
191
+ # Outputs non-array value in the form of hash
192
+ # For object, use to_hash. Otherwise, just return the value
193
+ # @param [Object] value Any valid value
194
+ # @return [Hash] Returns the value in the form of hash
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map { |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to? :to_hash
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
208
+ end
209
+ end
@@ -0,0 +1,207 @@
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
+ class HealthStatus
17
+ # Status always contains \"ok\".
18
+ attr_accessor :status
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'status' => :'status'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'status' => :'String'
31
+ }
32
+ end
33
+
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new([
37
+ ])
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ if (!attributes.is_a?(Hash))
44
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::HealthStatus` initialize method"
45
+ end
46
+
47
+ # check to see if the attribute exists and convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}) { |(k, v), h|
49
+ if (!self.class.attribute_map.key?(k.to_sym))
50
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::HealthStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
+ end
52
+ h[k.to_sym] = v
53
+ }
54
+
55
+ if attributes.key?(:'status')
56
+ self.status = attributes[:'status']
57
+ end
58
+ end
59
+
60
+ # Show invalid properties with the reasons. Usually used together with valid?
61
+ # @return Array for valid properties with the reasons
62
+ def list_invalid_properties
63
+ invalid_properties = Array.new
64
+ invalid_properties
65
+ end
66
+
67
+ # Check to see if the all the properties in the model are valid
68
+ # @return true if the model is valid
69
+ def valid?
70
+ true
71
+ end
72
+
73
+ # Checks equality by comparing each attribute.
74
+ # @param [Object] Object to be compared
75
+ def ==(o)
76
+ return true if self.equal?(o)
77
+ self.class == o.class &&
78
+ status == o.status
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] Object to be compared
83
+ def eql?(o)
84
+ self == o
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Integer] Hash code
89
+ def hash
90
+ [status].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def self.build_from_hash(attributes)
97
+ new.build_from_hash(attributes)
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ self.class.openapi_types.each_pair do |key, type|
106
+ if type =~ /\AArray<(.*)>/i
107
+ # check to ensure the input is an array given that the attribute
108
+ # is documented as an array but the input is not
109
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
110
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
111
+ end
112
+ elsif !attributes[self.class.attribute_map[key]].nil?
113
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
115
+ end
116
+
117
+ self
118
+ end
119
+
120
+ # Deserializes the data based on type
121
+ # @param string type Data type
122
+ # @param string value Value to be deserialized
123
+ # @return [Object] Deserialized data
124
+ def _deserialize(type, value)
125
+ case type.to_sym
126
+ when :DateTime
127
+ DateTime.parse(value)
128
+ when :Date
129
+ Date.parse(value)
130
+ when :String
131
+ value.to_s
132
+ when :Integer
133
+ value.to_i
134
+ when :Float
135
+ value.to_f
136
+ when :Boolean
137
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
+ true
139
+ else
140
+ false
141
+ end
142
+ when :Object
143
+ # generic object (usually a Hash), return directly
144
+ value
145
+ when /\AArray<(?<inner_type>.+)>\z/
146
+ inner_type = Regexp.last_match[:inner_type]
147
+ value.map { |v| _deserialize(inner_type, v) }
148
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
+ k_type = Regexp.last_match[:k_type]
150
+ v_type = Regexp.last_match[:v_type]
151
+ {}.tap do |hash|
152
+ value.each do |k, v|
153
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
+ end
155
+ end
156
+ else # model
157
+ OryHydraClient.const_get(type).build_from_hash(value)
158
+ end
159
+ end
160
+
161
+ # Returns the string representation of the object
162
+ # @return [String] String presentation of the object
163
+ def to_s
164
+ to_hash.to_s
165
+ end
166
+
167
+ # to_body is an alias to to_hash (backward compatibility)
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_body
170
+ to_hash
171
+ end
172
+
173
+ # Returns the object in the form of hash
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_hash
176
+ hash = {}
177
+ self.class.attribute_map.each_pair do |attr, param|
178
+ value = self.send(attr)
179
+ if value.nil?
180
+ is_nullable = self.class.openapi_nullable.include?(attr)
181
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
182
+ end
183
+
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map { |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+ end
207
+ end
@@ -0,0 +1,377 @@
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
+ class JSONWebKey
17
+ # The \"alg\" (algorithm) parameter identifies the algorithm intended for use with the key. The values used should either be registered in the IANA \"JSON Web Signature and Encryption Algorithms\" registry established by [JWA] or be a value that contains a Collision- Resistant Name.
18
+ attr_accessor :alg
19
+
20
+ attr_accessor :crv
21
+
22
+ attr_accessor :d
23
+
24
+ attr_accessor :dp
25
+
26
+ attr_accessor :dq
27
+
28
+ attr_accessor :e
29
+
30
+ attr_accessor :k
31
+
32
+ # The \"kid\" (key ID) parameter is used to match a specific key. This is used, for instance, to choose among a set of keys within a JWK Set during key rollover. The structure of the \"kid\" value is unspecified. When \"kid\" values are used within a JWK Set, different keys within the JWK Set SHOULD use distinct \"kid\" values. (One example in which different keys might use the same \"kid\" value is if they have different \"kty\" (key type) values but are considered to be equivalent alternatives by the application using them.) The \"kid\" value is a case-sensitive string.
33
+ attr_accessor :kid
34
+
35
+ # The \"kty\" (key type) parameter identifies the cryptographic algorithm family used with the key, such as \"RSA\" or \"EC\". \"kty\" values should either be registered in the IANA \"JSON Web Key Types\" registry established by [JWA] or be a value that contains a Collision- Resistant Name. The \"kty\" value is a case-sensitive string.
36
+ attr_accessor :kty
37
+
38
+ attr_accessor :n
39
+
40
+ attr_accessor :p
41
+
42
+ attr_accessor :q
43
+
44
+ attr_accessor :qi
45
+
46
+ # Use (\"public key use\") identifies the intended use of the public key. The \"use\" parameter is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. Values are commonly \"sig\" (signature) or \"enc\" (encryption).
47
+ attr_accessor :use
48
+
49
+ attr_accessor :x
50
+
51
+ # The \"x5c\" (X.509 certificate chain) parameter contains a chain of one or more PKIX certificates [RFC5280]. The certificate chain is represented as a JSON array of certificate value strings. Each string in the array is a base64-encoded (Section 4 of [RFC4648] -- not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. The PKIX certificate containing the key value MUST be the first certificate.
52
+ attr_accessor :x5c
53
+
54
+ attr_accessor :y
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'alg' => :'alg',
60
+ :'crv' => :'crv',
61
+ :'d' => :'d',
62
+ :'dp' => :'dp',
63
+ :'dq' => :'dq',
64
+ :'e' => :'e',
65
+ :'k' => :'k',
66
+ :'kid' => :'kid',
67
+ :'kty' => :'kty',
68
+ :'n' => :'n',
69
+ :'p' => :'p',
70
+ :'q' => :'q',
71
+ :'qi' => :'qi',
72
+ :'use' => :'use',
73
+ :'x' => :'x',
74
+ :'x5c' => :'x5c',
75
+ :'y' => :'y'
76
+ }
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.openapi_types
81
+ {
82
+ :'alg' => :'String',
83
+ :'crv' => :'String',
84
+ :'d' => :'String',
85
+ :'dp' => :'String',
86
+ :'dq' => :'String',
87
+ :'e' => :'String',
88
+ :'k' => :'String',
89
+ :'kid' => :'String',
90
+ :'kty' => :'String',
91
+ :'n' => :'String',
92
+ :'p' => :'String',
93
+ :'q' => :'String',
94
+ :'qi' => :'String',
95
+ :'use' => :'String',
96
+ :'x' => :'String',
97
+ :'x5c' => :'Array<String>',
98
+ :'y' => :'String'
99
+ }
100
+ end
101
+
102
+ # List of attributes with nullable: true
103
+ def self.openapi_nullable
104
+ Set.new([
105
+ ])
106
+ end
107
+
108
+ # Initializes the object
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ def initialize(attributes = {})
111
+ if (!attributes.is_a?(Hash))
112
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::JSONWebKey` initialize method"
113
+ end
114
+
115
+ # check to see if the attribute exists and convert string to symbol for hash key
116
+ attributes = attributes.each_with_object({}) { |(k, v), h|
117
+ if (!self.class.attribute_map.key?(k.to_sym))
118
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::JSONWebKey`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
119
+ end
120
+ h[k.to_sym] = v
121
+ }
122
+
123
+ if attributes.key?(:'alg')
124
+ self.alg = attributes[:'alg']
125
+ end
126
+
127
+ if attributes.key?(:'crv')
128
+ self.crv = attributes[:'crv']
129
+ end
130
+
131
+ if attributes.key?(:'d')
132
+ self.d = attributes[:'d']
133
+ end
134
+
135
+ if attributes.key?(:'dp')
136
+ self.dp = attributes[:'dp']
137
+ end
138
+
139
+ if attributes.key?(:'dq')
140
+ self.dq = attributes[:'dq']
141
+ end
142
+
143
+ if attributes.key?(:'e')
144
+ self.e = attributes[:'e']
145
+ end
146
+
147
+ if attributes.key?(:'k')
148
+ self.k = attributes[:'k']
149
+ end
150
+
151
+ if attributes.key?(:'kid')
152
+ self.kid = attributes[:'kid']
153
+ end
154
+
155
+ if attributes.key?(:'kty')
156
+ self.kty = attributes[:'kty']
157
+ end
158
+
159
+ if attributes.key?(:'n')
160
+ self.n = attributes[:'n']
161
+ end
162
+
163
+ if attributes.key?(:'p')
164
+ self.p = attributes[:'p']
165
+ end
166
+
167
+ if attributes.key?(:'q')
168
+ self.q = attributes[:'q']
169
+ end
170
+
171
+ if attributes.key?(:'qi')
172
+ self.qi = attributes[:'qi']
173
+ end
174
+
175
+ if attributes.key?(:'use')
176
+ self.use = attributes[:'use']
177
+ end
178
+
179
+ if attributes.key?(:'x')
180
+ self.x = attributes[:'x']
181
+ end
182
+
183
+ if attributes.key?(:'x5c')
184
+ if (value = attributes[:'x5c']).is_a?(Array)
185
+ self.x5c = value
186
+ end
187
+ end
188
+
189
+ if attributes.key?(:'y')
190
+ self.y = attributes[:'y']
191
+ end
192
+ end
193
+
194
+ # Show invalid properties with the reasons. Usually used together with valid?
195
+ # @return Array for valid properties with the reasons
196
+ def list_invalid_properties
197
+ invalid_properties = Array.new
198
+ if @alg.nil?
199
+ invalid_properties.push('invalid value for "alg", alg cannot be nil.')
200
+ end
201
+
202
+ if @kid.nil?
203
+ invalid_properties.push('invalid value for "kid", kid cannot be nil.')
204
+ end
205
+
206
+ if @kty.nil?
207
+ invalid_properties.push('invalid value for "kty", kty cannot be nil.')
208
+ end
209
+
210
+ if @use.nil?
211
+ invalid_properties.push('invalid value for "use", use cannot be nil.')
212
+ end
213
+
214
+ invalid_properties
215
+ end
216
+
217
+ # Check to see if the all the properties in the model are valid
218
+ # @return true if the model is valid
219
+ def valid?
220
+ return false if @alg.nil?
221
+ return false if @kid.nil?
222
+ return false if @kty.nil?
223
+ return false if @use.nil?
224
+ true
225
+ end
226
+
227
+ # Checks equality by comparing each attribute.
228
+ # @param [Object] Object to be compared
229
+ def ==(o)
230
+ return true if self.equal?(o)
231
+ self.class == o.class &&
232
+ alg == o.alg &&
233
+ crv == o.crv &&
234
+ d == o.d &&
235
+ dp == o.dp &&
236
+ dq == o.dq &&
237
+ e == o.e &&
238
+ k == o.k &&
239
+ kid == o.kid &&
240
+ kty == o.kty &&
241
+ n == o.n &&
242
+ p == o.p &&
243
+ q == o.q &&
244
+ qi == o.qi &&
245
+ use == o.use &&
246
+ x == o.x &&
247
+ x5c == o.x5c &&
248
+ y == o.y
249
+ end
250
+
251
+ # @see the `==` method
252
+ # @param [Object] Object to be compared
253
+ def eql?(o)
254
+ self == o
255
+ end
256
+
257
+ # Calculates hash code according to all attributes.
258
+ # @return [Integer] Hash code
259
+ def hash
260
+ [alg, crv, d, dp, dq, e, k, kid, kty, n, p, q, qi, use, x, x5c, y].hash
261
+ end
262
+
263
+ # Builds the object from hash
264
+ # @param [Hash] attributes Model attributes in the form of hash
265
+ # @return [Object] Returns the model itself
266
+ def self.build_from_hash(attributes)
267
+ new.build_from_hash(attributes)
268
+ end
269
+
270
+ # Builds the object from hash
271
+ # @param [Hash] attributes Model attributes in the form of hash
272
+ # @return [Object] Returns the model itself
273
+ def build_from_hash(attributes)
274
+ return nil unless attributes.is_a?(Hash)
275
+ self.class.openapi_types.each_pair do |key, type|
276
+ if type =~ /\AArray<(.*)>/i
277
+ # check to ensure the input is an array given that the attribute
278
+ # is documented as an array but the input is not
279
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
280
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
281
+ end
282
+ elsif !attributes[self.class.attribute_map[key]].nil?
283
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
284
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
285
+ end
286
+
287
+ self
288
+ end
289
+
290
+ # Deserializes the data based on type
291
+ # @param string type Data type
292
+ # @param string value Value to be deserialized
293
+ # @return [Object] Deserialized data
294
+ def _deserialize(type, value)
295
+ case type.to_sym
296
+ when :DateTime
297
+ DateTime.parse(value)
298
+ when :Date
299
+ Date.parse(value)
300
+ when :String
301
+ value.to_s
302
+ when :Integer
303
+ value.to_i
304
+ when :Float
305
+ value.to_f
306
+ when :Boolean
307
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
308
+ true
309
+ else
310
+ false
311
+ end
312
+ when :Object
313
+ # generic object (usually a Hash), return directly
314
+ value
315
+ when /\AArray<(?<inner_type>.+)>\z/
316
+ inner_type = Regexp.last_match[:inner_type]
317
+ value.map { |v| _deserialize(inner_type, v) }
318
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
319
+ k_type = Regexp.last_match[:k_type]
320
+ v_type = Regexp.last_match[:v_type]
321
+ {}.tap do |hash|
322
+ value.each do |k, v|
323
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
324
+ end
325
+ end
326
+ else # model
327
+ OryHydraClient.const_get(type).build_from_hash(value)
328
+ end
329
+ end
330
+
331
+ # Returns the string representation of the object
332
+ # @return [String] String presentation of the object
333
+ def to_s
334
+ to_hash.to_s
335
+ end
336
+
337
+ # to_body is an alias to to_hash (backward compatibility)
338
+ # @return [Hash] Returns the object in the form of hash
339
+ def to_body
340
+ to_hash
341
+ end
342
+
343
+ # Returns the object in the form of hash
344
+ # @return [Hash] Returns the object in the form of hash
345
+ def to_hash
346
+ hash = {}
347
+ self.class.attribute_map.each_pair do |attr, param|
348
+ value = self.send(attr)
349
+ if value.nil?
350
+ is_nullable = self.class.openapi_nullable.include?(attr)
351
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
352
+ end
353
+
354
+ hash[param] = _to_hash(value)
355
+ end
356
+ hash
357
+ end
358
+
359
+ # Outputs non-array value in the form of hash
360
+ # For object, use to_hash. Otherwise, just return the value
361
+ # @param [Object] value Any valid value
362
+ # @return [Hash] Returns the value in the form of hash
363
+ def _to_hash(value)
364
+ if value.is_a?(Array)
365
+ value.compact.map { |v| _to_hash(v) }
366
+ elsif value.is_a?(Hash)
367
+ {}.tap do |hash|
368
+ value.each { |k, v| hash[k] = _to_hash(v) }
369
+ end
370
+ elsif value.respond_to? :to_hash
371
+ value.to_hash
372
+ else
373
+ value
374
+ end
375
+ end
376
+ end
377
+ end