ory-kratos-client 0.1.0.alpha5 → 0.3.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -11
  3. data/docs/AdminApi.md +116 -21
  4. data/docs/CommonApi.md +116 -21
  5. data/docs/CompleteSelfServiceBrowserSettingsStrategyProfileFlowPayload.md +19 -0
  6. data/docs/Form.md +3 -3
  7. data/docs/FormField.md +7 -7
  8. data/docs/GenericErrorPayload.md +1 -1
  9. data/docs/Identity.md +4 -2
  10. data/docs/LoginRequest.md +7 -5
  11. data/docs/LoginRequestMethod.md +2 -2
  12. data/docs/LoginRequestMethodConfig.md +10 -1
  13. data/docs/ProfileManagementRequest.md +7 -7
  14. data/docs/ProviderCredentialsConfig.md +19 -0
  15. data/docs/PublicApi.md +365 -39
  16. data/docs/RegistrationRequest.md +5 -5
  17. data/docs/RegistrationRequestMethodConfig.md +10 -1
  18. data/docs/RequestMethodConfig.md +23 -0
  19. data/docs/Session.md +5 -5
  20. data/docs/SettingsRequest.md +31 -0
  21. data/docs/SettingsRequestMethod.md +19 -0
  22. data/docs/VerifiableAddress.md +27 -0
  23. data/docs/VerificationRequest.md +29 -0
  24. data/lib/ory-kratos-client.rb +8 -3
  25. data/lib/ory-kratos-client/api/admin_api.rb +159 -36
  26. data/lib/ory-kratos-client/api/common_api.rb +159 -36
  27. data/lib/ory-kratos-client/api/health_api.rb +1 -1
  28. data/lib/ory-kratos-client/api/public_api.rb +493 -59
  29. data/lib/ory-kratos-client/api/version_api.rb +1 -1
  30. data/lib/ory-kratos-client/api_client.rb +1 -1
  31. data/lib/ory-kratos-client/api_error.rb +1 -1
  32. data/lib/ory-kratos-client/configuration.rb +1 -1
  33. data/lib/ory-kratos-client/models/complete_self_service_browser_profile_management_flow_payload.rb +1 -1
  34. data/lib/ory-kratos-client/models/complete_self_service_browser_settings_strategy_profile_flow_payload.rb +222 -0
  35. data/lib/ory-kratos-client/models/error.rb +1 -1
  36. data/lib/ory-kratos-client/models/error_container.rb +1 -1
  37. data/lib/ory-kratos-client/models/form.rb +17 -2
  38. data/lib/ory-kratos-client/models/form_field.rb +18 -9
  39. data/lib/ory-kratos-client/models/generic_error.rb +1 -1
  40. data/lib/ory-kratos-client/models/generic_error_payload.rb +3 -4
  41. data/lib/ory-kratos-client/models/health_not_ready_status.rb +1 -1
  42. data/lib/ory-kratos-client/models/health_status.rb +1 -1
  43. data/lib/ory-kratos-client/models/identity.rb +18 -2
  44. data/lib/ory-kratos-client/models/login_request.rb +37 -2
  45. data/lib/ory-kratos-client/models/login_request_method.rb +11 -1
  46. data/lib/ory-kratos-client/models/login_request_method_config.rb +74 -3
  47. data/lib/ory-kratos-client/models/profile_management_request.rb +36 -1
  48. data/lib/ory-kratos-client/models/provider_credentials_config.rb +215 -0
  49. data/lib/ory-kratos-client/models/registration_request.rb +26 -1
  50. data/lib/ory-kratos-client/models/registration_request_method.rb +1 -1
  51. data/lib/ory-kratos-client/models/registration_request_method_config.rb +74 -3
  52. data/lib/ory-kratos-client/models/request_method_config.rb +256 -0
  53. data/lib/ory-kratos-client/models/session.rb +26 -1
  54. data/lib/ory-kratos-client/models/settings_request.rb +313 -0
  55. data/lib/ory-kratos-client/models/settings_request_method.rb +216 -0
  56. data/lib/ory-kratos-client/models/verifiable_address.rb +276 -0
  57. data/lib/ory-kratos-client/models/verification_request.rb +265 -0
  58. data/lib/ory-kratos-client/models/version.rb +1 -1
  59. data/lib/ory-kratos-client/version.rb +2 -2
  60. data/ory-kratos-client.gemspec +1 -1
  61. data/spec/models/complete_self_service_browser_settings_strategy_profile_flow_payload_spec.rb +47 -0
  62. data/spec/models/provider_credentials_config_spec.rb +47 -0
  63. data/spec/models/request_method_config_spec.rb +59 -0
  64. data/spec/models/settings_request_method_spec.rb +47 -0
  65. data/spec/models/settings_request_spec.rb +83 -0
  66. data/spec/models/verifiable_address_spec.rb +71 -0
  67. data/spec/models/verification_request_spec.rb +77 -0
  68. metadata +43 -15
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: latest
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.2
9
+ OpenAPI Generator version: 4.2.3
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: latest
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.2
9
+ OpenAPI Generator version: 4.2.3
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: latest
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.2
9
+ OpenAPI Generator version: 4.2.3
10
10
 
11
11
  =end
12
12
 
@@ -14,6 +14,8 @@ require 'date'
14
14
 
15
15
  module OryHydraClient
16
16
  class Identity
17
+ attr_accessor :addresses
18
+
17
19
  attr_accessor :id
18
20
 
19
21
  attr_accessor :traits
@@ -27,6 +29,7 @@ module OryHydraClient
27
29
  # Attribute mapping from ruby-style variable name to JSON key.
28
30
  def self.attribute_map
29
31
  {
32
+ :'addresses' => :'addresses',
30
33
  :'id' => :'id',
31
34
  :'traits' => :'traits',
32
35
  :'traits_schema_id' => :'traits_schema_id',
@@ -37,6 +40,7 @@ module OryHydraClient
37
40
  # Attribute type mapping.
38
41
  def self.openapi_types
39
42
  {
43
+ :'addresses' => :'Array<VerifiableAddress>',
40
44
  :'id' => :'String',
41
45
  :'traits' => :'Object',
42
46
  :'traits_schema_id' => :'String',
@@ -65,6 +69,12 @@ module OryHydraClient
65
69
  h[k.to_sym] = v
66
70
  }
67
71
 
72
+ if attributes.key?(:'addresses')
73
+ if (value = attributes[:'addresses']).is_a?(Array)
74
+ self.addresses = value
75
+ end
76
+ end
77
+
68
78
  if attributes.key?(:'id')
69
79
  self.id = attributes[:'id']
70
80
  end
@@ -94,6 +104,10 @@ module OryHydraClient
94
104
  invalid_properties.push('invalid value for "traits", traits cannot be nil.')
95
105
  end
96
106
 
107
+ if @traits_schema_id.nil?
108
+ invalid_properties.push('invalid value for "traits_schema_id", traits_schema_id cannot be nil.')
109
+ end
110
+
97
111
  invalid_properties
98
112
  end
99
113
 
@@ -102,6 +116,7 @@ module OryHydraClient
102
116
  def valid?
103
117
  return false if @id.nil?
104
118
  return false if @traits.nil?
119
+ return false if @traits_schema_id.nil?
105
120
  true
106
121
  end
107
122
 
@@ -110,6 +125,7 @@ module OryHydraClient
110
125
  def ==(o)
111
126
  return true if self.equal?(o)
112
127
  self.class == o.class &&
128
+ addresses == o.addresses &&
113
129
  id == o.id &&
114
130
  traits == o.traits &&
115
131
  traits_schema_id == o.traits_schema_id &&
@@ -125,7 +141,7 @@ module OryHydraClient
125
141
  # Calculates hash code according to all attributes.
126
142
  # @return [Integer] Hash code
127
143
  def hash
128
- [id, traits, traits_schema_id, traits_schema_url].hash
144
+ [addresses, id, traits, traits_schema_id, traits_schema_url].hash
129
145
  end
130
146
 
131
147
  # Builds the object from hash
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: latest
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.2
9
+ OpenAPI Generator version: 4.2.3
10
10
 
11
11
  =end
12
12
 
@@ -20,6 +20,9 @@ module OryHydraClient
20
20
  # ExpiresAt is the time (UTC) when the request expires. If the user still wishes to log in, a new request has to be initiated.
21
21
  attr_accessor :expires_at
22
22
 
23
+ # Forced stores whether this login request should enforce reauthentication.
24
+ attr_accessor :forced
25
+
23
26
  attr_accessor :id
24
27
 
25
28
  # IssuedAt is the time (UTC) when the request occurred.
@@ -36,6 +39,7 @@ module OryHydraClient
36
39
  {
37
40
  :'active' => :'active',
38
41
  :'expires_at' => :'expires_at',
42
+ :'forced' => :'forced',
39
43
  :'id' => :'id',
40
44
  :'issued_at' => :'issued_at',
41
45
  :'methods' => :'methods',
@@ -48,6 +52,7 @@ module OryHydraClient
48
52
  {
49
53
  :'active' => :'String',
50
54
  :'expires_at' => :'DateTime',
55
+ :'forced' => :'Boolean',
51
56
  :'id' => :'String',
52
57
  :'issued_at' => :'DateTime',
53
58
  :'methods' => :'Hash<String, LoginRequestMethod>',
@@ -84,6 +89,10 @@ module OryHydraClient
84
89
  self.expires_at = attributes[:'expires_at']
85
90
  end
86
91
 
92
+ if attributes.key?(:'forced')
93
+ self.forced = attributes[:'forced']
94
+ end
95
+
87
96
  if attributes.key?(:'id')
88
97
  self.id = attributes[:'id']
89
98
  end
@@ -107,12 +116,37 @@ module OryHydraClient
107
116
  # @return Array for valid properties with the reasons
108
117
  def list_invalid_properties
109
118
  invalid_properties = Array.new
119
+ if @expires_at.nil?
120
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
121
+ end
122
+
123
+ if @id.nil?
124
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
125
+ end
126
+
127
+ if @issued_at.nil?
128
+ invalid_properties.push('invalid value for "issued_at", issued_at cannot be nil.')
129
+ end
130
+
131
+ if @methods.nil?
132
+ invalid_properties.push('invalid value for "methods", methods cannot be nil.')
133
+ end
134
+
135
+ if @request_url.nil?
136
+ invalid_properties.push('invalid value for "request_url", request_url cannot be nil.')
137
+ end
138
+
110
139
  invalid_properties
111
140
  end
112
141
 
113
142
  # Check to see if the all the properties in the model are valid
114
143
  # @return true if the model is valid
115
144
  def valid?
145
+ return false if @expires_at.nil?
146
+ return false if @id.nil?
147
+ return false if @issued_at.nil?
148
+ return false if @methods.nil?
149
+ return false if @request_url.nil?
116
150
  true
117
151
  end
118
152
 
@@ -123,6 +157,7 @@ module OryHydraClient
123
157
  self.class == o.class &&
124
158
  active == o.active &&
125
159
  expires_at == o.expires_at &&
160
+ forced == o.forced &&
126
161
  id == o.id &&
127
162
  issued_at == o.issued_at &&
128
163
  methods == o.methods &&
@@ -138,7 +173,7 @@ module OryHydraClient
138
173
  # Calculates hash code according to all attributes.
139
174
  # @return [Integer] Hash code
140
175
  def hash
141
- [active, expires_at, id, issued_at, methods, request_url].hash
176
+ [active, expires_at, forced, id, issued_at, methods, request_url].hash
142
177
  end
143
178
 
144
179
  # Builds the object from hash
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: latest
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.2
9
+ OpenAPI Generator version: 4.2.3
10
10
 
11
11
  =end
12
12
 
@@ -69,12 +69,22 @@ module OryHydraClient
69
69
  # @return Array for valid properties with the reasons
70
70
  def list_invalid_properties
71
71
  invalid_properties = Array.new
72
+ if @config.nil?
73
+ invalid_properties.push('invalid value for "config", config cannot be nil.')
74
+ end
75
+
76
+ if @method.nil?
77
+ invalid_properties.push('invalid value for "method", method cannot be nil.')
78
+ end
79
+
72
80
  invalid_properties
73
81
  end
74
82
 
75
83
  # Check to see if the all the properties in the model are valid
76
84
  # @return true if the model is valid
77
85
  def valid?
86
+ return false if @config.nil?
87
+ return false if @method.nil?
78
88
  true
79
89
  end
80
90
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: latest
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.2
9
+ OpenAPI Generator version: 4.2.3
10
10
 
11
11
  =end
12
12
 
@@ -14,15 +14,40 @@ require 'date'
14
14
 
15
15
  module OryHydraClient
16
16
  class LoginRequestMethodConfig
17
+ # Action should be used as the form action URL `<form action=\"{{ .Action }}\" method=\"post\">`.
18
+ attr_accessor :action
19
+
20
+ # Errors contains all form errors. These will be duplicates of the individual field errors.
21
+ attr_accessor :errors
22
+
23
+ # Fields contains multiple fields
24
+ attr_accessor :fields
25
+
26
+ # Method is the form method (e.g. POST)
27
+ attr_accessor :method
28
+
29
+ # Providers is set for the \"oidc\" request method.
30
+ attr_accessor :providers
31
+
17
32
  # Attribute mapping from ruby-style variable name to JSON key.
18
33
  def self.attribute_map
19
34
  {
35
+ :'action' => :'action',
36
+ :'errors' => :'errors',
37
+ :'fields' => :'fields',
38
+ :'method' => :'method',
39
+ :'providers' => :'providers'
20
40
  }
21
41
  end
22
42
 
23
43
  # Attribute type mapping.
24
44
  def self.openapi_types
25
45
  {
46
+ :'action' => :'String',
47
+ :'errors' => :'Array<Error>',
48
+ :'fields' => :'Array<FormField>',
49
+ :'method' => :'String',
50
+ :'providers' => :'Array<FormField>'
26
51
  }
27
52
  end
28
53
 
@@ -46,18 +71,59 @@ module OryHydraClient
46
71
  end
47
72
  h[k.to_sym] = v
48
73
  }
74
+
75
+ if attributes.key?(:'action')
76
+ self.action = attributes[:'action']
77
+ end
78
+
79
+ if attributes.key?(:'errors')
80
+ if (value = attributes[:'errors']).is_a?(Array)
81
+ self.errors = value
82
+ end
83
+ end
84
+
85
+ if attributes.key?(:'fields')
86
+ if (value = attributes[:'fields']).is_a?(Array)
87
+ self.fields = value
88
+ end
89
+ end
90
+
91
+ if attributes.key?(:'method')
92
+ self.method = attributes[:'method']
93
+ end
94
+
95
+ if attributes.key?(:'providers')
96
+ if (value = attributes[:'providers']).is_a?(Array)
97
+ self.providers = value
98
+ end
99
+ end
49
100
  end
50
101
 
51
102
  # Show invalid properties with the reasons. Usually used together with valid?
52
103
  # @return Array for valid properties with the reasons
53
104
  def list_invalid_properties
54
105
  invalid_properties = Array.new
106
+ if @action.nil?
107
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
108
+ end
109
+
110
+ if @fields.nil?
111
+ invalid_properties.push('invalid value for "fields", fields cannot be nil.')
112
+ end
113
+
114
+ if @method.nil?
115
+ invalid_properties.push('invalid value for "method", method cannot be nil.')
116
+ end
117
+
55
118
  invalid_properties
56
119
  end
57
120
 
58
121
  # Check to see if the all the properties in the model are valid
59
122
  # @return true if the model is valid
60
123
  def valid?
124
+ return false if @action.nil?
125
+ return false if @fields.nil?
126
+ return false if @method.nil?
61
127
  true
62
128
  end
63
129
 
@@ -65,7 +131,12 @@ module OryHydraClient
65
131
  # @param [Object] Object to be compared
66
132
  def ==(o)
67
133
  return true if self.equal?(o)
68
- self.class == o.class
134
+ self.class == o.class &&
135
+ action == o.action &&
136
+ errors == o.errors &&
137
+ fields == o.fields &&
138
+ method == o.method &&
139
+ providers == o.providers
69
140
  end
70
141
 
71
142
  # @see the `==` method
@@ -77,7 +148,7 @@ module OryHydraClient
77
148
  # Calculates hash code according to all attributes.
78
149
  # @return [Integer] Hash code
79
150
  def hash
80
- [].hash
151
+ [action, errors, fields, method, providers].hash
81
152
  end
82
153
 
83
154
  # Builds the object from hash
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: latest
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.2
9
+ OpenAPI Generator version: 4.2.3
10
10
 
11
11
  =end
12
12
 
@@ -113,12 +113,47 @@ module OryHydraClient
113
113
  # @return Array for valid properties with the reasons
114
114
  def list_invalid_properties
115
115
  invalid_properties = Array.new
116
+ if @expires_at.nil?
117
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
118
+ end
119
+
120
+ if @form.nil?
121
+ invalid_properties.push('invalid value for "form", form cannot be nil.')
122
+ end
123
+
124
+ if @id.nil?
125
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
126
+ end
127
+
128
+ if @identity.nil?
129
+ invalid_properties.push('invalid value for "identity", identity cannot be nil.')
130
+ end
131
+
132
+ if @issued_at.nil?
133
+ invalid_properties.push('invalid value for "issued_at", issued_at cannot be nil.')
134
+ end
135
+
136
+ if @request_url.nil?
137
+ invalid_properties.push('invalid value for "request_url", request_url cannot be nil.')
138
+ end
139
+
140
+ if @update_successful.nil?
141
+ invalid_properties.push('invalid value for "update_successful", update_successful cannot be nil.')
142
+ end
143
+
116
144
  invalid_properties
117
145
  end
118
146
 
119
147
  # Check to see if the all the properties in the model are valid
120
148
  # @return true if the model is valid
121
149
  def valid?
150
+ return false if @expires_at.nil?
151
+ return false if @form.nil?
152
+ return false if @id.nil?
153
+ return false if @identity.nil?
154
+ return false if @issued_at.nil?
155
+ return false if @request_url.nil?
156
+ return false if @update_successful.nil?
122
157
  true
123
158
  end
124
159
 
@@ -0,0 +1,215 @@
1
+ =begin
2
+ #Ory Kratos
3
+
4
+ #Welcome to the ORY Kratos HTTP API documentation!
5
+
6
+ The version of the OpenAPI document: latest
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module OryHydraClient
16
+ class ProviderCredentialsConfig
17
+ attr_accessor :provider
18
+
19
+ attr_accessor :subject
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'provider' => :'provider',
25
+ :'subject' => :'subject'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'provider' => :'String',
33
+ :'subject' => :'String'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::ProviderCredentialsConfig` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::ProviderCredentialsConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'provider')
59
+ self.provider = attributes[:'provider']
60
+ end
61
+
62
+ if attributes.key?(:'subject')
63
+ self.subject = attributes[:'subject']
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ provider == o.provider &&
86
+ subject == o.subject
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Integer] Hash code
97
+ def hash
98
+ [provider, subject].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def self.build_from_hash(attributes)
105
+ new.build_from_hash(attributes)
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ self.class.openapi_types.each_pair do |key, type|
114
+ if type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :DateTime
135
+ DateTime.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ OryHydraClient.const_get(type).build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+ end
215
+ end