emass_client 1.0.1 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +152 -1124
  3. data/Rakefile +2 -0
  4. data/lib/emass_client/api/artifacts_api.rb +124 -97
  5. data/lib/emass_client/api/artifacts_export_api.rb +28 -19
  6. data/lib/emass_client/api/cac_api.rb +50 -31
  7. data/lib/emass_client/api/cloud_resources_api.rb +96 -0
  8. data/lib/emass_client/api/cmmc_assessments_api.rb +20 -11
  9. data/lib/emass_client/api/containers_api.rb +96 -0
  10. data/lib/emass_client/api/controls_api.rb +53 -34
  11. data/lib/emass_client/api/milestones_api.rb +138 -92
  12. data/lib/emass_client/api/pac_api.rb +50 -31
  13. data/lib/emass_client/api/poam_api.rb +132 -86
  14. data/lib/emass_client/api/registration_api.rb +30 -18
  15. data/lib/emass_client/api/static_code_scans_api.rb +38 -26
  16. data/lib/emass_client/api/system_roles_api.rb +48 -29
  17. data/lib/emass_client/api/systems_api.rb +57 -39
  18. data/lib/emass_client/api/test_api.rb +20 -11
  19. data/lib/emass_client/api/test_results_api.rb +53 -34
  20. data/lib/emass_client/api/workflow_definitions_api.rb +23 -14
  21. data/lib/emass_client/api/workflow_instances_api.rb +58 -53
  22. data/lib/emass_client/api_client.rb +59 -57
  23. data/lib/emass_client/api_error.rb +5 -5
  24. data/lib/emass_client/configuration.rb +93 -16
  25. data/lib/emass_client/models/artifacts_get.rb +54 -31
  26. data/lib/emass_client/models/{artifacts_delete_inner.rb → artifacts_request_delete_body_inner.rb} +29 -16
  27. data/lib/emass_client/models/artifacts_response_del.rb +27 -14
  28. data/lib/emass_client/models/{artifacts_response_del_data.rb → artifacts_response_del_data_inner.rb} +31 -18
  29. data/lib/emass_client/models/artifacts_response_get.rb +27 -14
  30. data/lib/emass_client/models/artifacts_response_put_post.rb +27 -14
  31. data/lib/emass_client/models/artifacts_response_put_post_data_inner.rb +265 -0
  32. data/lib/emass_client/models/cac_get.rb +82 -50
  33. data/lib/emass_client/models/cac_response_get.rb +27 -14
  34. data/lib/emass_client/models/cac_response_post.rb +27 -14
  35. data/lib/emass_client/models/{cac_response_post_data.rb → cac_response_post_data_inner.rb} +61 -21
  36. data/lib/emass_client/models/{pac_request_post_body.rb → cloud_resources_post.rb} +73 -69
  37. data/lib/emass_client/models/cloud_resources_response_post.rb +230 -0
  38. data/lib/emass_client/models/cmmc_get.rb +53 -63
  39. data/lib/emass_client/models/cmmc_response_get.rb +27 -14
  40. data/lib/emass_client/models/connectivity_ccsd.rb +29 -14
  41. data/lib/emass_client/models/containers_resources_post.rb +265 -0
  42. data/lib/emass_client/models/containers_response_post.rb +230 -0
  43. data/lib/emass_client/models/controls_get.rb +103 -66
  44. data/lib/emass_client/models/controls_put.rb +58 -18
  45. data/lib/emass_client/models/controls_response_get.rb +28 -14
  46. data/lib/emass_client/models/controls_response_put.rb +27 -14
  47. data/lib/emass_client/models/definition_transitions.rb +32 -62
  48. data/lib/emass_client/models/instances_transitions.rb +37 -88
  49. data/lib/emass_client/models/milestone_response_get.rb +27 -14
  50. data/lib/emass_client/models/milestone_response_get_milestone.rb +228 -0
  51. data/lib/emass_client/models/milestone_response_post.rb +27 -14
  52. data/lib/emass_client/models/milestone_response_put.rb +27 -14
  53. data/lib/emass_client/models/milestones_get.rb +33 -20
  54. data/lib/emass_client/models/milestones_put_post_delete.rb +60 -20
  55. data/lib/emass_client/models/{delete_milestone.rb → milestones_request_delete_body_inner.rb} +29 -21
  56. data/lib/emass_client/models/milestones_required_post.rb +27 -14
  57. data/lib/emass_client/models/milestones_required_put.rb +28 -15
  58. data/lib/emass_client/models/pac_get.rb +39 -22
  59. data/lib/emass_client/models/pac_post.rb +60 -20
  60. data/lib/emass_client/models/pac_response_get.rb +28 -14
  61. data/lib/emass_client/models/pac_response_post.rb +27 -14
  62. data/lib/emass_client/models/poam_get.rb +114 -77
  63. data/lib/emass_client/models/poam_post_put_del.rb +59 -19
  64. data/lib/emass_client/models/{delete_poam.rb → poam_request_delete_body_inner.rb} +29 -21
  65. data/lib/emass_client/models/poam_response_delete.rb +27 -14
  66. data/lib/emass_client/models/poam_response_get_poams.rb +228 -0
  67. data/lib/emass_client/models/{static_code_required_post.rb → poam_response_get_systems.rb} +42 -29
  68. data/lib/emass_client/models/poam_response_post.rb +27 -14
  69. data/lib/emass_client/models/poam_response_put.rb +27 -14
  70. data/lib/emass_client/models/register.rb +27 -14
  71. data/lib/emass_client/models/register_data.rb +26 -13
  72. data/lib/emass_client/models/register_user_request_post_body.rb +26 -13
  73. data/lib/emass_client/models/{model_200.rb → response200.rb} +53 -16
  74. data/lib/emass_client/models/{model_400.rb → response201.rb} +29 -16
  75. data/lib/emass_client/models/{model_201_meta.rb → response201_meta.rb} +54 -17
  76. data/lib/emass_client/models/{model_400_response.rb → response400.rb} +29 -16
  77. data/lib/emass_client/models/{model_400_meta.rb → response400_meta.rb} +54 -17
  78. data/lib/emass_client/models/{model_401.rb → response401.rb} +29 -16
  79. data/lib/emass_client/models/{model_401_meta.rb → response401_meta.rb} +54 -17
  80. data/lib/emass_client/models/{model_201.rb → response403.rb} +29 -16
  81. data/lib/emass_client/models/{model_403_meta.rb → response403_meta.rb} +54 -17
  82. data/lib/emass_client/models/{model_404.rb → response404.rb} +54 -17
  83. data/lib/emass_client/models/response405.rb +219 -0
  84. data/lib/emass_client/models/{model_405_meta.rb → response405_meta.rb} +54 -17
  85. data/lib/emass_client/models/response411.rb +219 -0
  86. data/lib/emass_client/models/{model_411_meta.rb → response411_meta.rb} +54 -17
  87. data/lib/emass_client/models/response490.rb +219 -0
  88. data/lib/emass_client/models/{model_490_meta.rb → response490_meta.rb} +54 -17
  89. data/lib/emass_client/models/response500.rb +219 -0
  90. data/lib/emass_client/models/{model_500_meta.rb → response500_meta.rb} +54 -17
  91. data/lib/emass_client/models/role_category.rb +32 -50
  92. data/lib/emass_client/models/roles.rb +29 -61
  93. data/lib/emass_client/models/ssps.rb +32 -16
  94. data/lib/emass_client/models/stage.rb +30 -49
  95. data/lib/emass_client/models/static_code_application.rb +34 -33
  96. data/lib/emass_client/models/static_code_post.rb +275 -0
  97. data/lib/emass_client/models/static_code_request_post_body.rb +47 -14
  98. data/lib/emass_client/models/{static_code_required_post_application.rb → static_code_request_post_body_application.rb} +30 -17
  99. data/lib/emass_client/models/static_code_response_post.rb +230 -0
  100. data/lib/emass_client/models/success200_response.rb +27 -14
  101. data/lib/emass_client/models/{error.rb → success200_response_data_inner.rb} +57 -36
  102. data/lib/emass_client/models/system_response.rb +28 -17
  103. data/lib/emass_client/models/system_roles_category_response.rb +28 -14
  104. data/lib/emass_client/models/system_roles_response.rb +27 -14
  105. data/lib/emass_client/models/{system_roles_response_data.rb → system_roles_response_data_inner.rb} +30 -17
  106. data/lib/emass_client/models/systems.rb +218 -191
  107. data/lib/emass_client/models/{poam_response_get.rb → systems_response.rb} +30 -17
  108. data/lib/emass_client/models/test.rb +27 -14
  109. data/lib/emass_client/models/test_data.rb +26 -13
  110. data/lib/emass_client/models/test_results_get.rb +39 -35
  111. data/lib/emass_client/models/test_results_post.rb +58 -18
  112. data/lib/emass_client/models/test_results_response_get.rb +27 -14
  113. data/lib/emass_client/models/test_results_response_post.rb +27 -14
  114. data/lib/emass_client/models/users.rb +28 -15
  115. data/lib/emass_client/models/workflow_definition_get.rb +63 -68
  116. data/lib/emass_client/models/workflow_definition_response_get.rb +27 -14
  117. data/lib/emass_client/models/workflow_instance_get.rb +331 -0
  118. data/lib/emass_client/models/workflow_instance_response_get.rb +230 -0
  119. data/lib/emass_client/models/workflow_instances_get.rb +107 -133
  120. data/lib/emass_client/models/workflow_instances_response_get.rb +39 -17
  121. data/lib/emass_client/models/workflow_instances_response_get_pagination.rb +246 -0
  122. data/lib/emass_client/version.rb +6 -5
  123. data/lib/emass_client.rb +47 -54
  124. metadata +60 -89
  125. data/lib/emass_client/models/artifacts_delete.rb +0 -201
  126. data/lib/emass_client/models/artifacts_request_put_body.rb +0 -363
  127. data/lib/emass_client/models/cac_request_post_body.rb +0 -217
  128. data/lib/emass_client/models/controls_request_put_body.rb +0 -606
  129. data/lib/emass_client/models/empty200_response.rb +0 -197
  130. data/lib/emass_client/models/milestones_delete.rb +0 -197
  131. data/lib/emass_client/models/milestones_post.rb +0 -197
  132. data/lib/emass_client/models/milestones_put.rb +0 -197
  133. data/lib/emass_client/models/milestones_request_post_body.rb +0 -242
  134. data/lib/emass_client/models/milestones_request_put_body.rb +0 -242
  135. data/lib/emass_client/models/model_403.rb +0 -206
  136. data/lib/emass_client/models/model_404_response.rb +0 -206
  137. data/lib/emass_client/models/model_405.rb +0 -206
  138. data/lib/emass_client/models/model_411.rb +0 -206
  139. data/lib/emass_client/models/model_490.rb +0 -206
  140. data/lib/emass_client/models/model_500.rb +0 -206
  141. data/lib/emass_client/models/poam_delete.rb +0 -197
  142. data/lib/emass_client/models/poam_post.rb +0 -197
  143. data/lib/emass_client/models/poam_put.rb +0 -197
  144. data/lib/emass_client/models/poam_request_post_body.rb +0 -197
  145. data/lib/emass_client/models/poam_request_put_body.rb +0 -197
  146. data/lib/emass_client/models/poam_required_post.rb +0 -564
  147. data/lib/emass_client/models/poam_required_put.rb +0 -594
  148. data/lib/emass_client/models/system_id_artifacts_body.rb +0 -284
  149. data/lib/emass_client/models/test_results_request_post_body.rb +0 -306
@@ -1,20 +1,21 @@
1
1
  =begin
2
2
  #Enterprise Mission Assurance Support Service (eMASS)
3
3
 
4
- #The Enterprise Mission Assurance Support Service (eMASS) Representational State Transfer (REST) Application Programming Interface (API) enables users to perform assessments and complete actions associated with system records. The `emasser` is a command-line interface (CLI) tool that implements all of the eMASS endpoints defined in the eMASS REST API v3.2, dated October 21, 2021.</br><br> <strong>Register CLI</strong></br> New users will need to register an API key with the eMASS development team prior to accessing the site for the first time. The eMASS REST API requires a client certificate (SSL/TLS, DoD PKI only) where {url}/api/register (POST) is used to register the client certificate.</br></br> Every call to the eMASS REST API will require the use of the agreed upon public key certificate and API key. The API key must be provided in the request header for all endpoint calls (api-key). If the service receives an untrusted certificate or API key, a 401 error response code will be returned along with an error message.</br></br> <strong>Available Request Headers:</strong></br> <table> <tr> <th align=left>key</th> <th align=left>Example Value</th> <th align=left>Description</th> </tr> <tr> <td>`api-key`</td> <td>api-key-provided-by-emass</td> <td>This API key must be provided in the request header for all endpoint calls</td> </tr> <tr> <td>`user-uid`</td> <td>USER.UID.KEY</td> <td>This User unique identifier key must be provided in the request header for all PUT, POST, and DELETE endpoint calls</td> </tr> <tr> <td></td><td></td> <td> Note: For DoD users this is the DoD ID Number (EIDIPI) on their DoD CAC </td> </tr> </table> </br><strong>Approve API Client for Actionable Requests</strong></br> Users are required to log-in to eMASS and grant permissions for a client to update data within eMASS on their behalf. This is only required for actionable requests (PUT, POST, DELETE). The Registration Endpoint and all GET requests can be accessed without completing this process with the correct permissions. Please note that leaving a field parameter blank (for PUT/POST requests) has the potential to clear information in the active eMASS records. To establish an account with eMASS and/or acquire an api-key/user-uid, contact one of the listed POC:
4
+ #The Enterprise Mission Assurance Support Service (eMASS) Representational State Transfer (REST) Application Programming Interface (API) enables users to perform assessments and complete actions associated with system records. <strong>Register External Application (that use the eMASS API)</strong></br> New users will need to [register](https://nisp.emass.apps.mil/Content/Help/jobaids/eMASS_OT_NewUser_Job_Aid.pdf) an API key with the eMASS development team prior to accessing the site for the first time. The eMASS REST API requires a client certificate (SSL/TLS, DoD PKI only). Use the `Registration` endpoint to register the client certificate.</br></br> Every call to the eMASS REST API will require the use of the agreed upon public key certificate and API key. The API key must be provided in the request header for all endpoint calls (api-key). If the service receives an untrusted certificate or API key, a 401 error response code will be returned along with an error message.</br></br> <strong>Available Request Headers</strong></br> <table> <tr> <th align=left>key</th> <th align=left>Example Value</th> <th align=left>Description</th> </tr> <tr> <td>`api-key`</td> <td>api-key-provided-by-emass</td> <td>This API key must be provided in the request header for all endpoint calls</td> </tr> <tr> <td>`user-uid`</td> <td>USER.UID.KEY</td> <td>This User unique identifier key must be provided in the request header for all PUT, POST, and DELETE endpoint calls</td> </tr> <tr> <td></td><td></td> <td> Note: For DoD users this is the DoD ID Number (EIDIPI) on their DoD CAC </td> </tr> </table> </br><strong>Approve API Client for Actionable Requests</strong></br> Users are required to log-in to eMASS and grant permissions for a client to update data within eMASS on their behalf. This is only required for actionable requests (PUT, POST, DELETE). The Registration Endpoint and all GET requests can be accessed without completing this process with the correct permissions. Please note that leaving a field parameter blank (for PUT/POST requests) has the potential to clear information in the active eMASS records. To establish an account with eMASS and/or acquire an api-key/user-uid, contact one of the listed POC:
5
5
 
6
- OpenAPI spec version: v3.2
6
+ The version of the OpenAPI document: v3.3
7
7
  Contact: disa.meade.id.mbx.emass-tier-iii-support@mail.mil
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 3.0.26
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
10
11
  =end
11
12
 
12
13
  require 'date'
13
14
  require 'json'
14
15
  require 'logger'
15
16
  require 'tempfile'
17
+ require 'time'
16
18
  require 'typhoeus'
17
- require 'uri'
18
19
 
19
20
  module EmassClient
20
21
  class ApiClient
@@ -30,7 +31,7 @@ module EmassClient
30
31
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
31
32
  def initialize(config = Configuration.default)
32
33
  @config = config
33
- @user_agent = "Swagger-Codegen/#{VERSION}/ruby"
34
+ @user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
34
35
  @default_headers = {
35
36
  'Content-Type' => 'application/json',
36
37
  'User-Agent' => @user_agent
@@ -86,7 +87,7 @@ module EmassClient
86
87
  # @option opts [Object] :body HTTP body (JSON/XML)
87
88
  # @return [Typhoeus::Request] A Typhoeus Request
88
89
  def build_request(http_method, path, opts = {})
89
- url = build_request_url(path)
90
+ url = build_request_url(path, opts)
90
91
  http_method = http_method.to_sym.downcase
91
92
 
92
93
  header_params = @default_headers.merge(opts[:header_params] || {})
@@ -156,6 +157,44 @@ module EmassClient
156
157
  data
157
158
  end
158
159
 
160
+ # Save response body into a file in (the defined) temporary folder, using the filename
161
+ # from the "Content-Disposition" header if provided, otherwise a random filename.
162
+ # The response body is written to the file in chunks in order to handle files which
163
+ # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
164
+ # process can use.
165
+ #
166
+ # @see Configuration#temp_folder_path
167
+ def download_file(request)
168
+ tempfile = nil
169
+ encoding = nil
170
+ request.on_headers do |response|
171
+ content_disposition = response.headers['Content-Disposition']
172
+ if content_disposition && content_disposition =~ /filename=/i
173
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
174
+ prefix = sanitize_filename(filename)
175
+ else
176
+ prefix = 'download-'
177
+ end
178
+ prefix = prefix + '-' unless prefix.end_with?('-')
179
+ encoding = response.body.encoding
180
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
181
+ @tempfile = tempfile
182
+ end
183
+ request.on_body do |chunk|
184
+ chunk.force_encoding(encoding)
185
+ tempfile.write(chunk)
186
+ end
187
+ request.on_complete do |response|
188
+ if tempfile
189
+ tempfile.close
190
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
191
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
192
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
193
+ "explicitly with `tempfile.delete`"
194
+ end
195
+ end
196
+ end
197
+
159
198
  # Check if the given MIME is a JSON MIME.
160
199
  # JSON MIME examples:
161
200
  # application/json
@@ -192,7 +231,7 @@ module EmassClient
192
231
  begin
193
232
  data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
194
233
  rescue JSON::ParserError => e
195
- if %w(String Date DateTime).include?(return_type)
234
+ if %w(String Date Time).include?(return_type)
196
235
  data = body
197
236
  else
198
237
  raise e
@@ -217,9 +256,9 @@ module EmassClient
217
256
  data.to_f
218
257
  when 'Boolean'
219
258
  data == true
220
- when 'DateTime'
259
+ when 'Time'
221
260
  # parse date time (expecting ISO 8601 format)
222
- DateTime.parse data
261
+ Time.parse data
223
262
  when 'Date'
224
263
  # parse date time (expecting ISO 8601 format)
225
264
  Date.parse data
@@ -237,46 +276,9 @@ module EmassClient
237
276
  data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
238
277
  end
239
278
  else
240
- # models, e.g. Pet
241
- EmassClient.const_get(return_type).build_from_hash(data)
242
- end
243
- end
244
-
245
- # Save response body into a file in (the defined) temporary folder, using the filename
246
- # from the "Content-Disposition" header if provided, otherwise a random filename.
247
- # The response body is written to the file in chunks in order to handle files which
248
- # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
249
- # process can use.
250
- #
251
- # @see Configuration#temp_folder_path
252
- def download_file(request)
253
- tempfile = nil
254
- encoding = nil
255
- request.on_headers do |response|
256
- content_disposition = response.headers['Content-Disposition']
257
- if content_disposition && content_disposition =~ /filename=/i
258
- filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
259
- prefix = sanitize_filename(filename)
260
- else
261
- prefix = 'download-'
262
- end
263
- prefix = prefix + '-' unless prefix.end_with?('-')
264
- encoding = response.body.encoding
265
- tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
266
- @tempfile = tempfile
267
- end
268
- request.on_body do |chunk|
269
- chunk.force_encoding(encoding)
270
- tempfile.write(chunk)
271
- end
272
- request.on_complete do |response|
273
- if tempfile
274
- tempfile.close
275
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
276
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
277
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
278
- "explicitly with `tempfile.delete`"
279
- end
279
+ # models (e.g. Pet) or oneOf
280
+ klass = EmassClient.const_get(return_type)
281
+ klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
280
282
  end
281
283
  end
282
284
 
@@ -289,13 +291,13 @@ module EmassClient
289
291
  filename.gsub(/.*[\/\\]/, '')
290
292
  end
291
293
 
292
- def build_request_url(path)
294
+ def build_request_url(path, opts = {})
293
295
  # Add leading and trailing slashes to path
294
296
  path = "/#{path}".gsub(/\/+/, '/')
295
- @config.base_url + path
297
+ @config.base_url(opts[:operation]) + path
296
298
  end
297
299
 
298
- # Update hearder and query params based on authentication settings.
300
+ # Update header and query params based on authentication settings.
299
301
  #
300
302
  # @param [Hash] header_params Header parameters
301
303
  # @param [Hash] query_params Query parameters
@@ -307,14 +309,14 @@ module EmassClient
307
309
  case auth_setting[:in]
308
310
  when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
309
311
  when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
310
- else fail ArgumentError, 'Authentication token must be in `query` of `header`'
312
+ else fail ArgumentError, 'Authentication token must be in `query` or `header`'
311
313
  end
312
314
  end
313
315
  end
314
316
 
315
317
  # Sets user agent in HTTP header
316
318
  #
317
- # @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0)
319
+ # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
318
320
  def user_agent=(user_agent)
319
321
  @user_agent = user_agent
320
322
  @default_headers['User-Agent'] = @user_agent
@@ -334,8 +336,8 @@ module EmassClient
334
336
  # @param [Array] content_types array for Content-Type
335
337
  # @return [String] the Content-Type header (e.g. application/json)
336
338
  def select_header_content_type(content_types)
337
- # use application/json by default
338
- return 'application/json' if content_types.nil? || content_types.empty?
339
+ # return nil by default
340
+ return if content_types.nil? || content_types.empty?
339
341
  # use JSON when present, otherwise use the first one
340
342
  json_content_type = content_types.find { |s| json_mime?(s) }
341
343
  json_content_type || content_types.first
@@ -1,12 +1,13 @@
1
1
  =begin
2
2
  #Enterprise Mission Assurance Support Service (eMASS)
3
3
 
4
- #The Enterprise Mission Assurance Support Service (eMASS) Representational State Transfer (REST) Application Programming Interface (API) enables users to perform assessments and complete actions associated with system records. The `emasser` is a command-line interface (CLI) tool that implements all of the eMASS endpoints defined in the eMASS REST API v3.2, dated October 21, 2021.</br><br> <strong>Register CLI</strong></br> New users will need to register an API key with the eMASS development team prior to accessing the site for the first time. The eMASS REST API requires a client certificate (SSL/TLS, DoD PKI only) where {url}/api/register (POST) is used to register the client certificate.</br></br> Every call to the eMASS REST API will require the use of the agreed upon public key certificate and API key. The API key must be provided in the request header for all endpoint calls (api-key). If the service receives an untrusted certificate or API key, a 401 error response code will be returned along with an error message.</br></br> <strong>Available Request Headers:</strong></br> <table> <tr> <th align=left>key</th> <th align=left>Example Value</th> <th align=left>Description</th> </tr> <tr> <td>`api-key`</td> <td>api-key-provided-by-emass</td> <td>This API key must be provided in the request header for all endpoint calls</td> </tr> <tr> <td>`user-uid`</td> <td>USER.UID.KEY</td> <td>This User unique identifier key must be provided in the request header for all PUT, POST, and DELETE endpoint calls</td> </tr> <tr> <td></td><td></td> <td> Note: For DoD users this is the DoD ID Number (EIDIPI) on their DoD CAC </td> </tr> </table> </br><strong>Approve API Client for Actionable Requests</strong></br> Users are required to log-in to eMASS and grant permissions for a client to update data within eMASS on their behalf. This is only required for actionable requests (PUT, POST, DELETE). The Registration Endpoint and all GET requests can be accessed without completing this process with the correct permissions. Please note that leaving a field parameter blank (for PUT/POST requests) has the potential to clear information in the active eMASS records. To establish an account with eMASS and/or acquire an api-key/user-uid, contact one of the listed POC:
4
+ #The Enterprise Mission Assurance Support Service (eMASS) Representational State Transfer (REST) Application Programming Interface (API) enables users to perform assessments and complete actions associated with system records. <strong>Register External Application (that use the eMASS API)</strong></br> New users will need to [register](https://nisp.emass.apps.mil/Content/Help/jobaids/eMASS_OT_NewUser_Job_Aid.pdf) an API key with the eMASS development team prior to accessing the site for the first time. The eMASS REST API requires a client certificate (SSL/TLS, DoD PKI only). Use the `Registration` endpoint to register the client certificate.</br></br> Every call to the eMASS REST API will require the use of the agreed upon public key certificate and API key. The API key must be provided in the request header for all endpoint calls (api-key). If the service receives an untrusted certificate or API key, a 401 error response code will be returned along with an error message.</br></br> <strong>Available Request Headers</strong></br> <table> <tr> <th align=left>key</th> <th align=left>Example Value</th> <th align=left>Description</th> </tr> <tr> <td>`api-key`</td> <td>api-key-provided-by-emass</td> <td>This API key must be provided in the request header for all endpoint calls</td> </tr> <tr> <td>`user-uid`</td> <td>USER.UID.KEY</td> <td>This User unique identifier key must be provided in the request header for all PUT, POST, and DELETE endpoint calls</td> </tr> <tr> <td></td><td></td> <td> Note: For DoD users this is the DoD ID Number (EIDIPI) on their DoD CAC </td> </tr> </table> </br><strong>Approve API Client for Actionable Requests</strong></br> Users are required to log-in to eMASS and grant permissions for a client to update data within eMASS on their behalf. This is only required for actionable requests (PUT, POST, DELETE). The Registration Endpoint and all GET requests can be accessed without completing this process with the correct permissions. Please note that leaving a field parameter blank (for PUT/POST requests) has the potential to clear information in the active eMASS records. To establish an account with eMASS and/or acquire an api-key/user-uid, contact one of the listed POC:
5
5
 
6
- OpenAPI spec version: v3.2
6
+ The version of the OpenAPI document: v3.3
7
7
  Contact: disa.meade.id.mbx.emass-tier-iii-support@mail.mil
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 3.0.26
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
10
11
  =end
11
12
 
12
13
  module EmassClient
@@ -52,6 +53,5 @@ module EmassClient
52
53
 
53
54
  msg
54
55
  end
55
-
56
56
  end
57
57
  end
@@ -1,12 +1,13 @@
1
1
  =begin
2
2
  #Enterprise Mission Assurance Support Service (eMASS)
3
3
 
4
- #The Enterprise Mission Assurance Support Service (eMASS) Representational State Transfer (REST) Application Programming Interface (API) enables users to perform assessments and complete actions associated with system records. The `emasser` is a command-line interface (CLI) tool that implements all of the eMASS endpoints defined in the eMASS REST API v3.2, dated October 21, 2021.</br><br> <strong>Register CLI</strong></br> New users will need to register an API key with the eMASS development team prior to accessing the site for the first time. The eMASS REST API requires a client certificate (SSL/TLS, DoD PKI only) where {url}/api/register (POST) is used to register the client certificate.</br></br> Every call to the eMASS REST API will require the use of the agreed upon public key certificate and API key. The API key must be provided in the request header for all endpoint calls (api-key). If the service receives an untrusted certificate or API key, a 401 error response code will be returned along with an error message.</br></br> <strong>Available Request Headers:</strong></br> <table> <tr> <th align=left>key</th> <th align=left>Example Value</th> <th align=left>Description</th> </tr> <tr> <td>`api-key`</td> <td>api-key-provided-by-emass</td> <td>This API key must be provided in the request header for all endpoint calls</td> </tr> <tr> <td>`user-uid`</td> <td>USER.UID.KEY</td> <td>This User unique identifier key must be provided in the request header for all PUT, POST, and DELETE endpoint calls</td> </tr> <tr> <td></td><td></td> <td> Note: For DoD users this is the DoD ID Number (EIDIPI) on their DoD CAC </td> </tr> </table> </br><strong>Approve API Client for Actionable Requests</strong></br> Users are required to log-in to eMASS and grant permissions for a client to update data within eMASS on their behalf. This is only required for actionable requests (PUT, POST, DELETE). The Registration Endpoint and all GET requests can be accessed without completing this process with the correct permissions. Please note that leaving a field parameter blank (for PUT/POST requests) has the potential to clear information in the active eMASS records. To establish an account with eMASS and/or acquire an api-key/user-uid, contact one of the listed POC:
4
+ #The Enterprise Mission Assurance Support Service (eMASS) Representational State Transfer (REST) Application Programming Interface (API) enables users to perform assessments and complete actions associated with system records. <strong>Register External Application (that use the eMASS API)</strong></br> New users will need to [register](https://nisp.emass.apps.mil/Content/Help/jobaids/eMASS_OT_NewUser_Job_Aid.pdf) an API key with the eMASS development team prior to accessing the site for the first time. The eMASS REST API requires a client certificate (SSL/TLS, DoD PKI only). Use the `Registration` endpoint to register the client certificate.</br></br> Every call to the eMASS REST API will require the use of the agreed upon public key certificate and API key. The API key must be provided in the request header for all endpoint calls (api-key). If the service receives an untrusted certificate or API key, a 401 error response code will be returned along with an error message.</br></br> <strong>Available Request Headers</strong></br> <table> <tr> <th align=left>key</th> <th align=left>Example Value</th> <th align=left>Description</th> </tr> <tr> <td>`api-key`</td> <td>api-key-provided-by-emass</td> <td>This API key must be provided in the request header for all endpoint calls</td> </tr> <tr> <td>`user-uid`</td> <td>USER.UID.KEY</td> <td>This User unique identifier key must be provided in the request header for all PUT, POST, and DELETE endpoint calls</td> </tr> <tr> <td></td><td></td> <td> Note: For DoD users this is the DoD ID Number (EIDIPI) on their DoD CAC </td> </tr> </table> </br><strong>Approve API Client for Actionable Requests</strong></br> Users are required to log-in to eMASS and grant permissions for a client to update data within eMASS on their behalf. This is only required for actionable requests (PUT, POST, DELETE). The Registration Endpoint and all GET requests can be accessed without completing this process with the correct permissions. Please note that leaving a field parameter blank (for PUT/POST requests) has the potential to clear information in the active eMASS records. To establish an account with eMASS and/or acquire an api-key/user-uid, contact one of the listed POC:
5
5
 
6
- OpenAPI spec version: v3.2
6
+ The version of the OpenAPI document: v3.3
7
7
  Contact: disa.meade.id.mbx.emass-tier-iii-support@mail.mil
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 3.0.26
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
10
11
  =end
11
12
 
12
13
  module EmassClient
@@ -20,6 +21,18 @@ module EmassClient
20
21
  # Defines url base path
21
22
  attr_accessor :base_path
22
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
+
23
36
  # Defines API keys used with API Key authentications.
24
37
  #
25
38
  # @return [Hash] key: parameter name, value: parameter value (API key)
@@ -116,8 +129,8 @@ module EmassClient
116
129
  ### TLS/SSL setting
117
130
  # Client private key passphrase (for client certificate)
118
131
  attr_accessor :key_password
119
-
120
- # Set this to customize parameters encoding of array parameter with multi collectionFormat.
132
+
133
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
121
134
  # Default to nil.
122
135
  #
123
136
  # @see The params_encoding option of Ethon. Related source code:
@@ -130,11 +143,14 @@ module EmassClient
130
143
 
131
144
  def initialize
132
145
  @scheme = 'http'
133
- @host = 'localhost'
134
- @base_path = 'http://localhost:4010'
146
+ @host = 'localhost:4010'
147
+ @base_path = ''
148
+ @server_index = 0
149
+ @server_operation_index = {}
150
+ @server_variables = {}
151
+ @server_operation_variables = {}
135
152
  @api_key = {}
136
153
  @api_key_prefix = {}
137
- @timeout = 0
138
154
  @client_side_validation = true
139
155
  @verify_ssl = true
140
156
  @verify_ssl_host = true
@@ -142,6 +158,7 @@ module EmassClient
142
158
  @cert_file = nil
143
159
  @key_file = nil
144
160
  @key_password = nil
161
+ @timeout = 0
145
162
  @debugging = false
146
163
  @inject_format = false
147
164
  @force_ending_format = false
@@ -175,17 +192,23 @@ module EmassClient
175
192
  @base_path = '' if @base_path == '/'
176
193
  end
177
194
 
178
- def base_url
179
- "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
195
+ # Returns base URL for specified operation based on server settings
196
+ def base_url(operation = nil)
197
+ index = server_operation_index.fetch(operation, server_index)
198
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
199
+
200
+ server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
180
201
  end
181
202
 
182
203
  # Gets API key (with prefix if set).
183
204
  # @param [String] param_name the parameter name of API key auth
184
- def api_key_with_prefix(param_name)
205
+ def api_key_with_prefix(param_name, param_alias = nil)
206
+ key = @api_key[param_name]
207
+ key = @api_key.fetch(param_alias, key) unless param_alias.nil?
185
208
  if @api_key_prefix[param_name]
186
- "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
209
+ "#{@api_key_prefix[param_name]} #{key}"
187
210
  else
188
- @api_key[param_name]
211
+ key
189
212
  end
190
213
  end
191
214
 
@@ -197,7 +220,7 @@ module EmassClient
197
220
  # Returns Auth Settings hash for api client.
198
221
  def auth_settings
199
222
  {
200
- 'apikey' =>
223
+ 'apiKey' =>
201
224
  {
202
225
  type: 'api_key',
203
226
  in: 'header',
@@ -211,7 +234,7 @@ module EmassClient
211
234
  key: 'Prefer',
212
235
  value: api_key_with_prefix('Prefer')
213
236
  },
214
- 'userid' =>
237
+ 'userId' =>
215
238
  {
216
239
  type: 'api_key',
217
240
  in: 'header',
@@ -220,5 +243,59 @@ module EmassClient
220
243
  },
221
244
  }
222
245
  end
246
+
247
+ # Returns an array of Server setting
248
+ def server_settings
249
+ [
250
+ {
251
+ url: "http://localhost:4010",
252
+ description: "Use a localhost mock server (i.g.: Prism CLI - @stoplight/prism-cli)",
253
+ },
254
+ {
255
+ url: "https://stoplight.io/mocks/mitre/emasser/32836028",
256
+ description: "Use the hosted Prism mock server",
257
+ }
258
+ ]
259
+ end
260
+
261
+ def operation_server_settings
262
+ {
263
+ }
264
+ end
265
+
266
+ # Returns URL based on server settings
267
+ #
268
+ # @param index array index of the server settings
269
+ # @param variables hash of variable and the corresponding value
270
+ def server_url(index, variables = {}, servers = nil)
271
+ servers = server_settings if servers == nil
272
+
273
+ # check array index out of bound
274
+ if (index < 0 || index >= servers.size)
275
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
276
+ end
277
+
278
+ server = servers[index]
279
+ url = server[:url]
280
+
281
+ return url unless server.key? :variables
282
+
283
+ # go through variable and assign a value
284
+ server[:variables].each do |name, variable|
285
+ if variables.key?(name)
286
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
287
+ url.gsub! "{" + name.to_s + "}", variables[name]
288
+ else
289
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
290
+ end
291
+ else
292
+ # use default value
293
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
294
+ end
295
+ end
296
+
297
+ url
298
+ end
299
+
223
300
  end
224
301
  end
@@ -1,15 +1,17 @@
1
1
  =begin
2
2
  #Enterprise Mission Assurance Support Service (eMASS)
3
3
 
4
- #The Enterprise Mission Assurance Support Service (eMASS) Representational State Transfer (REST) Application Programming Interface (API) enables users to perform assessments and complete actions associated with system records. The `emasser` is a command-line interface (CLI) tool that implements all of the eMASS endpoints defined in the eMASS REST API v3.2, dated October 21, 2021.</br><br> <strong>Register CLI</strong></br> New users will need to register an API key with the eMASS development team prior to accessing the site for the first time. The eMASS REST API requires a client certificate (SSL/TLS, DoD PKI only) where {url}/api/register (POST) is used to register the client certificate.</br></br> Every call to the eMASS REST API will require the use of the agreed upon public key certificate and API key. The API key must be provided in the request header for all endpoint calls (api-key). If the service receives an untrusted certificate or API key, a 401 error response code will be returned along with an error message.</br></br> <strong>Available Request Headers:</strong></br> <table> <tr> <th align=left>key</th> <th align=left>Example Value</th> <th align=left>Description</th> </tr> <tr> <td>`api-key`</td> <td>api-key-provided-by-emass</td> <td>This API key must be provided in the request header for all endpoint calls</td> </tr> <tr> <td>`user-uid`</td> <td>USER.UID.KEY</td> <td>This User unique identifier key must be provided in the request header for all PUT, POST, and DELETE endpoint calls</td> </tr> <tr> <td></td><td></td> <td> Note: For DoD users this is the DoD ID Number (EIDIPI) on their DoD CAC </td> </tr> </table> </br><strong>Approve API Client for Actionable Requests</strong></br> Users are required to log-in to eMASS and grant permissions for a client to update data within eMASS on their behalf. This is only required for actionable requests (PUT, POST, DELETE). The Registration Endpoint and all GET requests can be accessed without completing this process with the correct permissions. Please note that leaving a field parameter blank (for PUT/POST requests) has the potential to clear information in the active eMASS records. To establish an account with eMASS and/or acquire an api-key/user-uid, contact one of the listed POC:
4
+ #The Enterprise Mission Assurance Support Service (eMASS) Representational State Transfer (REST) Application Programming Interface (API) enables users to perform assessments and complete actions associated with system records. <strong>Register External Application (that use the eMASS API)</strong></br> New users will need to [register](https://nisp.emass.apps.mil/Content/Help/jobaids/eMASS_OT_NewUser_Job_Aid.pdf) an API key with the eMASS development team prior to accessing the site for the first time. The eMASS REST API requires a client certificate (SSL/TLS, DoD PKI only). Use the `Registration` endpoint to register the client certificate.</br></br> Every call to the eMASS REST API will require the use of the agreed upon public key certificate and API key. The API key must be provided in the request header for all endpoint calls (api-key). If the service receives an untrusted certificate or API key, a 401 error response code will be returned along with an error message.</br></br> <strong>Available Request Headers</strong></br> <table> <tr> <th align=left>key</th> <th align=left>Example Value</th> <th align=left>Description</th> </tr> <tr> <td>`api-key`</td> <td>api-key-provided-by-emass</td> <td>This API key must be provided in the request header for all endpoint calls</td> </tr> <tr> <td>`user-uid`</td> <td>USER.UID.KEY</td> <td>This User unique identifier key must be provided in the request header for all PUT, POST, and DELETE endpoint calls</td> </tr> <tr> <td></td><td></td> <td> Note: For DoD users this is the DoD ID Number (EIDIPI) on their DoD CAC </td> </tr> </table> </br><strong>Approve API Client for Actionable Requests</strong></br> Users are required to log-in to eMASS and grant permissions for a client to update data within eMASS on their behalf. This is only required for actionable requests (PUT, POST, DELETE). The Registration Endpoint and all GET requests can be accessed without completing this process with the correct permissions. Please note that leaving a field parameter blank (for PUT/POST requests) has the potential to clear information in the active eMASS records. To establish an account with eMASS and/or acquire an api-key/user-uid, contact one of the listed POC:
5
5
 
6
- OpenAPI spec version: v3.2
6
+ The version of the OpenAPI document: v3.3
7
7
  Contact: disa.meade.id.mbx.emass-tier-iii-support@mail.mil
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 3.0.26
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
10
11
  =end
11
12
 
12
13
  require 'date'
14
+ require 'time'
13
15
 
14
16
  module EmassClient
15
17
  class ArtifactsGet
@@ -22,7 +24,7 @@ module EmassClient
22
24
  # [Read-only] Indicates whether an artifact is inherited.
23
25
  attr_accessor :is_inherited
24
26
 
25
- # [Read-only] Indicates whether an artifact template.
27
+ # [Required] Indicates whether an artifact template.
26
28
  attr_accessor :is_template
27
29
 
28
30
  # [Required] Artifact type options
@@ -97,32 +99,47 @@ module EmassClient
97
99
  }
98
100
  end
99
101
 
102
+ # Returns all the JSON keys this model knows about
103
+ def self.acceptable_attributes
104
+ attribute_map.values
105
+ end
106
+
100
107
  # Attribute type mapping.
101
108
  def self.openapi_types
102
109
  {
103
- :'system_id' => :'Object',
104
- :'filename' => :'Object',
105
- :'is_inherited' => :'Object',
106
- :'is_template' => :'Object',
107
- :'type' => :'Object',
108
- :'category' => :'Object',
109
- :'description' => :'Object',
110
- :'ref_page_number' => :'Object',
111
- :'ccis' => :'Object',
112
- :'controls' => :'Object',
113
- :'mime_content_type' => :'Object',
114
- :'file_size' => :'Object',
115
- :'artifact_expiration_date' => :'Object',
116
- :'last_reviewed_date' => :'Object'
110
+ :'system_id' => :'Integer',
111
+ :'filename' => :'String',
112
+ :'is_inherited' => :'Boolean',
113
+ :'is_template' => :'Boolean',
114
+ :'type' => :'String',
115
+ :'category' => :'String',
116
+ :'description' => :'String',
117
+ :'ref_page_number' => :'String',
118
+ :'ccis' => :'String',
119
+ :'controls' => :'String',
120
+ :'mime_content_type' => :'String',
121
+ :'file_size' => :'String',
122
+ :'artifact_expiration_date' => :'Integer',
123
+ :'last_reviewed_date' => :'Integer'
117
124
  }
118
125
  end
119
126
 
120
127
  # List of attributes with nullable: true
121
128
  def self.openapi_nullable
122
129
  Set.new([
130
+ :'is_inherited',
131
+ :'is_template',
132
+ :'description',
133
+ :'ref_page_number',
134
+ :'ccis',
135
+ :'controls',
136
+ :'mime_content_type',
137
+ :'file_size',
138
+ :'artifact_expiration_date',
139
+ :'last_reviewed_date'
123
140
  ])
124
141
  end
125
-
142
+
126
143
  # Initializes the object
127
144
  # @param [Hash] attributes Model attributes in the form of hash
128
145
  def initialize(attributes = {})
@@ -205,9 +222,9 @@ module EmassClient
205
222
  # Check to see if the all the properties in the model are valid
206
223
  # @return true if the model is valid
207
224
  def valid?
208
- type_validator = EnumAttributeValidator.new('Object', ['Procedure', 'Diagram', 'Policy', 'Labor', 'Document', 'Image', 'Other', 'Scan Result', 'Auditor Report'])
225
+ type_validator = EnumAttributeValidator.new('String', ["Procedure", "Diagram", "Policy", "Labor", "Document", "Image", "Other", "Scan Result", "Auditor Report", "unknown_default_open_api"])
209
226
  return false unless type_validator.valid?(@type)
210
- category_validator = EnumAttributeValidator.new('Object', ['Implementation Guidance', 'Evidence'])
227
+ category_validator = EnumAttributeValidator.new('String', ["Implementation Guidance", "Evidence", "unknown_default_open_api"])
211
228
  return false unless category_validator.valid?(@category)
212
229
  true
213
230
  end
@@ -215,7 +232,7 @@ module EmassClient
215
232
  # Custom attribute writer method checking allowed values (enum).
216
233
  # @param [Object] type Object to be assigned
217
234
  def type=(type)
218
- validator = EnumAttributeValidator.new('Object', ['Procedure', 'Diagram', 'Policy', 'Labor', 'Document', 'Image', 'Other', 'Scan Result', 'Auditor Report'])
235
+ validator = EnumAttributeValidator.new('String', ["Procedure", "Diagram", "Policy", "Labor", "Document", "Image", "Other", "Scan Result", "Auditor Report", "unknown_default_open_api"])
219
236
  unless validator.valid?(type)
220
237
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
221
238
  end
@@ -225,7 +242,7 @@ module EmassClient
225
242
  # Custom attribute writer method checking allowed values (enum).
226
243
  # @param [Object] category Object to be assigned
227
244
  def category=(category)
228
- validator = EnumAttributeValidator.new('Object', ['Implementation Guidance', 'Evidence'])
245
+ validator = EnumAttributeValidator.new('String', ["Implementation Guidance", "Evidence", "unknown_default_open_api"])
229
246
  unless validator.valid?(category)
230
247
  fail ArgumentError, "invalid value for \"category\", must be one of #{validator.allowable_values}."
231
248
  end
@@ -277,8 +294,11 @@ module EmassClient
277
294
  # @return [Object] Returns the model itself
278
295
  def build_from_hash(attributes)
279
296
  return nil unless attributes.is_a?(Hash)
297
+ attributes = attributes.transform_keys(&:to_sym)
280
298
  self.class.openapi_types.each_pair do |key, type|
281
- if type =~ /\AArray<(.*)>/i
299
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
300
+ self.send("#{key}=", nil)
301
+ elsif type =~ /\AArray<(.*)>/i
282
302
  # check to ensure the input is an array given that the attribute
283
303
  # is documented as an array but the input is not
284
304
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -286,8 +306,6 @@ module EmassClient
286
306
  end
287
307
  elsif !attributes[self.class.attribute_map[key]].nil?
288
308
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
289
- elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
290
- self.send("#{key}=", nil)
291
309
  end
292
310
  end
293
311
 
@@ -300,8 +318,8 @@ module EmassClient
300
318
  # @return [Object] Deserialized data
301
319
  def _deserialize(type, value)
302
320
  case type.to_sym
303
- when :DateTime
304
- DateTime.parse(value)
321
+ when :Time
322
+ Time.parse(value)
305
323
  when :Date
306
324
  Date.parse(value)
307
325
  when :String
@@ -331,7 +349,9 @@ module EmassClient
331
349
  end
332
350
  end
333
351
  else # model
334
- EmassClient.const_get(type).build_from_hash(value)
352
+ # models (e.g. Pet) or oneOf
353
+ klass = EmassClient.const_get(type)
354
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
335
355
  end
336
356
  end
337
357
 
@@ -379,5 +399,8 @@ module EmassClient
379
399
  else
380
400
  value
381
401
  end
382
- end end
402
+ end
403
+
404
+ end
405
+
383
406
  end