pescheck-client 0.0.5

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.
Files changed (143) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +182 -0
  4. data/Rakefile +10 -0
  5. data/docs/AuthenticationApi.md +217 -0
  6. data/docs/ChecksApi.md +147 -0
  7. data/docs/CustomTokenObtainPair.md +20 -0
  8. data/docs/DivisionReadOnly.md +46 -0
  9. data/docs/DivisionWrite.md +40 -0
  10. data/docs/DivisionsApi.md +369 -0
  11. data/docs/JWTGeneration.md +24 -0
  12. data/docs/JWTResponse.md +28 -0
  13. data/docs/OAuthApi.md +213 -0
  14. data/docs/OAuthApplication.md +26 -0
  15. data/docs/OAuthApplicationResponse.md +32 -0
  16. data/docs/PaginatedDivisionReadOnlyList.md +24 -0
  17. data/docs/PaginatedV2ProfileListItemList.md +24 -0
  18. data/docs/PaginatedV2ScreeningListItemList.md +24 -0
  19. data/docs/PatchedDivisionWrite.md +40 -0
  20. data/docs/PatchedV2ProfilePartialUpdate.md +20 -0
  21. data/docs/ProfilesApi.md +438 -0
  22. data/docs/ScreeningsApi.md +293 -0
  23. data/docs/TokenRefresh.md +20 -0
  24. data/docs/V2Candidate.md +36 -0
  25. data/docs/V2CheckField.md +26 -0
  26. data/docs/V2CheckInfo.md +40 -0
  27. data/docs/V2Document.md +28 -0
  28. data/docs/V2DocumentContent.md +20 -0
  29. data/docs/V2Money.md +20 -0
  30. data/docs/V2ProfileCheck.md +20 -0
  31. data/docs/V2ProfileCheckEntry.md +30 -0
  32. data/docs/V2ProfileCreate.md +22 -0
  33. data/docs/V2ProfileDetail.md +38 -0
  34. data/docs/V2ProfileListItem.md +30 -0
  35. data/docs/V2ProfileUpdate.md +22 -0
  36. data/docs/V2ProfileUpdateCheck.md +22 -0
  37. data/docs/V2ScreeningCheck.md +24 -0
  38. data/docs/V2ScreeningCheckEntry.md +34 -0
  39. data/docs/V2ScreeningCheckListItem.md +22 -0
  40. data/docs/V2ScreeningCreate.md +22 -0
  41. data/docs/V2ScreeningDetail.md +34 -0
  42. data/docs/V2ScreeningDetailProfile.md +20 -0
  43. data/docs/V2ScreeningListItem.md +34 -0
  44. data/docs/VerifyWebhook.md +18 -0
  45. data/docs/Webhook.md +26 -0
  46. data/docs/WebhookResponse.md +36 -0
  47. data/docs/WebhooksApi.md +290 -0
  48. data/git_push.sh +57 -0
  49. data/lib/pescheck-client/api/authentication_api.rb +220 -0
  50. data/lib/pescheck-client/api/checks_api.rb +144 -0
  51. data/lib/pescheck-client/api/divisions_api.rb +365 -0
  52. data/lib/pescheck-client/api/o_auth_api.rb +202 -0
  53. data/lib/pescheck-client/api/profiles_api.rb +432 -0
  54. data/lib/pescheck-client/api/screenings_api.rb +288 -0
  55. data/lib/pescheck-client/api/webhooks_api.rb +278 -0
  56. data/lib/pescheck-client/api_client.rb +441 -0
  57. data/lib/pescheck-client/api_error.rb +58 -0
  58. data/lib/pescheck-client/api_model_base.rb +88 -0
  59. data/lib/pescheck-client/configuration.rb +429 -0
  60. data/lib/pescheck-client/models/custom_token_obtain_pair.rb +191 -0
  61. data/lib/pescheck-client/models/division_read_only.rb +469 -0
  62. data/lib/pescheck-client/models/division_write.rb +436 -0
  63. data/lib/pescheck-client/models/jwt_generation.rb +213 -0
  64. data/lib/pescheck-client/models/jwt_response.rb +285 -0
  65. data/lib/pescheck-client/models/o_auth_application.rb +265 -0
  66. data/lib/pescheck-client/models/o_auth_application_response.rb +379 -0
  67. data/lib/pescheck-client/models/paginated_division_read_only_list.rb +216 -0
  68. data/lib/pescheck-client/models/paginated_v2_profile_list_item_list.rb +216 -0
  69. data/lib/pescheck-client/models/paginated_v2_screening_list_item_list.rb +216 -0
  70. data/lib/pescheck-client/models/patched_division_write.rb +360 -0
  71. data/lib/pescheck-client/models/patched_v2_profile_partial_update.rb +176 -0
  72. data/lib/pescheck-client/models/token_refresh.rb +173 -0
  73. data/lib/pescheck-client/models/v2_candidate.rb +390 -0
  74. data/lib/pescheck-client/models/v2_check_field.rb +246 -0
  75. data/lib/pescheck-client/models/v2_check_info.rb +438 -0
  76. data/lib/pescheck-client/models/v2_document.rb +308 -0
  77. data/lib/pescheck-client/models/v2_document_content.rb +175 -0
  78. data/lib/pescheck-client/models/v2_money.rb +210 -0
  79. data/lib/pescheck-client/models/v2_profile_check.rb +201 -0
  80. data/lib/pescheck-client/models/v2_profile_check_entry.rb +349 -0
  81. data/lib/pescheck-client/models/v2_profile_create.rb +212 -0
  82. data/lib/pescheck-client/models/v2_profile_detail.rb +401 -0
  83. data/lib/pescheck-client/models/v2_profile_list_item.rb +291 -0
  84. data/lib/pescheck-client/models/v2_profile_update.rb +213 -0
  85. data/lib/pescheck-client/models/v2_profile_update_check.rb +210 -0
  86. data/lib/pescheck-client/models/v2_screening_check.rb +221 -0
  87. data/lib/pescheck-client/models/v2_screening_check_entry.rb +376 -0
  88. data/lib/pescheck-client/models/v2_screening_check_list_item.rb +242 -0
  89. data/lib/pescheck-client/models/v2_screening_create.rb +201 -0
  90. data/lib/pescheck-client/models/v2_screening_detail.rb +348 -0
  91. data/lib/pescheck-client/models/v2_screening_detail_profile.rb +156 -0
  92. data/lib/pescheck-client/models/v2_screening_list_item.rb +330 -0
  93. data/lib/pescheck-client/models/verify_webhook.rb +166 -0
  94. data/lib/pescheck-client/models/webhook.rb +265 -0
  95. data/lib/pescheck-client/models/webhook_response.rb +353 -0
  96. data/lib/pescheck-client/version.rb +15 -0
  97. data/lib/pescheck-client.rb +83 -0
  98. data/pescheck-client.gemspec +41 -0
  99. data/spec/api/authentication_api_spec.rb +68 -0
  100. data/spec/api/checks_api_spec.rb +56 -0
  101. data/spec/api/divisions_api_spec.rb +94 -0
  102. data/spec/api/o_auth_api_spec.rb +67 -0
  103. data/spec/api/profiles_api_spec.rb +105 -0
  104. data/spec/api/screenings_api_spec.rb +81 -0
  105. data/spec/api/webhooks_api_spec.rb +81 -0
  106. data/spec/models/custom_token_obtain_pair_spec.rb +42 -0
  107. data/spec/models/division_read_only_spec.rb +120 -0
  108. data/spec/models/division_write_spec.rb +102 -0
  109. data/spec/models/jwt_generation_spec.rb +54 -0
  110. data/spec/models/jwt_response_spec.rb +66 -0
  111. data/spec/models/o_auth_application_response_spec.rb +86 -0
  112. data/spec/models/o_auth_application_spec.rb +68 -0
  113. data/spec/models/paginated_division_read_only_list_spec.rb +54 -0
  114. data/spec/models/paginated_v2_profile_list_item_list_spec.rb +54 -0
  115. data/spec/models/paginated_v2_screening_list_item_list_spec.rb +54 -0
  116. data/spec/models/patched_division_write_spec.rb +102 -0
  117. data/spec/models/patched_v2_profile_partial_update_spec.rb +42 -0
  118. data/spec/models/token_refresh_spec.rb +42 -0
  119. data/spec/models/v2_candidate_spec.rb +94 -0
  120. data/spec/models/v2_check_field_spec.rb +60 -0
  121. data/spec/models/v2_check_info_spec.rb +102 -0
  122. data/spec/models/v2_document_content_spec.rb +42 -0
  123. data/spec/models/v2_document_spec.rb +70 -0
  124. data/spec/models/v2_money_spec.rb +42 -0
  125. data/spec/models/v2_profile_check_entry_spec.rb +76 -0
  126. data/spec/models/v2_profile_check_spec.rb +46 -0
  127. data/spec/models/v2_profile_create_spec.rb +48 -0
  128. data/spec/models/v2_profile_detail_spec.rb +96 -0
  129. data/spec/models/v2_profile_list_item_spec.rb +72 -0
  130. data/spec/models/v2_profile_update_check_spec.rb +52 -0
  131. data/spec/models/v2_profile_update_spec.rb +48 -0
  132. data/spec/models/v2_screening_check_entry_spec.rb +88 -0
  133. data/spec/models/v2_screening_check_list_item_spec.rb +52 -0
  134. data/spec/models/v2_screening_check_spec.rb +58 -0
  135. data/spec/models/v2_screening_create_spec.rb +48 -0
  136. data/spec/models/v2_screening_detail_profile_spec.rb +42 -0
  137. data/spec/models/v2_screening_detail_spec.rb +84 -0
  138. data/spec/models/v2_screening_list_item_spec.rb +84 -0
  139. data/spec/models/verify_webhook_spec.rb +36 -0
  140. data/spec/models/webhook_response_spec.rb +90 -0
  141. data/spec/models/webhook_spec.rb +64 -0
  142. data/spec/spec_helper.rb +111 -0
  143. metadata +299 -0
@@ -0,0 +1,429 @@
1
+ =begin
2
+ #Pescheck API
3
+
4
+ #Official client library for the Pescheck API (v2), generated from the OpenAPI specification. Authenticate with OAuth2 client credentials and use the checks, profiles, screenings, webhooks and divisions endpoints. See https://github.com/pescheckit/pescheck-clients for installation and usage.
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.23.0
10
+
11
+ =end
12
+
13
+ module Pescheck
14
+ class Configuration
15
+ # Defines url scheme
16
+ attr_accessor :scheme
17
+
18
+ # Defines url host
19
+ attr_accessor :host
20
+
21
+ # Defines url base path
22
+ attr_accessor :base_path
23
+
24
+ # Define server configuration index
25
+ attr_accessor :server_index
26
+
27
+ # Define server operation configuration index
28
+ attr_accessor :server_operation_index
29
+
30
+ # Default server variables
31
+ attr_accessor :server_variables
32
+
33
+ # Default server operation variables
34
+ attr_accessor :server_operation_variables
35
+
36
+ # Defines API keys used with API Key authentications.
37
+ #
38
+ # @return [Hash] key: parameter name, value: parameter value (API key)
39
+ #
40
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
41
+ # config.api_key['api_key'] = 'xxx'
42
+ attr_accessor :api_key
43
+
44
+ # Defines API key prefixes used with API Key authentications.
45
+ #
46
+ # @return [Hash] key: parameter name, value: API key prefix
47
+ #
48
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
49
+ # config.api_key_prefix['api_key'] = 'Token'
50
+ attr_accessor :api_key_prefix
51
+
52
+ # Defines the username used with HTTP basic authentication.
53
+ #
54
+ # @return [String]
55
+ attr_accessor :username
56
+
57
+ # Defines the password used with HTTP basic authentication.
58
+ #
59
+ # @return [String]
60
+ attr_accessor :password
61
+
62
+ # Defines the access token (Bearer) used with OAuth2.
63
+ attr_accessor :access_token
64
+
65
+ # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
66
+ # Overrides the access_token if set
67
+ # @return [Proc]
68
+ attr_accessor :access_token_getter
69
+
70
+ # Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
71
+ # HTTP responses with return type `File` will be returned as a stream of binary data.
72
+ # Default to false.
73
+ attr_accessor :return_binary_data
74
+
75
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
76
+ # details will be logged with `logger.debug` (see the `logger` attribute).
77
+ # Default to false.
78
+ #
79
+ # @return [true, false]
80
+ attr_accessor :debugging
81
+
82
+ # Set this to ignore operation servers for the API client. This is useful when you need to
83
+ # send requests to a different server than the one specified in the OpenAPI document.
84
+ # Will default to the base url defined in the spec but can be overridden by setting
85
+ # `scheme`, `host`, `base_path` directly.
86
+ # Default to false.
87
+ # @return [true, false]
88
+ attr_accessor :ignore_operation_servers
89
+
90
+ # Defines the logger used for debugging.
91
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
92
+ #
93
+ # @return [#debug]
94
+ attr_accessor :logger
95
+
96
+ # Defines the temporary folder to store downloaded files
97
+ # (for API endpoints that have file response).
98
+ # Default to use `Tempfile`.
99
+ #
100
+ # @return [String]
101
+ attr_accessor :temp_folder_path
102
+
103
+ # The time limit for HTTP request in seconds.
104
+ # Default to 0 (never times out).
105
+ attr_accessor :timeout
106
+
107
+ # Set this to false to skip client side validation in the operation.
108
+ # Default to true.
109
+ # @return [true, false]
110
+ attr_accessor :client_side_validation
111
+
112
+ ### TLS/SSL setting
113
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
114
+ # Default to true.
115
+ #
116
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
117
+ #
118
+ # @return [true, false]
119
+ attr_accessor :ssl_verify
120
+
121
+ ### TLS/SSL setting
122
+ # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
123
+ #
124
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
125
+ #
126
+ attr_accessor :ssl_verify_mode
127
+
128
+ ### TLS/SSL setting
129
+ # Set this to customize the certificate file to verify the peer.
130
+ #
131
+ # @return [String] the path to the certificate file
132
+ attr_accessor :ssl_ca_file
133
+
134
+ ### TLS/SSL setting
135
+ # Client certificate file (for client certificate)
136
+ attr_accessor :ssl_client_cert
137
+
138
+ ### TLS/SSL setting
139
+ # Client private key file (for client certificate)
140
+ attr_accessor :ssl_client_key
141
+
142
+ ### Proxy setting
143
+ # HTTP Proxy settings
144
+ attr_accessor :proxy
145
+
146
+ # Set this to customize parameters encoder of array parameter.
147
+ # Default to nil. Faraday uses NestedParamsEncoder when nil.
148
+ #
149
+ # @see The params_encoder option of Faraday. Related source code:
150
+ # https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders
151
+ attr_accessor :params_encoder
152
+
153
+
154
+ attr_accessor :inject_format
155
+
156
+ attr_accessor :force_ending_format
157
+
158
+ def initialize
159
+ @scheme = 'https'
160
+ @host = 'api.pescheck.io'
161
+ @base_path = ''
162
+ @server_index = nil
163
+ @server_operation_index = {}
164
+ @server_variables = {}
165
+ @server_operation_variables = {}
166
+ @api_key = {}
167
+ @api_key_prefix = {}
168
+ @client_side_validation = true
169
+ @ssl_verify = true
170
+ @ssl_verify_mode = nil
171
+ @ssl_ca_file = nil
172
+ @ssl_client_cert = nil
173
+ @ssl_client_key = nil
174
+ @middlewares = Hash.new { |h, k| h[k] = [] }
175
+ @configure_connection_blocks = []
176
+ @timeout = 60
177
+ # return data as binary instead of file
178
+ @return_binary_data = false
179
+ @params_encoder = nil
180
+ @debugging = false
181
+ @ignore_operation_servers = false
182
+ @inject_format = false
183
+ @force_ending_format = false
184
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
185
+
186
+ yield(self) if block_given?
187
+ end
188
+
189
+ # The default Configuration object.
190
+ def self.default
191
+ @@default ||= Configuration.new
192
+ end
193
+
194
+ def configure
195
+ yield(self) if block_given?
196
+ end
197
+
198
+ def scheme=(scheme)
199
+ # remove :// from scheme
200
+ @scheme = scheme.sub(/:\/\//, '')
201
+ end
202
+
203
+ def host=(host)
204
+ # remove http(s):// and anything after a slash
205
+ @host = host.sub(/https?:\/\//, '').split('/').first
206
+ end
207
+
208
+ def base_path=(base_path)
209
+ # Add leading and trailing slashes to base_path
210
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
211
+ @base_path = '' if @base_path == '/'
212
+ end
213
+
214
+ # Returns base URL for specified operation based on server settings
215
+ def base_url(operation = nil)
216
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
217
+ if operation_server_settings.key?(operation) then
218
+ index = server_operation_index.fetch(operation, server_index)
219
+ server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
220
+ else
221
+ server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
222
+ end
223
+ end
224
+
225
+ # Gets API key (with prefix if set).
226
+ # @param [String] param_name the parameter name of API key auth
227
+ def api_key_with_prefix(param_name, param_alias = nil)
228
+ key = @api_key[param_name]
229
+ key = @api_key.fetch(param_alias, key) unless param_alias.nil?
230
+ if @api_key_prefix[param_name]
231
+ "#{@api_key_prefix[param_name]} #{key}"
232
+ else
233
+ key
234
+ end
235
+ end
236
+
237
+ # Gets access_token using access_token_getter or uses the static access_token
238
+ def access_token_with_refresh
239
+ return access_token if access_token_getter.nil?
240
+ access_token_getter.call
241
+ end
242
+
243
+ # Gets Basic Auth token string
244
+ def basic_auth_token
245
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
246
+ end
247
+
248
+ # Returns Auth Settings hash for api client.
249
+ def auth_settings
250
+ {
251
+ 'cookieAuth' =>
252
+ {
253
+ type: 'api_key',
254
+ in: '',
255
+ key: '__Secure-sessionid',
256
+ value: api_key_with_prefix('__Secure-sessionid')
257
+ },
258
+ 'jwtAuth' =>
259
+ {
260
+ type: 'bearer',
261
+ in: 'header',
262
+ format: 'JWT',
263
+ key: 'Authorization',
264
+ value: "Bearer #{access_token_with_refresh}"
265
+ },
266
+ 'oauth2' =>
267
+ {
268
+ type: 'oauth2',
269
+ in: 'header',
270
+ key: 'Authorization',
271
+ value: "Bearer #{access_token_with_refresh}"
272
+ },
273
+ }
274
+ end
275
+
276
+ # Returns an array of Server setting
277
+ def server_settings
278
+ [
279
+ {
280
+ url: "{baseUrl}",
281
+ description: "Current environment",
282
+ variables: {
283
+ baseUrl: {
284
+ description: "API base URL",
285
+ default_value: "https://api.pescheck.io",
286
+ }
287
+ }
288
+ },
289
+ {
290
+ url: "https://dash-test-api.pescheck.me",
291
+ description: "Test server",
292
+ },
293
+ {
294
+ url: "https://api.pescheck.io",
295
+ description: "Production server",
296
+ },
297
+ {
298
+ url: "https://staging-api.pescheck.io",
299
+ description: "Staging server",
300
+ },
301
+ {
302
+ url: "http://localhost",
303
+ description: "Local development server",
304
+ }
305
+ ]
306
+ end
307
+
308
+ def operation_server_settings
309
+ {
310
+ }
311
+ end
312
+
313
+ # Returns URL based on server settings
314
+ #
315
+ # @param index array index of the server settings
316
+ # @param variables hash of variable and the corresponding value
317
+ def server_url(index, variables = {}, servers = nil)
318
+ servers = server_settings if servers == nil
319
+
320
+ # check array index out of bound
321
+ if (index.nil? || index < 0 || index >= servers.size)
322
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
323
+ end
324
+
325
+ server = servers[index]
326
+ url = server[:url]
327
+
328
+ return url unless server.key? :variables
329
+
330
+ # go through variable and assign a value
331
+ server[:variables].each do |name, variable|
332
+ if variables.key?(name)
333
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
334
+ url.gsub! "{" + name.to_s + "}", variables[name]
335
+ else
336
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
337
+ end
338
+ else
339
+ # use default value
340
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
341
+ end
342
+ end
343
+
344
+ url
345
+ end
346
+
347
+ # Configure Faraday connection directly.
348
+ #
349
+ # ```
350
+ # c.configure_faraday_connection do |conn|
351
+ # conn.use Faraday::HttpCache, shared_cache: false, logger: logger
352
+ # conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger|
353
+ # logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]')
354
+ # end
355
+ # end
356
+ #
357
+ # c.configure_faraday_connection do |conn|
358
+ # conn.adapter :typhoeus
359
+ # end
360
+ # ```
361
+ #
362
+ # @param block [Proc] `#call`able object that takes one arg, the connection
363
+ def configure_faraday_connection(&block)
364
+ @configure_connection_blocks << block
365
+ end
366
+
367
+ def configure_connection(conn)
368
+ @configure_connection_blocks.each do |block|
369
+ block.call(conn)
370
+ end
371
+ end
372
+
373
+ # Adds middleware to the stack
374
+ def use(*middleware)
375
+ set_faraday_middleware(:use, *middleware)
376
+ end
377
+
378
+ # Adds request middleware to the stack
379
+ def request(*middleware)
380
+ set_faraday_middleware(:request, *middleware)
381
+ end
382
+
383
+ # Adds response middleware to the stack
384
+ def response(*middleware)
385
+ set_faraday_middleware(:response, *middleware)
386
+ end
387
+
388
+ # Adds Faraday middleware setting information to the stack
389
+ #
390
+ # @example Use the `set_faraday_middleware` method to set middleware information
391
+ # config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503])
392
+ # config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug })
393
+ # config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false)
394
+ # config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 })
395
+ # config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger)
396
+ # config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware)
397
+ #
398
+ # @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143
399
+ def set_faraday_middleware(operation, key, *args, &block)
400
+ unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation)
401
+ fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \
402
+ " :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete."
403
+ end
404
+
405
+ @middlewares[operation] << [key, args, block]
406
+ end
407
+ ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true)
408
+
409
+ # Set up middleware on the connection
410
+ def configure_middleware(connection)
411
+ return if @middlewares.empty?
412
+
413
+ [:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation|
414
+ next unless @middlewares.key?(operation)
415
+
416
+ @middlewares[operation].each do |key, args, block|
417
+ connection.builder.send(operation, key, *args, &block)
418
+ end
419
+ end
420
+
421
+ if @middlewares.key?(:delete)
422
+ @middlewares[:delete].each do |key, _args, _block|
423
+ connection.builder.delete(key)
424
+ end
425
+ end
426
+ end
427
+
428
+ end
429
+ end
@@ -0,0 +1,191 @@
1
+ =begin
2
+ #Pescheck API
3
+
4
+ #Official client library for the Pescheck API (v2), generated from the OpenAPI specification. Authenticate with OAuth2 client credentials and use the checks, profiles, screenings, webhooks and divisions endpoints. See https://github.com/pescheckit/pescheck-clients for installation and usage.
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.23.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Pescheck
17
+ # Custom JWT serializer that includes organization information in the token.
18
+ class CustomTokenObtainPair < ApiModelBase
19
+ attr_accessor :email
20
+
21
+ attr_accessor :password
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'email' => :'email',
27
+ :'password' => :'password'
28
+ }
29
+ end
30
+
31
+ # Returns attribute mapping this model knows about
32
+ def self.acceptable_attribute_map
33
+ attribute_map
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ acceptable_attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'email' => :'String',
45
+ :'password' => :'String'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pescheck::CustomTokenObtainPair` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ acceptable_attribute_map = self.class.acceptable_attribute_map
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!acceptable_attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pescheck::CustomTokenObtainPair`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'email')
72
+ self.email = attributes[:'email']
73
+ else
74
+ self.email = nil
75
+ end
76
+
77
+ if attributes.key?(:'password')
78
+ self.password = attributes[:'password']
79
+ else
80
+ self.password = nil
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
88
+ invalid_properties = Array.new
89
+ if @email.nil?
90
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
91
+ end
92
+
93
+ if @password.nil?
94
+ invalid_properties.push('invalid value for "password", password cannot be nil.')
95
+ end
96
+
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ warn '[DEPRECATED] the `valid?` method is obsolete'
104
+ return false if @email.nil?
105
+ return false if @password.nil?
106
+ true
107
+ end
108
+
109
+ # Custom attribute writer method with validation
110
+ # @param [Object] email Value to be assigned
111
+ def email=(email)
112
+ if email.nil?
113
+ fail ArgumentError, 'email cannot be nil'
114
+ end
115
+
116
+ @email = email
117
+ end
118
+
119
+ # Custom attribute writer method with validation
120
+ # @param [Object] password Value to be assigned
121
+ def password=(password)
122
+ if password.nil?
123
+ fail ArgumentError, 'password cannot be nil'
124
+ end
125
+
126
+ @password = password
127
+ end
128
+
129
+ # Checks equality by comparing each attribute.
130
+ # @param [Object] Object to be compared
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ email == o.email &&
135
+ password == o.password
136
+ end
137
+
138
+ # @see the `==` method
139
+ # @param [Object] Object to be compared
140
+ def eql?(o)
141
+ self == o
142
+ end
143
+
144
+ # Calculates hash code according to all attributes.
145
+ # @return [Integer] Hash code
146
+ def hash
147
+ [email, password].hash
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def self.build_from_hash(attributes)
154
+ return nil unless attributes.is_a?(Hash)
155
+ attributes = attributes.transform_keys(&:to_sym)
156
+ transformed_hash = {}
157
+ openapi_types.each_pair do |key, type|
158
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
159
+ transformed_hash["#{key}"] = nil
160
+ elsif type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[attribute_map[key]].is_a?(Array)
164
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
165
+ end
166
+ elsif !attributes[attribute_map[key]].nil?
167
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
168
+ end
169
+ end
170
+ new(transformed_hash)
171
+ end
172
+
173
+ # Returns the object in the form of hash
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_hash
176
+ hash = {}
177
+ self.class.attribute_map.each_pair do |attr, param|
178
+ value = self.send(attr)
179
+ if value.nil?
180
+ is_nullable = self.class.openapi_nullable.include?(attr)
181
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
182
+ end
183
+
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ end
190
+
191
+ end