mailslurp_client 16.1.5 → 16.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 856fe42228f69fb4c2f0d63942ebc8abbfdceb45993a801761dfc88bb9218b3e
4
- data.tar.gz: 0bbdb8d6f4c7761c9e072402f38c11d3fb8573a95301f80883de226f7a9f3bfa
3
+ metadata.gz: 046f54f4c97fa71f3c64ab19a82f73c7b315d130ae7232823d0ee2131711e0a7
4
+ data.tar.gz: 90cd94daa6768eb68fe9f075fc109d8baed4ec9f444789eedf24074925a283ea
5
5
  SHA512:
6
- metadata.gz: 34cac678e2664a9f8a9ee70538a5425e99467e0d51d758bcdca8fb618b8603838ab4e085673dc87847d30693c36dcd38bfee4e28568de883694e2d7799c140e7
7
- data.tar.gz: 36a034b7bbba942f0ecb57028d83bc7389c9e18d72e167b4fab1cb0c2d4c533221abae5a15ba5a08decd92e6165cc03426b0899b0c7b876f41eb38ef71c14a88
6
+ metadata.gz: e8bb97482670eaf091366ea9e40cb13986358ef4b28db5fd3c64fb7dfe1ebbd4f14e726fffc5bba4a06b7b9f9ac1fd331bb200744a8dc56bcf1cf08f31dfecf6
7
+ data.tar.gz: ec578c686fb969a865972b4488966a91f01459d26d3242c4dd29d8fc5eb66af2ebd34a32472181c100477ece42eafa35eeecd6a87105762513a1ce33f7fe780d
@@ -0,0 +1,353 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails and SMS from dynamically allocated email addresses and phone numbers. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+ Contact: contact@mailslurp.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module MailSlurpClient
16
+ class MFAControllerApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a TOTP device from custom options
23
+ # Create a virtual TOTP device for custom options specifying all parameters of the TOTP device.
24
+ # @param create_totp_device_otp_auth_url_options [CreateTotpDeviceOtpAuthUrlOptions]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [TotpDeviceDto]
27
+ def create_totp_device_for_custom(create_totp_device_otp_auth_url_options, opts = {})
28
+ data, _status_code, _headers = create_totp_device_for_custom_with_http_info(create_totp_device_otp_auth_url_options, opts)
29
+ data
30
+ end
31
+
32
+ # Create a TOTP device from custom options
33
+ # Create a virtual TOTP device for custom options specifying all parameters of the TOTP device.
34
+ # @param create_totp_device_otp_auth_url_options [CreateTotpDeviceOtpAuthUrlOptions]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(TotpDeviceDto, Integer, Hash)>] TotpDeviceDto data, response status code and response headers
37
+ def create_totp_device_for_custom_with_http_info(create_totp_device_otp_auth_url_options, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: MFAControllerApi.create_totp_device_for_custom ...'
40
+ end
41
+ # verify the required parameter 'create_totp_device_otp_auth_url_options' is set
42
+ if @api_client.config.client_side_validation && create_totp_device_otp_auth_url_options.nil?
43
+ fail ArgumentError, "Missing the required parameter 'create_totp_device_otp_auth_url_options' when calling MFAControllerApi.create_totp_device_for_custom"
44
+ end
45
+ # resource path
46
+ local_var_path = '/mfa/totp/device/custom'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
55
+ # HTTP header 'Content-Type'
56
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
57
+
58
+ # form parameters
59
+ form_params = opts[:form_params] || {}
60
+
61
+ # http body (model)
62
+ post_body = opts[:body] || @api_client.object_to_http_body(create_totp_device_otp_auth_url_options)
63
+
64
+ # return_type
65
+ return_type = opts[:return_type] || 'TotpDeviceDto'
66
+
67
+ # auth_names
68
+ auth_names = opts[:auth_names] || ['API_KEY']
69
+
70
+ new_options = opts.merge(
71
+ :header_params => header_params,
72
+ :query_params => query_params,
73
+ :form_params => form_params,
74
+ :body => post_body,
75
+ :auth_names => auth_names,
76
+ :return_type => return_type
77
+ )
78
+
79
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
80
+ if @api_client.config.debugging
81
+ @api_client.config.logger.debug "API called: MFAControllerApi#create_totp_device_for_custom\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
82
+ end
83
+ return data, status_code, headers
84
+ end
85
+
86
+ # Create a TOTP device from an OTP Auth URL
87
+ # Create a virtual TOTP device for a given OTP Auth URL such as otpauth://totp/MyApp:alice@example.com?secret=ABC123&issuer=MyApp&period=30&digits=6&algorithm=SHA1. You can provider overrides in the options for each component of the URL.
88
+ # @param create_totp_device_otp_auth_url_options [CreateTotpDeviceOtpAuthUrlOptions]
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [TotpDeviceDto]
91
+ def create_totp_device_for_otp_auth_url(create_totp_device_otp_auth_url_options, opts = {})
92
+ data, _status_code, _headers = create_totp_device_for_otp_auth_url_with_http_info(create_totp_device_otp_auth_url_options, opts)
93
+ data
94
+ end
95
+
96
+ # Create a TOTP device from an OTP Auth URL
97
+ # Create a virtual TOTP device for a given OTP Auth URL such as otpauth://totp/MyApp:alice@example.com?secret&#x3D;ABC123&amp;issuer&#x3D;MyApp&amp;period&#x3D;30&amp;digits&#x3D;6&amp;algorithm&#x3D;SHA1. You can provider overrides in the options for each component of the URL.
98
+ # @param create_totp_device_otp_auth_url_options [CreateTotpDeviceOtpAuthUrlOptions]
99
+ # @param [Hash] opts the optional parameters
100
+ # @return [Array<(TotpDeviceDto, Integer, Hash)>] TotpDeviceDto data, response status code and response headers
101
+ def create_totp_device_for_otp_auth_url_with_http_info(create_totp_device_otp_auth_url_options, opts = {})
102
+ if @api_client.config.debugging
103
+ @api_client.config.logger.debug 'Calling API: MFAControllerApi.create_totp_device_for_otp_auth_url ...'
104
+ end
105
+ # verify the required parameter 'create_totp_device_otp_auth_url_options' is set
106
+ if @api_client.config.client_side_validation && create_totp_device_otp_auth_url_options.nil?
107
+ fail ArgumentError, "Missing the required parameter 'create_totp_device_otp_auth_url_options' when calling MFAControllerApi.create_totp_device_for_otp_auth_url"
108
+ end
109
+ # resource path
110
+ local_var_path = '/mfa/totp/device/otpAuthUrl'
111
+
112
+ # query parameters
113
+ query_params = opts[:query_params] || {}
114
+
115
+ # header parameters
116
+ header_params = opts[:header_params] || {}
117
+ # HTTP header 'Accept' (if needed)
118
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
119
+ # HTTP header 'Content-Type'
120
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
121
+
122
+ # form parameters
123
+ form_params = opts[:form_params] || {}
124
+
125
+ # http body (model)
126
+ post_body = opts[:body] || @api_client.object_to_http_body(create_totp_device_otp_auth_url_options)
127
+
128
+ # return_type
129
+ return_type = opts[:return_type] || 'TotpDeviceDto'
130
+
131
+ # auth_names
132
+ auth_names = opts[:auth_names] || ['API_KEY']
133
+
134
+ new_options = opts.merge(
135
+ :header_params => header_params,
136
+ :query_params => query_params,
137
+ :form_params => form_params,
138
+ :body => post_body,
139
+ :auth_names => auth_names,
140
+ :return_type => return_type
141
+ )
142
+
143
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
144
+ if @api_client.config.debugging
145
+ @api_client.config.logger.debug "API called: MFAControllerApi#create_totp_device_for_otp_auth_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
146
+ end
147
+ return data, status_code, headers
148
+ end
149
+
150
+ # Get a TOTP device by ID
151
+ # Get Time-Based One-Time Password (TOTP) device by its ID.
152
+ # @param id [String]
153
+ # @param [Hash] opts the optional parameters
154
+ # @return [TotpDeviceDto]
155
+ def get_totp_device(id, opts = {})
156
+ data, _status_code, _headers = get_totp_device_with_http_info(id, opts)
157
+ data
158
+ end
159
+
160
+ # Get a TOTP device by ID
161
+ # Get Time-Based One-Time Password (TOTP) device by its ID.
162
+ # @param id [String]
163
+ # @param [Hash] opts the optional parameters
164
+ # @return [Array<(TotpDeviceDto, Integer, Hash)>] TotpDeviceDto data, response status code and response headers
165
+ def get_totp_device_with_http_info(id, opts = {})
166
+ if @api_client.config.debugging
167
+ @api_client.config.logger.debug 'Calling API: MFAControllerApi.get_totp_device ...'
168
+ end
169
+ # verify the required parameter 'id' is set
170
+ if @api_client.config.client_side_validation && id.nil?
171
+ fail ArgumentError, "Missing the required parameter 'id' when calling MFAControllerApi.get_totp_device"
172
+ end
173
+ # resource path
174
+ local_var_path = '/mfa/totp/device/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
175
+
176
+ # query parameters
177
+ query_params = opts[:query_params] || {}
178
+
179
+ # header parameters
180
+ header_params = opts[:header_params] || {}
181
+ # HTTP header 'Accept' (if needed)
182
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
183
+
184
+ # form parameters
185
+ form_params = opts[:form_params] || {}
186
+
187
+ # http body (model)
188
+ post_body = opts[:body]
189
+
190
+ # return_type
191
+ return_type = opts[:return_type] || 'TotpDeviceDto'
192
+
193
+ # auth_names
194
+ auth_names = opts[:auth_names] || ['API_KEY']
195
+
196
+ new_options = opts.merge(
197
+ :header_params => header_params,
198
+ :query_params => query_params,
199
+ :form_params => form_params,
200
+ :body => post_body,
201
+ :auth_names => auth_names,
202
+ :return_type => return_type
203
+ )
204
+
205
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
206
+ if @api_client.config.debugging
207
+ @api_client.config.logger.debug "API called: MFAControllerApi#get_totp_device\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
208
+ end
209
+ return data, status_code, headers
210
+ end
211
+
212
+ # Get a TOTP device by username, issuer, or name. Returns empty if not found.
213
+ # Get Time-Based One-Time Password (TOTP) device by its username and issuer mapping.
214
+ # @param [Hash] opts the optional parameters
215
+ # @option opts [String] :name Optional name filter
216
+ # @option opts [String] :issuer Optional issuer filter
217
+ # @option opts [String] :username Optional username filter
218
+ # @return [TotpDeviceOptionalDto]
219
+ def get_totp_device_by(opts = {})
220
+ data, _status_code, _headers = get_totp_device_by_with_http_info(opts)
221
+ data
222
+ end
223
+
224
+ # Get a TOTP device by username, issuer, or name. Returns empty if not found.
225
+ # Get Time-Based One-Time Password (TOTP) device by its username and issuer mapping.
226
+ # @param [Hash] opts the optional parameters
227
+ # @option opts [String] :name Optional name filter
228
+ # @option opts [String] :issuer Optional issuer filter
229
+ # @option opts [String] :username Optional username filter
230
+ # @return [Array<(TotpDeviceOptionalDto, Integer, Hash)>] TotpDeviceOptionalDto data, response status code and response headers
231
+ def get_totp_device_by_with_http_info(opts = {})
232
+ if @api_client.config.debugging
233
+ @api_client.config.logger.debug 'Calling API: MFAControllerApi.get_totp_device_by ...'
234
+ end
235
+ # resource path
236
+ local_var_path = '/mfa/totp/device/by'
237
+
238
+ # query parameters
239
+ query_params = opts[:query_params] || {}
240
+ query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
241
+ query_params[:'issuer'] = opts[:'issuer'] if !opts[:'issuer'].nil?
242
+ query_params[:'username'] = opts[:'username'] if !opts[:'username'].nil?
243
+
244
+ # header parameters
245
+ header_params = opts[:header_params] || {}
246
+ # HTTP header 'Accept' (if needed)
247
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
248
+
249
+ # form parameters
250
+ form_params = opts[:form_params] || {}
251
+
252
+ # http body (model)
253
+ post_body = opts[:body]
254
+
255
+ # return_type
256
+ return_type = opts[:return_type] || 'TotpDeviceOptionalDto'
257
+
258
+ # auth_names
259
+ auth_names = opts[:auth_names] || ['API_KEY']
260
+
261
+ new_options = opts.merge(
262
+ :header_params => header_params,
263
+ :query_params => query_params,
264
+ :form_params => form_params,
265
+ :body => post_body,
266
+ :auth_names => auth_names,
267
+ :return_type => return_type
268
+ )
269
+
270
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
271
+ if @api_client.config.debugging
272
+ @api_client.config.logger.debug "API called: MFAControllerApi#get_totp_device_by\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
273
+ end
274
+ return data, status_code, headers
275
+ end
276
+
277
+ # Get a TOTP device code by device ID
278
+ # Get Time-Based One-Time Password for a device by its ID.
279
+ # @param id [String] ID of the TOTP device to get the code for
280
+ # @param [Hash] opts the optional parameters
281
+ # @option opts [DateTime] :at Optional time to get code for. If not provided, current time is used.
282
+ # @option opts [Integer] :min_seconds_until_expire Optional minimum time until code expires. Will hold thread open until period reached. (default to 5)
283
+ # @return [TotpDeviceCodeDto]
284
+ def get_totp_device_code(id, opts = {})
285
+ data, _status_code, _headers = get_totp_device_code_with_http_info(id, opts)
286
+ data
287
+ end
288
+
289
+ # Get a TOTP device code by device ID
290
+ # Get Time-Based One-Time Password for a device by its ID.
291
+ # @param id [String] ID of the TOTP device to get the code for
292
+ # @param [Hash] opts the optional parameters
293
+ # @option opts [DateTime] :at Optional time to get code for. If not provided, current time is used.
294
+ # @option opts [Integer] :min_seconds_until_expire Optional minimum time until code expires. Will hold thread open until period reached.
295
+ # @return [Array<(TotpDeviceCodeDto, Integer, Hash)>] TotpDeviceCodeDto data, response status code and response headers
296
+ def get_totp_device_code_with_http_info(id, opts = {})
297
+ if @api_client.config.debugging
298
+ @api_client.config.logger.debug 'Calling API: MFAControllerApi.get_totp_device_code ...'
299
+ end
300
+ # verify the required parameter 'id' is set
301
+ if @api_client.config.client_side_validation && id.nil?
302
+ fail ArgumentError, "Missing the required parameter 'id' when calling MFAControllerApi.get_totp_device_code"
303
+ end
304
+ if @api_client.config.client_side_validation && !opts[:'min_seconds_until_expire'].nil? && opts[:'min_seconds_until_expire'] > 30
305
+ fail ArgumentError, 'invalid value for "opts[:"min_seconds_until_expire"]" when calling MFAControllerApi.get_totp_device_code, must be smaller than or equal to 30.'
306
+ end
307
+
308
+ if @api_client.config.client_side_validation && !opts[:'min_seconds_until_expire'].nil? && opts[:'min_seconds_until_expire'] < 1
309
+ fail ArgumentError, 'invalid value for "opts[:"min_seconds_until_expire"]" when calling MFAControllerApi.get_totp_device_code, must be greater than or equal to 1.'
310
+ end
311
+
312
+ # resource path
313
+ local_var_path = '/mfa/totp/device/{id}/code'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
314
+
315
+ # query parameters
316
+ query_params = opts[:query_params] || {}
317
+ query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?
318
+ query_params[:'minSecondsUntilExpire'] = opts[:'min_seconds_until_expire'] if !opts[:'min_seconds_until_expire'].nil?
319
+
320
+ # header parameters
321
+ header_params = opts[:header_params] || {}
322
+ # HTTP header 'Accept' (if needed)
323
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
324
+
325
+ # form parameters
326
+ form_params = opts[:form_params] || {}
327
+
328
+ # http body (model)
329
+ post_body = opts[:body]
330
+
331
+ # return_type
332
+ return_type = opts[:return_type] || 'TotpDeviceCodeDto'
333
+
334
+ # auth_names
335
+ auth_names = opts[:auth_names] || ['API_KEY']
336
+
337
+ new_options = opts.merge(
338
+ :header_params => header_params,
339
+ :query_params => query_params,
340
+ :form_params => form_params,
341
+ :body => post_body,
342
+ :auth_names => auth_names,
343
+ :return_type => return_type
344
+ )
345
+
346
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
347
+ if @api_client.config.debugging
348
+ @api_client.config.logger.debug "API called: MFAControllerApi#get_totp_device_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
349
+ end
350
+ return data, status_code, headers
351
+ end
352
+ end
353
+ end
@@ -0,0 +1,271 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails and SMS from dynamically allocated email addresses and phone numbers. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+ Contact: contact@mailslurp.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MailSlurpClient
16
+ class CreateTotpDeviceOtpAuthUrlOptions
17
+ attr_accessor :otp_auth_url
18
+
19
+ attr_accessor :name
20
+
21
+ attr_accessor :username
22
+
23
+ attr_accessor :issuer
24
+
25
+ attr_accessor :digits
26
+
27
+ attr_accessor :period
28
+
29
+ attr_accessor :algorithm
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'otp_auth_url' => :'otpAuthUrl',
35
+ :'name' => :'name',
36
+ :'username' => :'username',
37
+ :'issuer' => :'issuer',
38
+ :'digits' => :'digits',
39
+ :'period' => :'period',
40
+ :'algorithm' => :'algorithm'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'otp_auth_url' => :'String',
48
+ :'name' => :'String',
49
+ :'username' => :'String',
50
+ :'issuer' => :'String',
51
+ :'digits' => :'Integer',
52
+ :'period' => :'Integer',
53
+ :'algorithm' => :'String'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+ :'name',
61
+ :'username',
62
+ :'issuer',
63
+ :'digits',
64
+ :'period',
65
+ :'algorithm'
66
+ ])
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ if (!attributes.is_a?(Hash))
73
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::CreateTotpDeviceOtpAuthUrlOptions` initialize method"
74
+ end
75
+
76
+ # check to see if the attribute exists and convert string to symbol for hash key
77
+ attributes = attributes.each_with_object({}) { |(k, v), h|
78
+ if (!self.class.attribute_map.key?(k.to_sym))
79
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::CreateTotpDeviceOtpAuthUrlOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
80
+ end
81
+ h[k.to_sym] = v
82
+ }
83
+
84
+ if attributes.key?(:'otp_auth_url')
85
+ self.otp_auth_url = attributes[:'otp_auth_url']
86
+ end
87
+
88
+ if attributes.key?(:'name')
89
+ self.name = attributes[:'name']
90
+ end
91
+
92
+ if attributes.key?(:'username')
93
+ self.username = attributes[:'username']
94
+ end
95
+
96
+ if attributes.key?(:'issuer')
97
+ self.issuer = attributes[:'issuer']
98
+ end
99
+
100
+ if attributes.key?(:'digits')
101
+ self.digits = attributes[:'digits']
102
+ end
103
+
104
+ if attributes.key?(:'period')
105
+ self.period = attributes[:'period']
106
+ end
107
+
108
+ if attributes.key?(:'algorithm')
109
+ self.algorithm = attributes[:'algorithm']
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ invalid_properties = Array.new
117
+ if @otp_auth_url.nil?
118
+ invalid_properties.push('invalid value for "otp_auth_url", otp_auth_url cannot be nil.')
119
+ end
120
+
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ return false if @otp_auth_url.nil?
128
+ true
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ otp_auth_url == o.otp_auth_url &&
137
+ name == o.name &&
138
+ username == o.username &&
139
+ issuer == o.issuer &&
140
+ digits == o.digits &&
141
+ period == o.period &&
142
+ algorithm == o.algorithm
143
+ end
144
+
145
+ # @see the `==` method
146
+ # @param [Object] Object to be compared
147
+ def eql?(o)
148
+ self == o
149
+ end
150
+
151
+ # Calculates hash code according to all attributes.
152
+ # @return [Integer] Hash code
153
+ def hash
154
+ [otp_auth_url, name, username, issuer, digits, period, algorithm].hash
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def self.build_from_hash(attributes)
161
+ new.build_from_hash(attributes)
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ self.class.openapi_types.each_pair do |key, type|
170
+ if type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
174
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
175
+ end
176
+ elsif !attributes[self.class.attribute_map[key]].nil?
177
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
179
+ end
180
+
181
+ self
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def _deserialize(type, value)
189
+ case type.to_sym
190
+ when :DateTime
191
+ DateTime.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :Boolean
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ MailSlurpClient.const_get(type).build_from_hash(value)
222
+ end
223
+ end
224
+
225
+ # Returns the string representation of the object
226
+ # @return [String] String presentation of the object
227
+ def to_s
228
+ to_hash.to_s
229
+ end
230
+
231
+ # to_body is an alias to to_hash (backward compatibility)
232
+ # @return [Hash] Returns the object in the form of hash
233
+ def to_body
234
+ to_hash
235
+ end
236
+
237
+ # Returns the object in the form of hash
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_hash
240
+ hash = {}
241
+ self.class.attribute_map.each_pair do |attr, param|
242
+ value = self.send(attr)
243
+ if value.nil?
244
+ is_nullable = self.class.openapi_nullable.include?(attr)
245
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
246
+ end
247
+
248
+ hash[param] = _to_hash(value)
249
+ end
250
+ hash
251
+ end
252
+
253
+ # Outputs non-array value in the form of hash
254
+ # For object, use to_hash. Otherwise, just return the value
255
+ # @param [Object] value Any valid value
256
+ # @return [Hash] Returns the value in the form of hash
257
+ def _to_hash(value)
258
+ if value.is_a?(Array)
259
+ value.compact.map { |v| _to_hash(v) }
260
+ elsif value.is_a?(Hash)
261
+ {}.tap do |hash|
262
+ value.each { |k, v| hash[k] = _to_hash(v) }
263
+ end
264
+ elsif value.respond_to? :to_hash
265
+ value.to_hash
266
+ else
267
+ value
268
+ end
269
+ end
270
+ end
271
+ end