ory-kratos-client 0.1.0.alpha6 → 0.4.6.alpha1

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