ory-kratos-client 0.2.0.alpha2 → 0.5.1.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +84 -52
  4. data/docs/AdminApi.md +244 -86
  5. data/docs/CommonApi.md +54 -6
  6. data/docs/CompleteSelfServiceLoginFlowWithPasswordMethod.md +21 -0
  7. data/docs/CompleteSelfServiceRecoveryFlowWithLinkMethod.md +19 -0
  8. data/docs/CompleteSelfServiceSettingsFlowWithPasswordMethod.md +19 -0
  9. data/docs/CompleteSelfServiceVerificationFlowWithLinkMethod.md +19 -0
  10. data/docs/CreateIdentity.md +19 -0
  11. data/docs/CreateRecoveryLink.md +19 -0
  12. data/docs/ErrorContainer.md +2 -2
  13. data/docs/Form.md +2 -2
  14. data/docs/FormField.md +4 -4
  15. data/docs/GenericErrorPayload.md +1 -1
  16. data/docs/Identity.md +9 -7
  17. data/docs/LoginFlow.md +33 -0
  18. data/docs/LoginFlowMethod.md +19 -0
  19. data/docs/LoginFlowMethodConfig.md +25 -0
  20. data/docs/LoginRequest.md +2 -0
  21. data/docs/LoginRequestMethodConfig.md +2 -2
  22. data/docs/LoginViaApiResponse.md +19 -0
  23. data/docs/Message.md +23 -0
  24. data/docs/ProviderCredentialsConfig.md +19 -0
  25. data/docs/PublicApi.md +726 -151
  26. data/docs/RecoveryAddress.md +21 -0
  27. data/docs/RecoveryFlow.md +33 -0
  28. data/docs/RecoveryFlowMethod.md +19 -0
  29. data/docs/RecoveryFlowMethodConfig.md +23 -0
  30. data/docs/RecoveryLink.md +19 -0
  31. data/docs/RecoveryRequest.md +31 -0
  32. data/docs/RecoveryRequestMethod.md +19 -0
  33. data/docs/RegistrationFlow.md +31 -0
  34. data/docs/RegistrationFlowMethod.md +19 -0
  35. data/docs/RegistrationFlowMethodConfig.md +25 -0
  36. data/docs/RegistrationRequest.md +3 -1
  37. data/docs/RegistrationRequestMethodConfig.md +2 -2
  38. data/docs/RegistrationViaApiResponse.md +21 -0
  39. data/docs/RequestMethodConfig.md +2 -2
  40. data/docs/RevokeSession.md +17 -0
  41. data/docs/Session.md +6 -4
  42. data/docs/SettingsFlow.md +35 -0
  43. data/docs/SettingsFlowMethod.md +19 -0
  44. data/docs/SettingsFlowMethodConfig.md +23 -0
  45. data/docs/SettingsRequest.md +4 -2
  46. data/docs/SettingsViaApiResponse.md +19 -0
  47. data/docs/UpdateIdentity.md +19 -0
  48. data/docs/VerifiableAddress.md +3 -3
  49. data/docs/VerificationFlow.md +33 -0
  50. data/docs/VerificationFlowMethod.md +19 -0
  51. data/docs/VerificationFlowMethodConfig.md +23 -0
  52. data/docs/VerificationRequest.md +2 -0
  53. data/lib/ory-kratos-client.rb +31 -16
  54. data/lib/ory-kratos-client/api/admin_api.rb +321 -130
  55. data/lib/ory-kratos-client/api/common_api.rb +75 -12
  56. data/lib/ory-kratos-client/api/health_api.rb +2 -2
  57. data/lib/ory-kratos-client/api/public_api.rb +896 -246
  58. data/lib/ory-kratos-client/api/version_api.rb +2 -2
  59. data/lib/ory-kratos-client/api_client.rb +10 -7
  60. data/lib/ory-kratos-client/api_error.rb +2 -2
  61. data/lib/ory-kratos-client/configuration.rb +9 -2
  62. data/lib/ory-kratos-client/models/complete_self_service_browser_settings_strategy_profile_flow_payload.rb +2 -2
  63. data/lib/ory-kratos-client/models/complete_self_service_login_flow_with_password_method.rb +227 -0
  64. data/lib/ory-kratos-client/models/complete_self_service_recovery_flow_with_link_method.rb +217 -0
  65. data/lib/ory-kratos-client/models/complete_self_service_settings_flow_with_password_method.rb +222 -0
  66. data/lib/ory-kratos-client/models/complete_self_service_verification_flow_with_link_method.rb +217 -0
  67. data/lib/ory-kratos-client/models/create_identity.rb +227 -0
  68. data/lib/ory-kratos-client/models/create_recovery_link.rb +238 -0
  69. data/lib/ory-kratos-client/models/error_container.rb +13 -2
  70. data/lib/ory-kratos-client/models/form.rb +14 -15
  71. data/lib/ory-kratos-client/models/form_field.rb +11 -17
  72. data/lib/ory-kratos-client/models/generic_error.rb +2 -2
  73. data/lib/ory-kratos-client/models/generic_error_payload.rb +4 -6
  74. data/lib/ory-kratos-client/models/health_not_ready_status.rb +2 -2
  75. data/lib/ory-kratos-client/models/health_status.rb +2 -2
  76. data/lib/ory-kratos-client/models/identity.rb +53 -35
  77. data/lib/ory-kratos-client/models/login_flow.rb +315 -0
  78. data/lib/ory-kratos-client/models/login_flow_method.rb +226 -0
  79. data/lib/ory-kratos-client/models/login_flow_method_config.rb +267 -0
  80. data/lib/ory-kratos-client/models/login_request.rb +14 -3
  81. data/lib/ory-kratos-client/models/login_request_method.rb +2 -2
  82. data/lib/ory-kratos-client/models/login_request_method_config.rb +14 -15
  83. data/lib/ory-kratos-client/models/login_via_api_response.rb +227 -0
  84. data/lib/ory-kratos-client/models/message.rb +234 -0
  85. data/lib/ory-kratos-client/models/provider_credentials_config.rb +215 -0
  86. data/lib/ory-kratos-client/models/recovery_address.rb +239 -0
  87. data/lib/ory-kratos-client/models/recovery_flow.rb +319 -0
  88. data/lib/ory-kratos-client/models/recovery_flow_method.rb +226 -0
  89. data/lib/ory-kratos-client/models/recovery_flow_method_config.rb +255 -0
  90. data/lib/ory-kratos-client/models/recovery_link.rb +222 -0
  91. data/lib/ory-kratos-client/models/recovery_request.rb +309 -0
  92. data/lib/ory-kratos-client/models/recovery_request_method.rb +216 -0
  93. data/lib/ory-kratos-client/models/registration_flow.rb +304 -0
  94. data/lib/ory-kratos-client/models/registration_flow_method.rb +226 -0
  95. data/lib/ory-kratos-client/models/registration_flow_method_config.rb +267 -0
  96. data/lib/ory-kratos-client/models/registration_request.rb +14 -8
  97. data/lib/ory-kratos-client/models/registration_request_method.rb +2 -2
  98. data/lib/ory-kratos-client/models/registration_request_method_config.rb +14 -15
  99. data/lib/ory-kratos-client/models/registration_via_api_response.rb +236 -0
  100. data/lib/ory-kratos-client/models/request_method_config.rb +14 -15
  101. data/lib/ory-kratos-client/models/revoke_session.rb +212 -0
  102. data/lib/ory-kratos-client/models/session.rb +29 -20
  103. data/lib/ory-kratos-client/models/settings_flow.rb +333 -0
  104. data/lib/ory-kratos-client/models/settings_flow_method.rb +226 -0
  105. data/lib/ory-kratos-client/models/settings_flow_method_config.rb +255 -0
  106. data/lib/ory-kratos-client/models/settings_request.rb +24 -14
  107. data/lib/ory-kratos-client/models/settings_request_method.rb +2 -2
  108. data/lib/ory-kratos-client/models/settings_via_api_response.rb +226 -0
  109. data/lib/ory-kratos-client/models/update_identity.rb +222 -0
  110. data/lib/ory-kratos-client/models/verifiable_address.rb +17 -17
  111. data/lib/ory-kratos-client/models/verification_flow.rb +299 -0
  112. data/lib/ory-kratos-client/models/verification_flow_method.rb +226 -0
  113. data/lib/ory-kratos-client/models/verification_flow_method_config.rb +255 -0
  114. data/lib/ory-kratos-client/models/verification_request.rb +14 -3
  115. data/lib/ory-kratos-client/models/version.rb +2 -2
  116. data/lib/ory-kratos-client/version.rb +3 -3
  117. data/ory-kratos-client.gemspec +2 -2
  118. data/spec/models/complete_self_service_login_flow_with_password_method_spec.rb +53 -0
  119. data/spec/models/complete_self_service_recovery_flow_with_link_method_spec.rb +47 -0
  120. data/spec/models/complete_self_service_settings_flow_with_password_method_spec.rb +47 -0
  121. data/spec/models/complete_self_service_verification_flow_with_link_method_spec.rb +47 -0
  122. data/spec/models/create_identity_spec.rb +47 -0
  123. data/spec/models/create_recovery_link_spec.rb +47 -0
  124. data/spec/models/login_flow_method_config_spec.rb +65 -0
  125. data/spec/models/login_flow_method_spec.rb +47 -0
  126. data/spec/models/login_flow_spec.rb +89 -0
  127. data/spec/models/login_via_api_response_spec.rb +47 -0
  128. data/spec/models/message_spec.rb +59 -0
  129. data/spec/models/provider_credentials_config_spec.rb +47 -0
  130. data/spec/models/recovery_address_spec.rb +53 -0
  131. data/spec/models/recovery_flow_method_config_spec.rb +59 -0
  132. data/spec/models/recovery_flow_method_spec.rb +47 -0
  133. data/spec/models/recovery_flow_spec.rb +89 -0
  134. data/spec/models/recovery_link_spec.rb +47 -0
  135. data/spec/models/recovery_request_method_spec.rb +47 -0
  136. data/spec/models/recovery_request_spec.rb +83 -0
  137. data/spec/models/registration_flow_method_config_spec.rb +65 -0
  138. data/spec/models/registration_flow_method_spec.rb +47 -0
  139. data/spec/models/registration_flow_spec.rb +83 -0
  140. data/spec/models/registration_via_api_response_spec.rb +53 -0
  141. data/spec/models/revoke_session_spec.rb +41 -0
  142. data/spec/models/settings_flow_method_config_spec.rb +59 -0
  143. data/spec/models/settings_flow_method_spec.rb +47 -0
  144. data/spec/models/settings_flow_spec.rb +95 -0
  145. data/spec/models/settings_via_api_response_spec.rb +47 -0
  146. data/spec/models/update_identity_spec.rb +47 -0
  147. data/spec/models/verification_flow_method_config_spec.rb +59 -0
  148. data/spec/models/verification_flow_method_spec.rb +47 -0
  149. data/spec/models/verification_flow_spec.rb +89 -0
  150. metadata +152 -24
@@ -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.5.1-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.5.1-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
 
@@ -48,7 +48,7 @@ module OryHydraClient
48
48
  {
49
49
  :'code' => :'Integer',
50
50
  :'debug' => :'String',
51
- :'details' => :'Hash<String, Object>',
51
+ :'details' => :'Object',
52
52
  :'message' => :'String',
53
53
  :'reason' => :'String',
54
54
  :'request' => :'String',
@@ -86,9 +86,7 @@ module OryHydraClient
86
86
  end
87
87
 
88
88
  if attributes.key?(:'details')
89
- if (value = attributes[:'details']).is_a?(Hash)
90
- self.details = value
91
- end
89
+ self.details = attributes[:'details']
92
90
  end
93
91
 
94
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.5.1-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.5.1-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.5.1-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
25
27
 
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
28
+ attr_accessor :traits
29
+
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,16 @@ 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.')
117
+ end
118
+
119
+ if @schema_url.nil?
120
+ invalid_properties.push('invalid value for "schema_url", schema_url cannot be nil.')
105
121
  end
106
122
 
107
- if @traits_schema_id.nil?
108
- invalid_properties.push('invalid value for "traits_schema_id", traits_schema_id cannot be nil.')
123
+ if @traits.nil?
124
+ invalid_properties.push('invalid value for "traits", traits cannot be nil.')
109
125
  end
110
126
 
111
127
  invalid_properties
@@ -115,8 +131,9 @@ module OryHydraClient
115
131
  # @return true if the model is valid
116
132
  def valid?
117
133
  return false if @id.nil?
134
+ return false if @schema_id.nil?
135
+ return false if @schema_url.nil?
118
136
  return false if @traits.nil?
119
- return false if @traits_schema_id.nil?
120
137
  true
121
138
  end
122
139
 
@@ -125,11 +142,12 @@ module OryHydraClient
125
142
  def ==(o)
126
143
  return true if self.equal?(o)
127
144
  self.class == o.class &&
128
- addresses == o.addresses &&
129
145
  id == o.id &&
146
+ recovery_addresses == o.recovery_addresses &&
147
+ schema_id == o.schema_id &&
148
+ schema_url == o.schema_url &&
130
149
  traits == o.traits &&
131
- traits_schema_id == o.traits_schema_id &&
132
- traits_schema_url == o.traits_schema_url
150
+ verifiable_addresses == o.verifiable_addresses
133
151
  end
134
152
 
135
153
  # @see the `==` method
@@ -141,7 +159,7 @@ module OryHydraClient
141
159
  # Calculates hash code according to all attributes.
142
160
  # @return [Integer] Hash code
143
161
  def hash
144
- [addresses, id, traits, traits_schema_id, traits_schema_url].hash
162
+ [id, recovery_addresses, schema_id, schema_url, traits, verifiable_addresses].hash
145
163
  end
146
164
 
147
165
  # Builds the object from hash
@@ -0,0 +1,315 @@
1
+ =begin
2
+ #Ory Kratos
3
+
4
+ #Welcome to the ORY Kratos HTTP API documentation!
5
+
6
+ The version of the OpenAPI document: v0.5.1-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
+ # This object represents a login flow. A login flow is initiated at the \"Initiate Login API / Browser Flow\" endpoint by a client. Once a login flow is completed successfully, a session cookie or session token will be issued.
17
+ class LoginFlow
18
+ # and so on.
19
+ attr_accessor :active
20
+
21
+ # ExpiresAt is the time (UTC) when the flow expires. If the user still wishes to log in, a new flow has to be initiated.
22
+ attr_accessor :expires_at
23
+
24
+ # Forced stores whether this login flow should enforce re-authentication.
25
+ attr_accessor :forced
26
+
27
+ attr_accessor :id
28
+
29
+ # IssuedAt is the time (UTC) when the flow started.
30
+ attr_accessor :issued_at
31
+
32
+ attr_accessor :messages
33
+
34
+ # List of login methods This is the list of available login methods with their required form fields, such as `identifier` and `password` for the password login method. This will also contain error messages such as \"password can not be empty\".
35
+ attr_accessor :methods
36
+
37
+ # RequestURL is the initial URL that was requested from ORY Kratos. It can be used to forward information contained in the URL's path or query for example.
38
+ attr_accessor :request_url
39
+
40
+ # The flow type can either be `api` or `browser`.
41
+ attr_accessor :type
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'active' => :'active',
47
+ :'expires_at' => :'expires_at',
48
+ :'forced' => :'forced',
49
+ :'id' => :'id',
50
+ :'issued_at' => :'issued_at',
51
+ :'messages' => :'messages',
52
+ :'methods' => :'methods',
53
+ :'request_url' => :'request_url',
54
+ :'type' => :'type'
55
+ }
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'active' => :'String',
62
+ :'expires_at' => :'DateTime',
63
+ :'forced' => :'Boolean',
64
+ :'id' => :'String',
65
+ :'issued_at' => :'DateTime',
66
+ :'messages' => :'Array<Message>',
67
+ :'methods' => :'Hash<String, LoginFlowMethod>',
68
+ :'request_url' => :'String',
69
+ :'type' => :'String'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::LoginFlow` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::LoginFlow`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'active')
95
+ self.active = attributes[:'active']
96
+ end
97
+
98
+ if attributes.key?(:'expires_at')
99
+ self.expires_at = attributes[:'expires_at']
100
+ end
101
+
102
+ if attributes.key?(:'forced')
103
+ self.forced = attributes[:'forced']
104
+ end
105
+
106
+ if attributes.key?(:'id')
107
+ self.id = attributes[:'id']
108
+ end
109
+
110
+ if attributes.key?(:'issued_at')
111
+ self.issued_at = attributes[:'issued_at']
112
+ end
113
+
114
+ if attributes.key?(:'messages')
115
+ if (value = attributes[:'messages']).is_a?(Array)
116
+ self.messages = value
117
+ end
118
+ end
119
+
120
+ if attributes.key?(:'methods')
121
+ if (value = attributes[:'methods']).is_a?(Hash)
122
+ self.methods = value
123
+ end
124
+ end
125
+
126
+ if attributes.key?(:'request_url')
127
+ self.request_url = attributes[:'request_url']
128
+ end
129
+
130
+ if attributes.key?(:'type')
131
+ self.type = attributes[:'type']
132
+ end
133
+ end
134
+
135
+ # Show invalid properties with the reasons. Usually used together with valid?
136
+ # @return Array for valid properties with the reasons
137
+ def list_invalid_properties
138
+ invalid_properties = Array.new
139
+ if @expires_at.nil?
140
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
141
+ end
142
+
143
+ if @id.nil?
144
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
145
+ end
146
+
147
+ if @issued_at.nil?
148
+ invalid_properties.push('invalid value for "issued_at", issued_at cannot be nil.')
149
+ end
150
+
151
+ if @methods.nil?
152
+ invalid_properties.push('invalid value for "methods", methods cannot be nil.')
153
+ end
154
+
155
+ if @request_url.nil?
156
+ invalid_properties.push('invalid value for "request_url", request_url cannot be nil.')
157
+ end
158
+
159
+ invalid_properties
160
+ end
161
+
162
+ # Check to see if the all the properties in the model are valid
163
+ # @return true if the model is valid
164
+ def valid?
165
+ return false if @expires_at.nil?
166
+ return false if @id.nil?
167
+ return false if @issued_at.nil?
168
+ return false if @methods.nil?
169
+ return false if @request_url.nil?
170
+ true
171
+ end
172
+
173
+ # Checks equality by comparing each attribute.
174
+ # @param [Object] Object to be compared
175
+ def ==(o)
176
+ return true if self.equal?(o)
177
+ self.class == o.class &&
178
+ active == o.active &&
179
+ expires_at == o.expires_at &&
180
+ forced == o.forced &&
181
+ id == o.id &&
182
+ issued_at == o.issued_at &&
183
+ messages == o.messages &&
184
+ methods == o.methods &&
185
+ request_url == o.request_url &&
186
+ type == o.type
187
+ end
188
+
189
+ # @see the `==` method
190
+ # @param [Object] Object to be compared
191
+ def eql?(o)
192
+ self == o
193
+ end
194
+
195
+ # Calculates hash code according to all attributes.
196
+ # @return [Integer] Hash code
197
+ def hash
198
+ [active, expires_at, forced, id, issued_at, messages, methods, request_url, type].hash
199
+ end
200
+
201
+ # Builds the object from hash
202
+ # @param [Hash] attributes Model attributes in the form of hash
203
+ # @return [Object] Returns the model itself
204
+ def self.build_from_hash(attributes)
205
+ new.build_from_hash(attributes)
206
+ end
207
+
208
+ # Builds the object from hash
209
+ # @param [Hash] attributes Model attributes in the form of hash
210
+ # @return [Object] Returns the model itself
211
+ def build_from_hash(attributes)
212
+ return nil unless attributes.is_a?(Hash)
213
+ self.class.openapi_types.each_pair do |key, type|
214
+ if type =~ /\AArray<(.*)>/i
215
+ # check to ensure the input is an array given that the attribute
216
+ # is documented as an array but the input is not
217
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
218
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
219
+ end
220
+ elsif !attributes[self.class.attribute_map[key]].nil?
221
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
222
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
223
+ end
224
+
225
+ self
226
+ end
227
+
228
+ # Deserializes the data based on type
229
+ # @param string type Data type
230
+ # @param string value Value to be deserialized
231
+ # @return [Object] Deserialized data
232
+ def _deserialize(type, value)
233
+ case type.to_sym
234
+ when :DateTime
235
+ DateTime.parse(value)
236
+ when :Date
237
+ Date.parse(value)
238
+ when :String
239
+ value.to_s
240
+ when :Integer
241
+ value.to_i
242
+ when :Float
243
+ value.to_f
244
+ when :Boolean
245
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
246
+ true
247
+ else
248
+ false
249
+ end
250
+ when :Object
251
+ # generic object (usually a Hash), return directly
252
+ value
253
+ when /\AArray<(?<inner_type>.+)>\z/
254
+ inner_type = Regexp.last_match[:inner_type]
255
+ value.map { |v| _deserialize(inner_type, v) }
256
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
257
+ k_type = Regexp.last_match[:k_type]
258
+ v_type = Regexp.last_match[:v_type]
259
+ {}.tap do |hash|
260
+ value.each do |k, v|
261
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
262
+ end
263
+ end
264
+ else # model
265
+ OryHydraClient.const_get(type).build_from_hash(value)
266
+ end
267
+ end
268
+
269
+ # Returns the string representation of the object
270
+ # @return [String] String presentation of the object
271
+ def to_s
272
+ to_hash.to_s
273
+ end
274
+
275
+ # to_body is an alias to to_hash (backward compatibility)
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_body
278
+ to_hash
279
+ end
280
+
281
+ # Returns the object in the form of hash
282
+ # @return [Hash] Returns the object in the form of hash
283
+ def to_hash
284
+ hash = {}
285
+ self.class.attribute_map.each_pair do |attr, param|
286
+ value = self.send(attr)
287
+ if value.nil?
288
+ is_nullable = self.class.openapi_nullable.include?(attr)
289
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
290
+ end
291
+
292
+ hash[param] = _to_hash(value)
293
+ end
294
+ hash
295
+ end
296
+
297
+ # Outputs non-array value in the form of hash
298
+ # For object, use to_hash. Otherwise, just return the value
299
+ # @param [Object] value Any valid value
300
+ # @return [Hash] Returns the value in the form of hash
301
+ def _to_hash(value)
302
+ if value.is_a?(Array)
303
+ value.compact.map { |v| _to_hash(v) }
304
+ elsif value.is_a?(Hash)
305
+ {}.tap do |hash|
306
+ value.each { |k, v| hash[k] = _to_hash(v) }
307
+ end
308
+ elsif value.respond_to? :to_hash
309
+ value.to_hash
310
+ else
311
+ value
312
+ end
313
+ end
314
+ end
315
+ end