tca_client 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/docs/AddGroupAttachmentRequest.md +16 -4
  3. data/docs/AddGroupAttachmentResponse.md +14 -3
  4. data/docs/AggregateGroup.md +24 -8
  5. data/docs/AnnotationsSettings.md +18 -0
  6. data/docs/AuthorMetadataOverride.md +16 -4
  7. data/docs/EULAApi.md +166 -92
  8. data/docs/Error.md +16 -4
  9. data/docs/Eula.md +18 -5
  10. data/docs/EulaAcceptListItem.md +20 -6
  11. data/docs/EulaAcceptRequest.md +20 -6
  12. data/docs/EulaVersion.md +22 -7
  13. data/docs/FeaturesApi.md +41 -23
  14. data/docs/FeaturesEnabled.md +20 -6
  15. data/docs/FeaturesGenerationSettings.md +16 -4
  16. data/docs/FeaturesSimilarity.md +18 -5
  17. data/docs/FeaturesSimilarityViewSettings.md +38 -15
  18. data/docs/FeaturesTenant.md +14 -3
  19. data/docs/FeaturesViewerModes.md +16 -4
  20. data/docs/GenerateSimilarityPDF.md +18 -0
  21. data/docs/GetGroupAttachments200Response.md +18 -0
  22. data/docs/Group.md +18 -5
  23. data/docs/GroupAttachmentResponse.md +20 -6
  24. data/docs/GroupContext.md +18 -5
  25. data/docs/GroupsApi.md +321 -177
  26. data/docs/IndexApi.md +84 -44
  27. data/docs/IndexStateSettings.md +14 -3
  28. data/docs/IndexingSettings.md +14 -3
  29. data/docs/PDFStatusWebhookRequest.md +24 -0
  30. data/docs/PdfStatusResponse.md +14 -3
  31. data/docs/RateLimitError.md +16 -4
  32. data/docs/RequestPdfResponse.md +14 -3
  33. data/docs/Sidebar.md +14 -3
  34. data/docs/SimilarityApi.md +239 -129
  35. data/docs/SimilarityCompleteWebhookRequest.md +38 -0
  36. data/docs/SimilarityGenerationSettings.md +20 -6
  37. data/docs/SimilarityMetadata.md +32 -12
  38. data/docs/SimilarityMetadataAllOf.md +28 -0
  39. data/docs/SimilarityMetadataAllOfTopMatches.md +30 -0
  40. data/docs/SimilarityPutRequest.md +18 -5
  41. data/docs/SimilarityScoreData.md +20 -6
  42. data/docs/SimilaritySettings.md +18 -5
  43. data/docs/SimilaritySettingsModes.md +16 -4
  44. data/docs/SimilaritySettingsViewSettings.md +14 -3
  45. data/docs/SimilarityViewSettings.md +38 -15
  46. data/docs/SimilarityViewerUrlResponse.md +14 -3
  47. data/docs/SimilarityViewerUrlSettings.md +30 -10
  48. data/docs/SimpleSubmissionResponse.md +22 -2
  49. data/docs/SimpleSubmissionResponseAllOf.md +26 -0
  50. data/docs/Submission.md +34 -2
  51. data/docs/SubmissionAllOf.md +38 -0
  52. data/docs/SubmissionApi.md +202 -111
  53. data/docs/SubmissionBase.md +30 -11
  54. data/docs/SubmissionBaseMetadata.md +24 -8
  55. data/docs/SubmissionCompleteWebhookRequest.md +40 -0
  56. data/docs/SubmissionCompleteWebhookRequestAllOf.md +18 -0
  57. data/docs/SubmissionCompleteWebhookRequestAllOfMetadata.md +18 -0
  58. data/docs/SubmissionSizeError.md +16 -4
  59. data/docs/SuccessMessage.md +14 -3
  60. data/docs/Users.md +20 -6
  61. data/docs/ViewerPermissions.md +22 -7
  62. data/docs/Webhook.md +24 -6
  63. data/docs/WebhookAllOf.md +20 -0
  64. data/docs/WebhookApi.md +193 -103
  65. data/docs/WebhookBase.md +20 -6
  66. data/docs/WebhookPathRequest.md +16 -4
  67. data/docs/WebhookWithSecret.md +22 -6
  68. data/docs/WebhookWithSecretAllOf.md +18 -0
  69. data/lib/tca_client/api/eula_api.rb +96 -63
  70. data/lib/tca_client/api/features_api.rb +21 -12
  71. data/lib/tca_client/api/groups_api.rb +225 -155
  72. data/lib/tca_client/api/index_api.rb +46 -27
  73. data/lib/tca_client/api/similarity_api.rb +165 -104
  74. data/lib/tca_client/api/submission_api.rb +132 -89
  75. data/lib/tca_client/api/webhook_api.rb +120 -77
  76. data/lib/tca_client/api_client.rb +61 -57
  77. data/lib/tca_client/api_error.rb +4 -4
  78. data/lib/tca_client/configuration.rb +93 -13
  79. data/lib/tca_client/models/add_group_attachment_request.rb +50 -13
  80. data/lib/tca_client/models/add_group_attachment_response.rb +25 -12
  81. data/lib/tca_client/models/aggregate_group.rb +34 -21
  82. data/lib/tca_client/models/annotations_settings.rb +220 -0
  83. data/lib/tca_client/models/author_metadata_override.rb +26 -13
  84. data/lib/tca_client/models/error.rb +26 -13
  85. data/lib/tca_client/models/eula.rb +27 -14
  86. data/lib/tca_client/models/eula_accept_list_item.rb +28 -15
  87. data/lib/tca_client/models/eula_accept_request.rb +28 -15
  88. data/lib/tca_client/models/eula_version.rb +29 -16
  89. data/lib/tca_client/models/features_enabled.rb +28 -15
  90. data/lib/tca_client/models/features_generation_settings.rb +26 -13
  91. data/lib/tca_client/models/features_similarity.rb +27 -14
  92. data/lib/tca_client/models/features_similarity_view_settings.rb +37 -24
  93. data/lib/tca_client/models/features_tenant.rb +25 -12
  94. data/lib/tca_client/models/features_viewer_modes.rb +26 -13
  95. data/lib/tca_client/models/generate_similarity_pdf.rb +254 -0
  96. data/lib/tca_client/models/{inline_response_200.rb → get_group_attachments200_response.rb} +28 -15
  97. data/lib/tca_client/models/group.rb +29 -16
  98. data/lib/tca_client/models/group_attachment_response.rb +30 -17
  99. data/lib/tca_client/models/group_context.rb +27 -14
  100. data/lib/tca_client/models/index_state_settings.rb +25 -12
  101. data/lib/tca_client/models/indexing_settings.rb +25 -12
  102. data/lib/tca_client/models/pdf_status_response.rb +27 -14
  103. data/lib/tca_client/models/pdf_status_webhook_request.rb +283 -0
  104. data/lib/tca_client/models/rate_limit_error.rb +36 -20
  105. data/lib/tca_client/models/request_pdf_response.rb +25 -12
  106. data/lib/tca_client/models/sidebar.rb +27 -14
  107. data/lib/tca_client/models/similarity_complete_webhook_request.rb +366 -0
  108. data/lib/tca_client/models/similarity_generation_settings.rb +30 -17
  109. data/lib/tca_client/models/similarity_metadata.rb +45 -28
  110. data/lib/tca_client/models/similarity_metadata_all_of.rb +301 -0
  111. data/lib/tca_client/models/{similarity_metadata_top_matches.rb → similarity_metadata_all_of_top_matches.rb} +34 -21
  112. data/lib/tca_client/models/similarity_put_request.rb +27 -14
  113. data/lib/tca_client/models/similarity_score_data.rb +28 -15
  114. data/lib/tca_client/models/similarity_settings.rb +29 -16
  115. data/lib/tca_client/models/similarity_settings_modes.rb +26 -13
  116. data/lib/tca_client/models/similarity_settings_view_settings.rb +25 -12
  117. data/lib/tca_client/models/similarity_view_settings.rb +37 -24
  118. data/lib/tca_client/models/similarity_viewer_url_response.rb +25 -12
  119. data/lib/tca_client/models/similarity_viewer_url_settings.rb +46 -24
  120. data/lib/tca_client/models/simple_submission_response.rb +117 -13
  121. data/lib/tca_client/models/simple_submission_response_all_of.rb +294 -0
  122. data/lib/tca_client/models/submission.rb +191 -13
  123. data/lib/tca_client/models/submission_all_of.rb +368 -0
  124. data/lib/tca_client/models/submission_base.rb +82 -23
  125. data/lib/tca_client/models/submission_base_metadata.rb +30 -17
  126. data/lib/tca_client/models/submission_complete_webhook_request.rb +385 -0
  127. data/lib/tca_client/models/submission_complete_webhook_request_all_of.rb +219 -0
  128. data/lib/tca_client/models/submission_complete_webhook_request_all_of_metadata.rb +219 -0
  129. data/lib/tca_client/models/submission_size_error.rb +36 -20
  130. data/lib/tca_client/models/success_message.rb +25 -12
  131. data/lib/tca_client/models/users.rb +28 -15
  132. data/lib/tca_client/models/viewer_permissions.rb +29 -16
  133. data/lib/tca_client/models/webhook.rb +62 -16
  134. data/lib/tca_client/models/webhook_all_of.rb +235 -0
  135. data/lib/tca_client/models/webhook_base.rb +28 -15
  136. data/lib/tca_client/models/webhook_path_request.rb +26 -13
  137. data/lib/tca_client/models/webhook_with_secret.rb +52 -16
  138. data/lib/tca_client/models/webhook_with_secret_all_of.rb +225 -0
  139. data/lib/tca_client/version.rb +5 -4
  140. data/lib/tca_client.rb +18 -5
  141. data/tca_client-1.0.0.gem +0 -0
  142. data/tca_client.gemspec +7 -7
  143. metadata +34 -29
  144. data/docs/InlineResponse200.md +0 -7
  145. data/docs/SimilarityMetadataTopMatches.md +0 -13
@@ -3,12 +3,15 @@
3
3
 
4
4
  #Turnitin Core API (TCA) provides direct API access to the core functionality provided by Turnitin. TCA supports file submission, similarity report generation, group management, and visualization of report matches via Cloud Viewer or PDF download. Below is the full flow to successfully set up an integration scope, an API Key, and make calls to TCA. Integration Scope and API Key management is done via the Admin Console UI by logging in as an admin user. For more details, go to our [developer portal documentation page](https://developers.turnitin.com/docs). ## Integration Scope and API Key Management TCA API calls must provide an API Key for authentication, so you must first have at least one integration scope associated with at least one API Key to use TCA. ### Admin Console UI First, login to Admin Console UI as an *Admin* user with permission to create Integration Scopes, under a tenant that is licensed to use the TCA product Integration Scopes (you can create a new one, or add keys to existing) * Click `Integrations` in the side bar --> `+ Add Integration` at top the top of the page --> Enter a name --> `Add` Button API Keys * Click `Integrations` in the side bar --> `Create API Key` Button next to a given Integration Scope --> Enter a name --> click `Create and View button` * Copy/Save the key manually or click save to clipboard button to copy it (this is the only time it will show) ## TCA Flow * Register a webhook * Create a submission * Upload a file for the submission * Wait for the submission upload to process * If you registered a webhook, a callback will be sent to it when upload is complete * The status of the *submission* will also update to `COMPLETE` * Request a Similarity Report * Wait for similarity report to process * If you registered a webhook, a callback will be sent to it when report is complete * The status of the *report* will also be updated to `COMPLETE` * Request a URL with parameters to view the Similarity Report
5
5
 
6
- OpenAPI spec version: 1.0.249
6
+ The version of the OpenAPI document: 1.0.258
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.3.0-SNAPSHOT
7
10
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 3.0.35
10
11
  =end
11
12
 
13
+ require 'cgi'
14
+
12
15
  module TCAClient
13
16
  class WebhookApi
14
17
  attr_accessor :api_client
@@ -17,9 +20,9 @@ module TCAClient
17
20
  @api_client = api_client
18
21
  end
19
22
  # Delete Webhook endpoint
20
- # @param x_turnitin_integration_name a human readable string representing the type of integration being used
21
- # @param x_turnitin_integration_version the version of the integration platform being used
22
- # @param id
23
+ # @param x_turnitin_integration_name [String] a human readable string representing the type of integration being used
24
+ # @param x_turnitin_integration_version [String] the version of the integration platform being used
25
+ # @param id [String]
23
26
  # @param [Hash] opts the optional parameters
24
27
  # @return [nil]
25
28
  def delete_webhook(x_turnitin_integration_name, x_turnitin_integration_version, id, opts = {})
@@ -28,9 +31,9 @@ module TCAClient
28
31
  end
29
32
 
30
33
  # Delete Webhook endpoint
31
- # @param x_turnitin_integration_name a human readable string representing the type of integration being used
32
- # @param x_turnitin_integration_version the version of the integration platform being used
33
- # @param id
34
+ # @param x_turnitin_integration_name [String] a human readable string representing the type of integration being used
35
+ # @param x_turnitin_integration_version [String] the version of the integration platform being used
36
+ # @param id [String]
34
37
  # @param [Hash] opts the optional parameters
35
38
  # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
36
39
  def delete_webhook_with_http_info(x_turnitin_integration_name, x_turnitin_integration_version, id, opts = {})
@@ -50,7 +53,7 @@ module TCAClient
50
53
  fail ArgumentError, "Missing the required parameter 'id' when calling WebhookApi.delete_webhook"
51
54
  end
52
55
  # resource path
53
- local_var_path = '/webhooks/{id}'.sub('{' + 'id' + '}', id.to_s)
56
+ local_var_path = '/webhooks/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
54
57
 
55
58
  # query parameters
56
59
  query_params = opts[:query_params] || {}
@@ -66,28 +69,35 @@ module TCAClient
66
69
  form_params = opts[:form_params] || {}
67
70
 
68
71
  # http body (model)
69
- post_body = opts[:body]
72
+ post_body = opts[:debug_body]
73
+
74
+ # return_type
75
+ return_type = opts[:debug_return_type]
70
76
 
71
- return_type = opts[:return_type]
77
+ # auth_names
78
+ auth_names = opts[:debug_auth_names] || ['api_key']
72
79
 
73
- auth_names = opts[:auth_names] || ['api_key']
74
- data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
80
+ new_options = opts.merge(
81
+ :operation => :"WebhookApi.delete_webhook",
75
82
  :header_params => header_params,
76
83
  :query_params => query_params,
77
84
  :form_params => form_params,
78
85
  :body => post_body,
79
86
  :auth_names => auth_names,
80
- :return_type => return_type)
87
+ :return_type => return_type
88
+ )
81
89
 
90
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
82
91
  if @api_client.config.debugging
83
92
  @api_client.config.logger.debug "API called: WebhookApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
84
93
  end
85
94
  return data, status_code, headers
86
95
  end
96
+
87
97
  # Get Webhook endpoint info
88
- # @param x_turnitin_integration_name a human readable string representing the type of integration being used
89
- # @param x_turnitin_integration_version the version of the integration platform being used
90
- # @param id
98
+ # @param x_turnitin_integration_name [String] a human readable string representing the type of integration being used
99
+ # @param x_turnitin_integration_version [String] the version of the integration platform being used
100
+ # @param id [String]
91
101
  # @param [Hash] opts the optional parameters
92
102
  # @return [Webhook]
93
103
  def get_webhook(x_turnitin_integration_name, x_turnitin_integration_version, id, opts = {})
@@ -96,9 +106,9 @@ module TCAClient
96
106
  end
97
107
 
98
108
  # Get Webhook endpoint info
99
- # @param x_turnitin_integration_name a human readable string representing the type of integration being used
100
- # @param x_turnitin_integration_version the version of the integration platform being used
101
- # @param id
109
+ # @param x_turnitin_integration_name [String] a human readable string representing the type of integration being used
110
+ # @param x_turnitin_integration_version [String] the version of the integration platform being used
111
+ # @param id [String]
102
112
  # @param [Hash] opts the optional parameters
103
113
  # @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
104
114
  def get_webhook_with_http_info(x_turnitin_integration_name, x_turnitin_integration_version, id, opts = {})
@@ -118,7 +128,7 @@ module TCAClient
118
128
  fail ArgumentError, "Missing the required parameter 'id' when calling WebhookApi.get_webhook"
119
129
  end
120
130
  # resource path
121
- local_var_path = '/webhooks/{id}'.sub('{' + 'id' + '}', id.to_s)
131
+ local_var_path = '/webhooks/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
122
132
 
123
133
  # query parameters
124
134
  query_params = opts[:query_params] || {}
@@ -134,51 +144,54 @@ module TCAClient
134
144
  form_params = opts[:form_params] || {}
135
145
 
136
146
  # http body (model)
137
- post_body = opts[:body]
147
+ post_body = opts[:debug_body]
148
+
149
+ # return_type
150
+ return_type = opts[:debug_return_type] || 'Webhook'
138
151
 
139
- return_type = opts[:return_type] || 'Webhook'
152
+ # auth_names
153
+ auth_names = opts[:debug_auth_names] || ['api_key']
140
154
 
141
- auth_names = opts[:auth_names] || ['api_key']
142
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
155
+ new_options = opts.merge(
156
+ :operation => :"WebhookApi.get_webhook",
143
157
  :header_params => header_params,
144
158
  :query_params => query_params,
145
159
  :form_params => form_params,
146
160
  :body => post_body,
147
161
  :auth_names => auth_names,
148
- :return_type => return_type)
162
+ :return_type => return_type
163
+ )
149
164
 
165
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
150
166
  if @api_client.config.debugging
151
167
  @api_client.config.logger.debug "API called: WebhookApi#get_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
152
168
  end
153
169
  return data, status_code, headers
154
170
  end
171
+
155
172
  # Update Webhook endpoint info
156
- # @param body
157
- # @param x_turnitin_integration_name a human readable string representing the type of integration being used
158
- # @param x_turnitin_integration_version the version of the integration platform being used
159
- # @param id
173
+ # @param x_turnitin_integration_name [String] a human readable string representing the type of integration being used
174
+ # @param x_turnitin_integration_version [String] the version of the integration platform being used
175
+ # @param id [String]
176
+ # @param data [WebhookPathRequest]
160
177
  # @param [Hash] opts the optional parameters
161
178
  # @return [Webhook]
162
- def update_webhook(body, x_turnitin_integration_name, x_turnitin_integration_version, id, opts = {})
163
- data, _status_code, _headers = update_webhook_with_http_info(body, x_turnitin_integration_name, x_turnitin_integration_version, id, opts)
179
+ def update_webhook(x_turnitin_integration_name, x_turnitin_integration_version, id, data, opts = {})
180
+ data, _status_code, _headers = update_webhook_with_http_info(x_turnitin_integration_name, x_turnitin_integration_version, id, data, opts)
164
181
  data
165
182
  end
166
183
 
167
184
  # Update Webhook endpoint info
168
- # @param body
169
- # @param x_turnitin_integration_name a human readable string representing the type of integration being used
170
- # @param x_turnitin_integration_version the version of the integration platform being used
171
- # @param id
185
+ # @param x_turnitin_integration_name [String] a human readable string representing the type of integration being used
186
+ # @param x_turnitin_integration_version [String] the version of the integration platform being used
187
+ # @param id [String]
188
+ # @param data [WebhookPathRequest]
172
189
  # @param [Hash] opts the optional parameters
173
190
  # @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
174
- def update_webhook_with_http_info(body, x_turnitin_integration_name, x_turnitin_integration_version, id, opts = {})
191
+ def update_webhook_with_http_info(x_turnitin_integration_name, x_turnitin_integration_version, id, data, opts = {})
175
192
  if @api_client.config.debugging
176
193
  @api_client.config.logger.debug 'Calling API: WebhookApi.update_webhook ...'
177
194
  end
178
- # verify the required parameter 'body' is set
179
- if @api_client.config.client_side_validation && body.nil?
180
- fail ArgumentError, "Missing the required parameter 'body' when calling WebhookApi.update_webhook"
181
- end
182
195
  # verify the required parameter 'x_turnitin_integration_name' is set
183
196
  if @api_client.config.client_side_validation && x_turnitin_integration_name.nil?
184
197
  fail ArgumentError, "Missing the required parameter 'x_turnitin_integration_name' when calling WebhookApi.update_webhook"
@@ -191,8 +204,12 @@ module TCAClient
191
204
  if @api_client.config.client_side_validation && id.nil?
192
205
  fail ArgumentError, "Missing the required parameter 'id' when calling WebhookApi.update_webhook"
193
206
  end
207
+ # verify the required parameter 'data' is set
208
+ if @api_client.config.client_side_validation && data.nil?
209
+ fail ArgumentError, "Missing the required parameter 'data' when calling WebhookApi.update_webhook"
210
+ end
194
211
  # resource path
195
- local_var_path = '/webhooks/{id}'.sub('{' + 'id' + '}', id.to_s)
212
+ local_var_path = '/webhooks/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
196
213
 
197
214
  # query parameters
198
215
  query_params = opts[:query_params] || {}
@@ -202,7 +219,10 @@ module TCAClient
202
219
  # HTTP header 'Accept' (if needed)
203
220
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
204
221
  # HTTP header 'Content-Type'
205
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
222
+ content_type = @api_client.select_header_content_type(['application/json'])
223
+ if !content_type.nil?
224
+ header_params['Content-Type'] = content_type
225
+ end
206
226
  header_params[:'X-Turnitin-Integration-Name'] = x_turnitin_integration_name
207
227
  header_params[:'X-Turnitin-Integration-Version'] = x_turnitin_integration_version
208
228
 
@@ -210,27 +230,34 @@ module TCAClient
210
230
  form_params = opts[:form_params] || {}
211
231
 
212
232
  # http body (model)
213
- post_body = opts[:body] || @api_client.object_to_http_body(body)
233
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(data)
214
234
 
215
- return_type = opts[:return_type] || 'Webhook'
235
+ # return_type
236
+ return_type = opts[:debug_return_type] || 'Webhook'
216
237
 
217
- auth_names = opts[:auth_names] || ['api_key']
218
- data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
238
+ # auth_names
239
+ auth_names = opts[:debug_auth_names] || ['api_key']
240
+
241
+ new_options = opts.merge(
242
+ :operation => :"WebhookApi.update_webhook",
219
243
  :header_params => header_params,
220
244
  :query_params => query_params,
221
245
  :form_params => form_params,
222
246
  :body => post_body,
223
247
  :auth_names => auth_names,
224
- :return_type => return_type)
248
+ :return_type => return_type
249
+ )
225
250
 
251
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
226
252
  if @api_client.config.debugging
227
253
  @api_client.config.logger.debug "API called: WebhookApi#update_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
228
254
  end
229
255
  return data, status_code, headers
230
256
  end
257
+
231
258
  # List registered Webhook endpoints
232
- # @param x_turnitin_integration_name a human readable string representing the type of integration being used
233
- # @param x_turnitin_integration_version the version of the integration platform being used
259
+ # @param x_turnitin_integration_name [String] a human readable string representing the type of integration being used
260
+ # @param x_turnitin_integration_version [String] the version of the integration platform being used
234
261
  # @param [Hash] opts the optional parameters
235
262
  # @return [Array<Webhook>]
236
263
  def webhooks_get(x_turnitin_integration_name, x_turnitin_integration_version, opts = {})
@@ -239,8 +266,8 @@ module TCAClient
239
266
  end
240
267
 
241
268
  # List registered Webhook endpoints
242
- # @param x_turnitin_integration_name a human readable string representing the type of integration being used
243
- # @param x_turnitin_integration_version the version of the integration platform being used
269
+ # @param x_turnitin_integration_name [String] a human readable string representing the type of integration being used
270
+ # @param x_turnitin_integration_version [String] the version of the integration platform being used
244
271
  # @param [Hash] opts the optional parameters
245
272
  # @return [Array<(Array<Webhook>, Integer, Hash)>] Array<Webhook> data, response status code and response headers
246
273
  def webhooks_get_with_http_info(x_turnitin_integration_name, x_turnitin_integration_version, opts = {})
@@ -272,49 +299,52 @@ module TCAClient
272
299
  form_params = opts[:form_params] || {}
273
300
 
274
301
  # http body (model)
275
- post_body = opts[:body]
302
+ post_body = opts[:debug_body]
276
303
 
277
- return_type = opts[:return_type] || 'Array<Webhook>'
304
+ # return_type
305
+ return_type = opts[:debug_return_type] || 'Array<Webhook>'
278
306
 
279
- auth_names = opts[:auth_names] || ['api_key']
280
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
307
+ # auth_names
308
+ auth_names = opts[:debug_auth_names] || ['api_key']
309
+
310
+ new_options = opts.merge(
311
+ :operation => :"WebhookApi.webhooks_get",
281
312
  :header_params => header_params,
282
313
  :query_params => query_params,
283
314
  :form_params => form_params,
284
315
  :body => post_body,
285
316
  :auth_names => auth_names,
286
- :return_type => return_type)
317
+ :return_type => return_type
318
+ )
287
319
 
320
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
288
321
  if @api_client.config.debugging
289
322
  @api_client.config.logger.debug "API called: WebhookApi#webhooks_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
290
323
  end
291
324
  return data, status_code, headers
292
325
  end
326
+
293
327
  # Register a Webhook endpoint
294
- # @param body
295
- # @param x_turnitin_integration_name a human readable string representing the type of integration being used
296
- # @param x_turnitin_integration_version the version of the integration platform being used
328
+ # @param x_turnitin_integration_name [String] a human readable string representing the type of integration being used
329
+ # @param x_turnitin_integration_version [String] the version of the integration platform being used
330
+ # @param data [WebhookWithSecret]
297
331
  # @param [Hash] opts the optional parameters
298
332
  # @return [Webhook]
299
- def webhooks_post(body, x_turnitin_integration_name, x_turnitin_integration_version, opts = {})
300
- data, _status_code, _headers = webhooks_post_with_http_info(body, x_turnitin_integration_name, x_turnitin_integration_version, opts)
333
+ def webhooks_post(x_turnitin_integration_name, x_turnitin_integration_version, data, opts = {})
334
+ data, _status_code, _headers = webhooks_post_with_http_info(x_turnitin_integration_name, x_turnitin_integration_version, data, opts)
301
335
  data
302
336
  end
303
337
 
304
338
  # Register a Webhook endpoint
305
- # @param body
306
- # @param x_turnitin_integration_name a human readable string representing the type of integration being used
307
- # @param x_turnitin_integration_version the version of the integration platform being used
339
+ # @param x_turnitin_integration_name [String] a human readable string representing the type of integration being used
340
+ # @param x_turnitin_integration_version [String] the version of the integration platform being used
341
+ # @param data [WebhookWithSecret]
308
342
  # @param [Hash] opts the optional parameters
309
343
  # @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
310
- def webhooks_post_with_http_info(body, x_turnitin_integration_name, x_turnitin_integration_version, opts = {})
344
+ def webhooks_post_with_http_info(x_turnitin_integration_name, x_turnitin_integration_version, data, opts = {})
311
345
  if @api_client.config.debugging
312
346
  @api_client.config.logger.debug 'Calling API: WebhookApi.webhooks_post ...'
313
347
  end
314
- # verify the required parameter 'body' is set
315
- if @api_client.config.client_side_validation && body.nil?
316
- fail ArgumentError, "Missing the required parameter 'body' when calling WebhookApi.webhooks_post"
317
- end
318
348
  # verify the required parameter 'x_turnitin_integration_name' is set
319
349
  if @api_client.config.client_side_validation && x_turnitin_integration_name.nil?
320
350
  fail ArgumentError, "Missing the required parameter 'x_turnitin_integration_name' when calling WebhookApi.webhooks_post"
@@ -323,6 +353,10 @@ module TCAClient
323
353
  if @api_client.config.client_side_validation && x_turnitin_integration_version.nil?
324
354
  fail ArgumentError, "Missing the required parameter 'x_turnitin_integration_version' when calling WebhookApi.webhooks_post"
325
355
  end
356
+ # verify the required parameter 'data' is set
357
+ if @api_client.config.client_side_validation && data.nil?
358
+ fail ArgumentError, "Missing the required parameter 'data' when calling WebhookApi.webhooks_post"
359
+ end
326
360
  # resource path
327
361
  local_var_path = '/webhooks'
328
362
 
@@ -334,7 +368,10 @@ module TCAClient
334
368
  # HTTP header 'Accept' (if needed)
335
369
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
336
370
  # HTTP header 'Content-Type'
337
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
371
+ content_type = @api_client.select_header_content_type(['application/json'])
372
+ if !content_type.nil?
373
+ header_params['Content-Type'] = content_type
374
+ end
338
375
  header_params[:'X-Turnitin-Integration-Name'] = x_turnitin_integration_name
339
376
  header_params[:'X-Turnitin-Integration-Version'] = x_turnitin_integration_version
340
377
 
@@ -342,19 +379,25 @@ module TCAClient
342
379
  form_params = opts[:form_params] || {}
343
380
 
344
381
  # http body (model)
345
- post_body = opts[:body] || @api_client.object_to_http_body(body)
382
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(data)
383
+
384
+ # return_type
385
+ return_type = opts[:debug_return_type] || 'Webhook'
346
386
 
347
- return_type = opts[:return_type] || 'Webhook'
387
+ # auth_names
388
+ auth_names = opts[:debug_auth_names] || ['api_key']
348
389
 
349
- auth_names = opts[:auth_names] || ['api_key']
350
- data, status_code, headers = @api_client.call_api(:POST, local_var_path,
390
+ new_options = opts.merge(
391
+ :operation => :"WebhookApi.webhooks_post",
351
392
  :header_params => header_params,
352
393
  :query_params => query_params,
353
394
  :form_params => form_params,
354
395
  :body => post_body,
355
396
  :auth_names => auth_names,
356
- :return_type => return_type)
397
+ :return_type => return_type
398
+ )
357
399
 
400
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
358
401
  if @api_client.config.debugging
359
402
  @api_client.config.logger.debug "API called: WebhookApi#webhooks_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
360
403
  end
@@ -3,18 +3,19 @@
3
3
 
4
4
  #Turnitin Core API (TCA) provides direct API access to the core functionality provided by Turnitin. TCA supports file submission, similarity report generation, group management, and visualization of report matches via Cloud Viewer or PDF download. Below is the full flow to successfully set up an integration scope, an API Key, and make calls to TCA. Integration Scope and API Key management is done via the Admin Console UI by logging in as an admin user. For more details, go to our [developer portal documentation page](https://developers.turnitin.com/docs). ## Integration Scope and API Key Management TCA API calls must provide an API Key for authentication, so you must first have at least one integration scope associated with at least one API Key to use TCA. ### Admin Console UI First, login to Admin Console UI as an *Admin* user with permission to create Integration Scopes, under a tenant that is licensed to use the TCA product Integration Scopes (you can create a new one, or add keys to existing) * Click `Integrations` in the side bar --> `+ Add Integration` at top the top of the page --> Enter a name --> `Add` Button API Keys * Click `Integrations` in the side bar --> `Create API Key` Button next to a given Integration Scope --> Enter a name --> click `Create and View button` * Copy/Save the key manually or click save to clipboard button to copy it (this is the only time it will show) ## TCA Flow * Register a webhook * Create a submission * Upload a file for the submission * Wait for the submission upload to process * If you registered a webhook, a callback will be sent to it when upload is complete * The status of the *submission* will also update to `COMPLETE` * Request a Similarity Report * Wait for similarity report to process * If you registered a webhook, a callback will be sent to it when report is complete * The status of the *report* will also be updated to `COMPLETE` * Request a URL with parameters to view the Similarity Report
5
5
 
6
- OpenAPI spec version: 1.0.249
6
+ The version of the OpenAPI document: 1.0.258
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.3.0-SNAPSHOT
7
10
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 3.0.35
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 TCAClient
20
21
  class ApiClient
@@ -30,7 +31,7 @@ module TCAClient
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,12 +87,13 @@ module TCAClient
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] || {})
93
94
  query_params = opts[:query_params] || {}
94
95
  form_params = opts[:form_params] || {}
96
+ follow_location = opts[:follow_location] || true
95
97
 
96
98
  update_params_for_auth! header_params, query_params, opts[:auth_names]
97
99
 
@@ -108,7 +110,8 @@ module TCAClient
108
110
  :ssl_verifyhost => _verify_ssl_host,
109
111
  :sslcert => @config.cert_file,
110
112
  :sslkey => @config.key_file,
111
- :verbose => @config.debugging
113
+ :verbose => @config.debugging,
114
+ :followlocation => follow_location
112
115
  }
113
116
 
114
117
  # set custom cert, if provided
@@ -155,6 +158,44 @@ module TCAClient
155
158
  data
156
159
  end
157
160
 
161
+ # Save response body into a file in (the defined) temporary folder, using the filename
162
+ # from the "Content-Disposition" header if provided, otherwise a random filename.
163
+ # The response body is written to the file in chunks in order to handle files which
164
+ # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
165
+ # process can use.
166
+ #
167
+ # @see Configuration#temp_folder_path
168
+ def download_file(request)
169
+ tempfile = nil
170
+ encoding = nil
171
+ request.on_headers do |response|
172
+ content_disposition = response.headers['Content-Disposition']
173
+ if content_disposition && content_disposition =~ /filename=/i
174
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
175
+ prefix = sanitize_filename(filename)
176
+ else
177
+ prefix = 'download-'
178
+ end
179
+ prefix = prefix + '-' unless prefix.end_with?('-')
180
+ encoding = response.body.encoding
181
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
182
+ @tempfile = tempfile
183
+ end
184
+ request.on_body do |chunk|
185
+ chunk.force_encoding(encoding)
186
+ tempfile.write(chunk)
187
+ end
188
+ request.on_complete do |response|
189
+ if tempfile
190
+ tempfile.close
191
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
192
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
193
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
194
+ "explicitly with `tempfile.delete`"
195
+ end
196
+ end
197
+ end
198
+
158
199
  # Check if the given MIME is a JSON MIME.
159
200
  # JSON MIME examples:
160
201
  # application/json
@@ -191,7 +232,7 @@ module TCAClient
191
232
  begin
192
233
  data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
193
234
  rescue JSON::ParserError => e
194
- if %w(String Date DateTime).include?(return_type)
235
+ if %w(String Date Time).include?(return_type)
195
236
  data = body
196
237
  else
197
238
  raise e
@@ -216,9 +257,9 @@ module TCAClient
216
257
  data.to_f
217
258
  when 'Boolean'
218
259
  data == true
219
- when 'DateTime'
260
+ when 'Time'
220
261
  # parse date time (expecting ISO 8601 format)
221
- DateTime.parse data
262
+ Time.parse data
222
263
  when 'Date'
223
264
  # parse date time (expecting ISO 8601 format)
224
265
  Date.parse data
@@ -236,46 +277,9 @@ module TCAClient
236
277
  data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
237
278
  end
238
279
  else
239
- # models, e.g. Pet
240
- TCAClient.const_get(return_type).build_from_hash(data)
241
- end
242
- end
243
-
244
- # Save response body into a file in (the defined) temporary folder, using the filename
245
- # from the "Content-Disposition" header if provided, otherwise a random filename.
246
- # The response body is written to the file in chunks in order to handle files which
247
- # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
248
- # process can use.
249
- #
250
- # @see Configuration#temp_folder_path
251
- def download_file(request)
252
- tempfile = nil
253
- encoding = nil
254
- request.on_headers do |response|
255
- content_disposition = response.headers['Content-Disposition']
256
- if content_disposition && content_disposition =~ /filename=/i
257
- filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
258
- prefix = sanitize_filename(filename)
259
- else
260
- prefix = 'download-'
261
- end
262
- prefix = prefix + '-' unless prefix.end_with?('-')
263
- encoding = response.body.encoding
264
- tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
265
- @tempfile = tempfile
266
- end
267
- request.on_body do |chunk|
268
- chunk.force_encoding(encoding)
269
- tempfile.write(chunk)
270
- end
271
- request.on_complete do |response|
272
- if tempfile
273
- tempfile.close
274
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
275
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
276
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
277
- "explicitly with `tempfile.delete`"
278
- end
280
+ # models (e.g. Pet) or oneOf
281
+ klass = TCAClient.const_get(return_type)
282
+ klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
279
283
  end
280
284
  end
281
285
 
@@ -288,13 +292,13 @@ module TCAClient
288
292
  filename.gsub(/.*[\/\\]/, '')
289
293
  end
290
294
 
291
- def build_request_url(path)
295
+ def build_request_url(path, opts = {})
292
296
  # Add leading and trailing slashes to path
293
297
  path = "/#{path}".gsub(/\/+/, '/')
294
- @config.base_url + path
298
+ @config.base_url(opts[:operation]) + path
295
299
  end
296
300
 
297
- # Update hearder and query params based on authentication settings.
301
+ # Update header and query params based on authentication settings.
298
302
  #
299
303
  # @param [Hash] header_params Header parameters
300
304
  # @param [Hash] query_params Query parameters
@@ -306,14 +310,14 @@ module TCAClient
306
310
  case auth_setting[:in]
307
311
  when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
308
312
  when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
309
- else fail ArgumentError, 'Authentication token must be in `query` of `header`'
313
+ else fail ArgumentError, 'Authentication token must be in `query` or `header`'
310
314
  end
311
315
  end
312
316
  end
313
317
 
314
318
  # Sets user agent in HTTP header
315
319
  #
316
- # @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0)
320
+ # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
317
321
  def user_agent=(user_agent)
318
322
  @user_agent = user_agent
319
323
  @default_headers['User-Agent'] = @user_agent
@@ -333,8 +337,8 @@ module TCAClient
333
337
  # @param [Array] content_types array for Content-Type
334
338
  # @return [String] the Content-Type header (e.g. application/json)
335
339
  def select_header_content_type(content_types)
336
- # use application/json by default
337
- return 'application/json' if content_types.nil? || content_types.empty?
340
+ # return nil by default
341
+ return if content_types.nil? || content_types.empty?
338
342
  # use JSON when present, otherwise use the first one
339
343
  json_content_type = content_types.find { |s| json_mime?(s) }
340
344
  json_content_type || content_types.first
@@ -3,10 +3,11 @@
3
3
 
4
4
  #Turnitin Core API (TCA) provides direct API access to the core functionality provided by Turnitin. TCA supports file submission, similarity report generation, group management, and visualization of report matches via Cloud Viewer or PDF download. Below is the full flow to successfully set up an integration scope, an API Key, and make calls to TCA. Integration Scope and API Key management is done via the Admin Console UI by logging in as an admin user. For more details, go to our [developer portal documentation page](https://developers.turnitin.com/docs). ## Integration Scope and API Key Management TCA API calls must provide an API Key for authentication, so you must first have at least one integration scope associated with at least one API Key to use TCA. ### Admin Console UI First, login to Admin Console UI as an *Admin* user with permission to create Integration Scopes, under a tenant that is licensed to use the TCA product Integration Scopes (you can create a new one, or add keys to existing) * Click `Integrations` in the side bar --> `+ Add Integration` at top the top of the page --> Enter a name --> `Add` Button API Keys * Click `Integrations` in the side bar --> `Create API Key` Button next to a given Integration Scope --> Enter a name --> click `Create and View button` * Copy/Save the key manually or click save to clipboard button to copy it (this is the only time it will show) ## TCA Flow * Register a webhook * Create a submission * Upload a file for the submission * Wait for the submission upload to process * If you registered a webhook, a callback will be sent to it when upload is complete * The status of the *submission* will also update to `COMPLETE` * Request a Similarity Report * Wait for similarity report to process * If you registered a webhook, a callback will be sent to it when report is complete * The status of the *report* will also be updated to `COMPLETE` * Request a URL with parameters to view the Similarity Report
5
5
 
6
- OpenAPI spec version: 1.0.249
6
+ The version of the OpenAPI document: 1.0.258
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.3.0-SNAPSHOT
7
10
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 3.0.35
10
11
  =end
11
12
 
12
13
  module TCAClient
@@ -52,6 +53,5 @@ module TCAClient
52
53
 
53
54
  msg
54
55
  end
55
-
56
56
  end
57
57
  end