tca_client 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/docs/AddGroupAttachmentRequest.md +16 -4
  4. data/docs/AddGroupAttachmentResponse.md +14 -3
  5. data/docs/AggregateGroup.md +24 -8
  6. data/docs/AnnotationsSettings.md +18 -0
  7. data/docs/AuthorMetadataOverride.md +16 -4
  8. data/docs/EULAApi.md +166 -92
  9. data/docs/Error.md +16 -4
  10. data/docs/Eula.md +18 -5
  11. data/docs/EulaAcceptListItem.md +20 -6
  12. data/docs/EulaAcceptRequest.md +20 -6
  13. data/docs/EulaVersion.md +22 -7
  14. data/docs/FeaturesApi.md +41 -23
  15. data/docs/FeaturesEnabled.md +20 -6
  16. data/docs/FeaturesGenerationSettings.md +16 -4
  17. data/docs/FeaturesSimilarity.md +18 -5
  18. data/docs/FeaturesSimilarityViewSettings.md +38 -15
  19. data/docs/FeaturesTenant.md +14 -3
  20. data/docs/FeaturesViewerModes.md +16 -4
  21. data/docs/GenerateSimilarityPDF.md +18 -0
  22. data/docs/GetGroupAttachments200Response.md +18 -0
  23. data/docs/Group.md +18 -5
  24. data/docs/GroupAttachmentResponse.md +20 -6
  25. data/docs/GroupContext.md +18 -5
  26. data/docs/GroupsApi.md +321 -177
  27. data/docs/IndexApi.md +84 -44
  28. data/docs/IndexStateSettings.md +14 -3
  29. data/docs/IndexingSettings.md +14 -3
  30. data/docs/PDFStatusWebhookRequest.md +24 -0
  31. data/docs/PdfStatusResponse.md +14 -3
  32. data/docs/RateLimitError.md +16 -4
  33. data/docs/RequestPdfResponse.md +14 -3
  34. data/docs/Sidebar.md +14 -3
  35. data/docs/SimilarityApi.md +239 -129
  36. data/docs/SimilarityCompleteWebhookRequest.md +38 -0
  37. data/docs/SimilarityGenerationSettings.md +20 -6
  38. data/docs/SimilarityMetadata.md +32 -12
  39. data/docs/SimilarityMetadataAllOf.md +28 -0
  40. data/docs/SimilarityMetadataAllOfTopMatches.md +30 -0
  41. data/docs/SimilarityPutRequest.md +18 -5
  42. data/docs/SimilarityScoreData.md +20 -6
  43. data/docs/SimilaritySettings.md +18 -5
  44. data/docs/SimilaritySettingsModes.md +16 -4
  45. data/docs/SimilaritySettingsViewSettings.md +14 -3
  46. data/docs/SimilarityViewSettings.md +38 -15
  47. data/docs/SimilarityViewerUrlResponse.md +14 -3
  48. data/docs/SimilarityViewerUrlSettings.md +30 -10
  49. data/docs/SimpleSubmissionResponse.md +22 -2
  50. data/docs/SimpleSubmissionResponseAllOf.md +26 -0
  51. data/docs/Submission.md +34 -2
  52. data/docs/SubmissionAllOf.md +38 -0
  53. data/docs/SubmissionApi.md +203 -112
  54. data/docs/SubmissionBase.md +30 -11
  55. data/docs/SubmissionBaseMetadata.md +24 -8
  56. data/docs/SubmissionCompleteWebhookRequest.md +40 -0
  57. data/docs/SubmissionCompleteWebhookRequestAllOf.md +18 -0
  58. data/docs/SubmissionCompleteWebhookRequestAllOfMetadata.md +18 -0
  59. data/docs/SubmissionSizeError.md +16 -4
  60. data/docs/SuccessMessage.md +14 -3
  61. data/docs/Users.md +20 -6
  62. data/docs/ViewerPermissions.md +22 -7
  63. data/docs/Webhook.md +24 -6
  64. data/docs/WebhookAllOf.md +20 -0
  65. data/docs/WebhookApi.md +193 -103
  66. data/docs/WebhookBase.md +20 -6
  67. data/docs/WebhookPathRequest.md +16 -4
  68. data/docs/WebhookWithSecret.md +22 -6
  69. data/docs/WebhookWithSecretAllOf.md +18 -0
  70. data/lib/tca_client/api/eula_api.rb +96 -63
  71. data/lib/tca_client/api/features_api.rb +21 -12
  72. data/lib/tca_client/api/groups_api.rb +225 -155
  73. data/lib/tca_client/api/index_api.rb +46 -27
  74. data/lib/tca_client/api/similarity_api.rb +165 -104
  75. data/lib/tca_client/api/submission_api.rb +140 -97
  76. data/lib/tca_client/api/webhook_api.rb +120 -77
  77. data/lib/tca_client/api_client.rb +61 -57
  78. data/lib/tca_client/api_error.rb +4 -4
  79. data/lib/tca_client/configuration.rb +93 -13
  80. data/lib/tca_client/models/add_group_attachment_request.rb +50 -13
  81. data/lib/tca_client/models/add_group_attachment_response.rb +25 -12
  82. data/lib/tca_client/models/aggregate_group.rb +34 -21
  83. data/lib/tca_client/models/annotations_settings.rb +220 -0
  84. data/lib/tca_client/models/author_metadata_override.rb +26 -13
  85. data/lib/tca_client/models/error.rb +26 -13
  86. data/lib/tca_client/models/eula.rb +27 -14
  87. data/lib/tca_client/models/eula_accept_list_item.rb +28 -15
  88. data/lib/tca_client/models/eula_accept_request.rb +28 -15
  89. data/lib/tca_client/models/eula_version.rb +29 -16
  90. data/lib/tca_client/models/features_enabled.rb +28 -15
  91. data/lib/tca_client/models/features_generation_settings.rb +26 -13
  92. data/lib/tca_client/models/features_similarity.rb +27 -14
  93. data/lib/tca_client/models/features_similarity_view_settings.rb +37 -24
  94. data/lib/tca_client/models/features_tenant.rb +25 -12
  95. data/lib/tca_client/models/features_viewer_modes.rb +26 -13
  96. data/lib/tca_client/models/generate_similarity_pdf.rb +254 -0
  97. data/lib/tca_client/models/{inline_response_200.rb → get_group_attachments200_response.rb} +28 -15
  98. data/lib/tca_client/models/group.rb +29 -16
  99. data/lib/tca_client/models/group_attachment_response.rb +38 -17
  100. data/lib/tca_client/models/group_context.rb +27 -14
  101. data/lib/tca_client/models/index_state_settings.rb +25 -12
  102. data/lib/tca_client/models/indexing_settings.rb +25 -12
  103. data/lib/tca_client/models/pdf_status_response.rb +27 -14
  104. data/lib/tca_client/models/pdf_status_webhook_request.rb +283 -0
  105. data/lib/tca_client/models/rate_limit_error.rb +36 -20
  106. data/lib/tca_client/models/request_pdf_response.rb +25 -12
  107. data/lib/tca_client/models/sidebar.rb +27 -14
  108. data/lib/tca_client/models/similarity_complete_webhook_request.rb +366 -0
  109. data/lib/tca_client/models/similarity_generation_settings.rb +30 -17
  110. data/lib/tca_client/models/similarity_metadata.rb +45 -28
  111. data/lib/tca_client/models/similarity_metadata_all_of.rb +301 -0
  112. data/lib/tca_client/models/{similarity_metadata_top_matches.rb → similarity_metadata_all_of_top_matches.rb} +34 -21
  113. data/lib/tca_client/models/similarity_put_request.rb +27 -14
  114. data/lib/tca_client/models/similarity_score_data.rb +28 -15
  115. data/lib/tca_client/models/similarity_settings.rb +29 -16
  116. data/lib/tca_client/models/similarity_settings_modes.rb +26 -13
  117. data/lib/tca_client/models/similarity_settings_view_settings.rb +25 -12
  118. data/lib/tca_client/models/similarity_view_settings.rb +37 -24
  119. data/lib/tca_client/models/similarity_viewer_url_response.rb +25 -12
  120. data/lib/tca_client/models/similarity_viewer_url_settings.rb +46 -24
  121. data/lib/tca_client/models/simple_submission_response.rb +117 -13
  122. data/lib/tca_client/models/simple_submission_response_all_of.rb +294 -0
  123. data/lib/tca_client/models/submission.rb +191 -13
  124. data/lib/tca_client/models/submission_all_of.rb +368 -0
  125. data/lib/tca_client/models/submission_base.rb +82 -23
  126. data/lib/tca_client/models/submission_base_metadata.rb +30 -17
  127. data/lib/tca_client/models/submission_complete_webhook_request.rb +385 -0
  128. data/lib/tca_client/models/submission_complete_webhook_request_all_of.rb +219 -0
  129. data/lib/tca_client/models/submission_complete_webhook_request_all_of_metadata.rb +219 -0
  130. data/lib/tca_client/models/submission_size_error.rb +36 -20
  131. data/lib/tca_client/models/success_message.rb +25 -12
  132. data/lib/tca_client/models/users.rb +28 -15
  133. data/lib/tca_client/models/viewer_permissions.rb +29 -16
  134. data/lib/tca_client/models/webhook.rb +62 -16
  135. data/lib/tca_client/models/webhook_all_of.rb +235 -0
  136. data/lib/tca_client/models/webhook_base.rb +28 -15
  137. data/lib/tca_client/models/webhook_path_request.rb +26 -13
  138. data/lib/tca_client/models/webhook_with_secret.rb +52 -16
  139. data/lib/tca_client/models/webhook_with_secret_all_of.rb +225 -0
  140. data/lib/tca_client/version.rb +5 -4
  141. data/lib/tca_client.rb +18 -5
  142. data/spec/api/submission_api_spec.rb +2 -2
  143. data/tca_client-1.0.0.gem +0 -0
  144. data/tca_client-1.0.1.gem +0 -0
  145. data/tca_client.gemspec +7 -7
  146. metadata +44 -38
  147. data/docs/InlineResponse200.md +0 -7
  148. data/docs/SimilarityMetadataTopMatches.md +0 -13
@@ -0,0 +1,368 @@
1
+ =begin
2
+ #Turnitin Core API
3
+
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
+
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
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TCAClient
17
+ class SubmissionAllOf
18
+ # the owner of the submission
19
+ attr_accessor :owner
20
+
21
+ # the title of the submission
22
+ attr_accessor :title
23
+
24
+ # the current status of the Submission
25
+ attr_accessor :status
26
+
27
+ # the unique ID of the submission
28
+ attr_accessor :id
29
+
30
+ # the content type of the submission
31
+ attr_accessor :content_type
32
+
33
+ # the number of pages in the submission
34
+ attr_accessor :page_count
35
+
36
+ # the number of words in the submission
37
+ attr_accessor :word_count
38
+
39
+ # the number of characters in the submission
40
+ attr_accessor :character_count
41
+
42
+ # an error code representing the type of error encountered (if applicable)
43
+ attr_accessor :error_code
44
+
45
+ # RFC3339 timestamp of when this submission was initially created. This is the time at which the POST to /submissions was made.
46
+ attr_accessor :created_time
47
+
48
+ # Set of capabilities available to the current submission
49
+ attr_accessor :capabilities
50
+
51
+ class EnumAttributeValidator
52
+ attr_reader :datatype
53
+ attr_reader :allowable_values
54
+
55
+ def initialize(datatype, allowable_values)
56
+ @allowable_values = allowable_values.map do |value|
57
+ case datatype.to_s
58
+ when /Integer/i
59
+ value.to_i
60
+ when /Float/i
61
+ value.to_f
62
+ else
63
+ value
64
+ end
65
+ end
66
+ end
67
+
68
+ def valid?(value)
69
+ !value || allowable_values.include?(value)
70
+ end
71
+ end
72
+
73
+ # Attribute mapping from ruby-style variable name to JSON key.
74
+ def self.attribute_map
75
+ {
76
+ :'owner' => :'owner',
77
+ :'title' => :'title',
78
+ :'status' => :'status',
79
+ :'id' => :'id',
80
+ :'content_type' => :'content_type',
81
+ :'page_count' => :'page_count',
82
+ :'word_count' => :'word_count',
83
+ :'character_count' => :'character_count',
84
+ :'error_code' => :'error_code',
85
+ :'created_time' => :'created_time',
86
+ :'capabilities' => :'capabilities'
87
+ }
88
+ end
89
+
90
+ # Returns all the JSON keys this model knows about
91
+ def self.acceptable_attributes
92
+ attribute_map.values
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.openapi_types
97
+ {
98
+ :'owner' => :'String',
99
+ :'title' => :'String',
100
+ :'status' => :'String',
101
+ :'id' => :'String',
102
+ :'content_type' => :'String',
103
+ :'page_count' => :'Integer',
104
+ :'word_count' => :'Integer',
105
+ :'character_count' => :'Integer',
106
+ :'error_code' => :'String',
107
+ :'created_time' => :'Time',
108
+ :'capabilities' => :'Array<String>'
109
+ }
110
+ end
111
+
112
+ # List of attributes with nullable: true
113
+ def self.openapi_nullable
114
+ Set.new([
115
+ ])
116
+ end
117
+
118
+ # Initializes the object
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ def initialize(attributes = {})
121
+ if (!attributes.is_a?(Hash))
122
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TCAClient::SubmissionAllOf` initialize method"
123
+ end
124
+
125
+ # check to see if the attribute exists and convert string to symbol for hash key
126
+ attributes = attributes.each_with_object({}) { |(k, v), h|
127
+ if (!self.class.attribute_map.key?(k.to_sym))
128
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TCAClient::SubmissionAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
129
+ end
130
+ h[k.to_sym] = v
131
+ }
132
+
133
+ if attributes.key?(:'owner')
134
+ self.owner = attributes[:'owner']
135
+ end
136
+
137
+ if attributes.key?(:'title')
138
+ self.title = attributes[:'title']
139
+ end
140
+
141
+ if attributes.key?(:'status')
142
+ self.status = attributes[:'status']
143
+ end
144
+
145
+ if attributes.key?(:'id')
146
+ self.id = attributes[:'id']
147
+ end
148
+
149
+ if attributes.key?(:'content_type')
150
+ self.content_type = attributes[:'content_type']
151
+ end
152
+
153
+ if attributes.key?(:'page_count')
154
+ self.page_count = attributes[:'page_count']
155
+ end
156
+
157
+ if attributes.key?(:'word_count')
158
+ self.word_count = attributes[:'word_count']
159
+ end
160
+
161
+ if attributes.key?(:'character_count')
162
+ self.character_count = attributes[:'character_count']
163
+ end
164
+
165
+ if attributes.key?(:'error_code')
166
+ self.error_code = attributes[:'error_code']
167
+ end
168
+
169
+ if attributes.key?(:'created_time')
170
+ self.created_time = attributes[:'created_time']
171
+ end
172
+
173
+ if attributes.key?(:'capabilities')
174
+ if (value = attributes[:'capabilities']).is_a?(Array)
175
+ self.capabilities = value
176
+ end
177
+ end
178
+ end
179
+
180
+ # Show invalid properties with the reasons. Usually used together with valid?
181
+ # @return Array for valid properties with the reasons
182
+ def list_invalid_properties
183
+ invalid_properties = Array.new
184
+ invalid_properties
185
+ end
186
+
187
+ # Check to see if the all the properties in the model are valid
188
+ # @return true if the model is valid
189
+ def valid?
190
+ status_validator = EnumAttributeValidator.new('String', ["CREATED", "PROCESSING", "COMPLETE", "DELETED", "ERROR"])
191
+ return false unless status_validator.valid?(@status)
192
+ error_code_validator = EnumAttributeValidator.new('String', ["UNSUPPORTED_FILETYPE", "PROCESSING_ERROR", "CANNOT_EXTRACT_TEXT", "TOO_LITTLE_TEXT", "TOO_MUCH_TEXT", "TOO_MANY_PAGES", "FILE_LOCKED", "CORRUPT_FILE"])
193
+ return false unless error_code_validator.valid?(@error_code)
194
+ true
195
+ end
196
+
197
+ # Custom attribute writer method checking allowed values (enum).
198
+ # @param [Object] status Object to be assigned
199
+ def status=(status)
200
+ validator = EnumAttributeValidator.new('String', ["CREATED", "PROCESSING", "COMPLETE", "DELETED", "ERROR"])
201
+ unless validator.valid?(status)
202
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
203
+ end
204
+ @status = status
205
+ end
206
+
207
+ # Custom attribute writer method checking allowed values (enum).
208
+ # @param [Object] error_code Object to be assigned
209
+ def error_code=(error_code)
210
+ validator = EnumAttributeValidator.new('String', ["UNSUPPORTED_FILETYPE", "PROCESSING_ERROR", "CANNOT_EXTRACT_TEXT", "TOO_LITTLE_TEXT", "TOO_MUCH_TEXT", "TOO_MANY_PAGES", "FILE_LOCKED", "CORRUPT_FILE"])
211
+ unless validator.valid?(error_code)
212
+ fail ArgumentError, "invalid value for \"error_code\", must be one of #{validator.allowable_values}."
213
+ end
214
+ @error_code = error_code
215
+ end
216
+
217
+ # Checks equality by comparing each attribute.
218
+ # @param [Object] Object to be compared
219
+ def ==(o)
220
+ return true if self.equal?(o)
221
+ self.class == o.class &&
222
+ owner == o.owner &&
223
+ title == o.title &&
224
+ status == o.status &&
225
+ id == o.id &&
226
+ content_type == o.content_type &&
227
+ page_count == o.page_count &&
228
+ word_count == o.word_count &&
229
+ character_count == o.character_count &&
230
+ error_code == o.error_code &&
231
+ created_time == o.created_time &&
232
+ capabilities == o.capabilities
233
+ end
234
+
235
+ # @see the `==` method
236
+ # @param [Object] Object to be compared
237
+ def eql?(o)
238
+ self == o
239
+ end
240
+
241
+ # Calculates hash code according to all attributes.
242
+ # @return [Integer] Hash code
243
+ def hash
244
+ [owner, title, status, id, content_type, page_count, word_count, character_count, error_code, created_time, capabilities].hash
245
+ end
246
+
247
+ # Builds the object from hash
248
+ # @param [Hash] attributes Model attributes in the form of hash
249
+ # @return [Object] Returns the model itself
250
+ def self.build_from_hash(attributes)
251
+ new.build_from_hash(attributes)
252
+ end
253
+
254
+ # Builds the object from hash
255
+ # @param [Hash] attributes Model attributes in the form of hash
256
+ # @return [Object] Returns the model itself
257
+ def build_from_hash(attributes)
258
+ return nil unless attributes.is_a?(Hash)
259
+ attributes = attributes.transform_keys(&:to_sym)
260
+ self.class.openapi_types.each_pair do |key, type|
261
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
262
+ self.send("#{key}=", nil)
263
+ elsif type =~ /\AArray<(.*)>/i
264
+ # check to ensure the input is an array given that the attribute
265
+ # is documented as an array but the input is not
266
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
267
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
268
+ end
269
+ elsif !attributes[self.class.attribute_map[key]].nil?
270
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
271
+ end
272
+ end
273
+
274
+ self
275
+ end
276
+
277
+ # Deserializes the data based on type
278
+ # @param string type Data type
279
+ # @param string value Value to be deserialized
280
+ # @return [Object] Deserialized data
281
+ def _deserialize(type, value)
282
+ case type.to_sym
283
+ when :Time
284
+ Time.parse(value)
285
+ when :Date
286
+ Date.parse(value)
287
+ when :String
288
+ value.to_s
289
+ when :Integer
290
+ value.to_i
291
+ when :Float
292
+ value.to_f
293
+ when :Boolean
294
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
295
+ true
296
+ else
297
+ false
298
+ end
299
+ when :Object
300
+ # generic object (usually a Hash), return directly
301
+ value
302
+ when /\AArray<(?<inner_type>.+)>\z/
303
+ inner_type = Regexp.last_match[:inner_type]
304
+ value.map { |v| _deserialize(inner_type, v) }
305
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
306
+ k_type = Regexp.last_match[:k_type]
307
+ v_type = Regexp.last_match[:v_type]
308
+ {}.tap do |hash|
309
+ value.each do |k, v|
310
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
311
+ end
312
+ end
313
+ else # model
314
+ # models (e.g. Pet) or oneOf
315
+ klass = TCAClient.const_get(type)
316
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
317
+ end
318
+ end
319
+
320
+ # Returns the string representation of the object
321
+ # @return [String] String presentation of the object
322
+ def to_s
323
+ to_hash.to_s
324
+ end
325
+
326
+ # to_body is an alias to to_hash (backward compatibility)
327
+ # @return [Hash] Returns the object in the form of hash
328
+ def to_body
329
+ to_hash
330
+ end
331
+
332
+ # Returns the object in the form of hash
333
+ # @return [Hash] Returns the object in the form of hash
334
+ def to_hash
335
+ hash = {}
336
+ self.class.attribute_map.each_pair do |attr, param|
337
+ value = self.send(attr)
338
+ if value.nil?
339
+ is_nullable = self.class.openapi_nullable.include?(attr)
340
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
341
+ end
342
+
343
+ hash[param] = _to_hash(value)
344
+ end
345
+ hash
346
+ end
347
+
348
+ # Outputs non-array value in the form of hash
349
+ # For object, use to_hash. Otherwise, just return the value
350
+ # @param [Object] value Any valid value
351
+ # @return [Hash] Returns the value in the form of hash
352
+ def _to_hash(value)
353
+ if value.is_a?(Array)
354
+ value.compact.map { |v| _to_hash(v) }
355
+ elsif value.is_a?(Hash)
356
+ {}.tap do |hash|
357
+ value.each { |k, v| hash[k] = _to_hash(v) }
358
+ end
359
+ elsif value.respond_to? :to_hash
360
+ value.to_hash
361
+ else
362
+ value
363
+ end
364
+ end
365
+
366
+ end
367
+
368
+ end
@@ -3,13 +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
 
12
13
  require 'date'
14
+ require 'time'
13
15
 
14
16
  module TCAClient
15
17
  # A Submission is the base object on which other services (such as similarity) are offered. In order to use other services a Submission must first be created and successfully process, then other service objects can be created.
@@ -76,27 +78,33 @@ module TCAClient
76
78
  }
77
79
  end
78
80
 
81
+ # Returns all the JSON keys this model knows about
82
+ def self.acceptable_attributes
83
+ attribute_map.values
84
+ end
85
+
79
86
  # Attribute type mapping.
80
87
  def self.openapi_types
81
88
  {
82
89
  :'id' => :'Object',
83
- :'owner' => :'Object',
84
- :'owner_default_permission_set' => :'Object',
85
- :'title' => :'Object',
86
- :'submitter' => :'Object',
87
- :'submitter_default_permission_set' => :'Object',
88
- :'eula' => :'Object',
89
- :'metadata' => :'Object',
90
- :'extract_text_only' => :'Object'
90
+ :'owner' => :'String',
91
+ :'owner_default_permission_set' => :'String',
92
+ :'title' => :'String',
93
+ :'submitter' => :'String',
94
+ :'submitter_default_permission_set' => :'String',
95
+ :'eula' => :'Eula',
96
+ :'metadata' => :'SubmissionBaseMetadata',
97
+ :'extract_text_only' => :'Boolean'
91
98
  }
92
99
  end
93
100
 
94
101
  # List of attributes with nullable: true
95
102
  def self.openapi_nullable
96
103
  Set.new([
104
+ :'id',
97
105
  ])
98
106
  end
99
-
107
+
100
108
  # Initializes the object
101
109
  # @param [Hash] attributes Model attributes in the form of hash
102
110
  def initialize(attributes = {})
@@ -153,33 +161,78 @@ module TCAClient
153
161
  # @return Array for valid properties with the reasons
154
162
  def list_invalid_properties
155
163
  invalid_properties = Array.new
164
+ if !@owner.nil? && @owner.to_s.length > 132
165
+ invalid_properties.push('invalid value for "owner", the character length must be smaller than or equal to 132.')
166
+ end
167
+
168
+ if !@title.nil? && @title.to_s.length > 500
169
+ invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 500.')
170
+ end
171
+
172
+ if !@submitter.nil? && @submitter.to_s.length > 132
173
+ invalid_properties.push('invalid value for "submitter", the character length must be smaller than or equal to 132.')
174
+ end
175
+
156
176
  invalid_properties
157
177
  end
158
178
 
159
179
  # Check to see if the all the properties in the model are valid
160
180
  # @return true if the model is valid
161
181
  def valid?
162
- owner_default_permission_set_validator = EnumAttributeValidator.new('Object', ['INSTRUCTOR', 'LEARNER', 'EDITOR', 'USER', 'APPLICANT', 'ADMINISTRATOR', 'UNDEFINED'])
182
+ return false if !@owner.nil? && @owner.to_s.length > 132
183
+ owner_default_permission_set_validator = EnumAttributeValidator.new('String', ["INSTRUCTOR", "LEARNER", "EDITOR", "USER", "APPLICANT", "ADMINISTRATOR", "UNDEFINED"])
163
184
  return false unless owner_default_permission_set_validator.valid?(@owner_default_permission_set)
164
- submitter_default_permission_set_validator = EnumAttributeValidator.new('Object', ['INSTRUCTOR', 'LEARNER', 'EDITOR', 'USER', 'APPLICANT', 'ADMINISTRATOR', 'UNDEFINED'])
185
+ return false if !@title.nil? && @title.to_s.length > 500
186
+ return false if !@submitter.nil? && @submitter.to_s.length > 132
187
+ submitter_default_permission_set_validator = EnumAttributeValidator.new('String', ["INSTRUCTOR", "LEARNER", "EDITOR", "USER", "APPLICANT", "ADMINISTRATOR", "UNDEFINED"])
165
188
  return false unless submitter_default_permission_set_validator.valid?(@submitter_default_permission_set)
166
189
  true
167
190
  end
168
191
 
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] owner Value to be assigned
194
+ def owner=(owner)
195
+ if !owner.nil? && owner.to_s.length > 132
196
+ fail ArgumentError, 'invalid value for "owner", the character length must be smaller than or equal to 132.'
197
+ end
198
+
199
+ @owner = owner
200
+ end
201
+
169
202
  # Custom attribute writer method checking allowed values (enum).
170
203
  # @param [Object] owner_default_permission_set Object to be assigned
171
204
  def owner_default_permission_set=(owner_default_permission_set)
172
- validator = EnumAttributeValidator.new('Object', ['INSTRUCTOR', 'LEARNER', 'EDITOR', 'USER', 'APPLICANT', 'ADMINISTRATOR', 'UNDEFINED'])
205
+ validator = EnumAttributeValidator.new('String', ["INSTRUCTOR", "LEARNER", "EDITOR", "USER", "APPLICANT", "ADMINISTRATOR", "UNDEFINED"])
173
206
  unless validator.valid?(owner_default_permission_set)
174
207
  fail ArgumentError, "invalid value for \"owner_default_permission_set\", must be one of #{validator.allowable_values}."
175
208
  end
176
209
  @owner_default_permission_set = owner_default_permission_set
177
210
  end
178
211
 
212
+ # Custom attribute writer method with validation
213
+ # @param [Object] title Value to be assigned
214
+ def title=(title)
215
+ if !title.nil? && title.to_s.length > 500
216
+ fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 500.'
217
+ end
218
+
219
+ @title = title
220
+ end
221
+
222
+ # Custom attribute writer method with validation
223
+ # @param [Object] submitter Value to be assigned
224
+ def submitter=(submitter)
225
+ if !submitter.nil? && submitter.to_s.length > 132
226
+ fail ArgumentError, 'invalid value for "submitter", the character length must be smaller than or equal to 132.'
227
+ end
228
+
229
+ @submitter = submitter
230
+ end
231
+
179
232
  # Custom attribute writer method checking allowed values (enum).
180
233
  # @param [Object] submitter_default_permission_set Object to be assigned
181
234
  def submitter_default_permission_set=(submitter_default_permission_set)
182
- validator = EnumAttributeValidator.new('Object', ['INSTRUCTOR', 'LEARNER', 'EDITOR', 'USER', 'APPLICANT', 'ADMINISTRATOR', 'UNDEFINED'])
235
+ validator = EnumAttributeValidator.new('String', ["INSTRUCTOR", "LEARNER", "EDITOR", "USER", "APPLICANT", "ADMINISTRATOR", "UNDEFINED"])
183
236
  unless validator.valid?(submitter_default_permission_set)
184
237
  fail ArgumentError, "invalid value for \"submitter_default_permission_set\", must be one of #{validator.allowable_values}."
185
238
  end
@@ -226,8 +279,11 @@ module TCAClient
226
279
  # @return [Object] Returns the model itself
227
280
  def build_from_hash(attributes)
228
281
  return nil unless attributes.is_a?(Hash)
282
+ attributes = attributes.transform_keys(&:to_sym)
229
283
  self.class.openapi_types.each_pair do |key, type|
230
- if type =~ /\AArray<(.*)>/i
284
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
285
+ self.send("#{key}=", nil)
286
+ elsif type =~ /\AArray<(.*)>/i
231
287
  # check to ensure the input is an array given that the attribute
232
288
  # is documented as an array but the input is not
233
289
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -235,8 +291,6 @@ module TCAClient
235
291
  end
236
292
  elsif !attributes[self.class.attribute_map[key]].nil?
237
293
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
238
- elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
239
- self.send("#{key}=", nil)
240
294
  end
241
295
  end
242
296
 
@@ -249,8 +303,8 @@ module TCAClient
249
303
  # @return [Object] Deserialized data
250
304
  def _deserialize(type, value)
251
305
  case type.to_sym
252
- when :DateTime
253
- DateTime.parse(value)
306
+ when :Time
307
+ Time.parse(value)
254
308
  when :Date
255
309
  Date.parse(value)
256
310
  when :String
@@ -280,7 +334,9 @@ module TCAClient
280
334
  end
281
335
  end
282
336
  else # model
283
- TCAClient.const_get(type).build_from_hash(value)
337
+ # models (e.g. Pet) or oneOf
338
+ klass = TCAClient.const_get(type)
339
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
284
340
  end
285
341
  end
286
342
 
@@ -328,5 +384,8 @@ module TCAClient
328
384
  else
329
385
  value
330
386
  end
331
- end end
387
+ end
388
+
389
+ end
390
+
332
391
  end
@@ -3,13 +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
 
12
13
  require 'date'
14
+ require 'time'
13
15
 
14
16
  module TCAClient
15
17
  # (optional) Submission metadata. If a group context is included, it must be associated to a group
@@ -40,15 +42,20 @@ module TCAClient
40
42
  }
41
43
  end
42
44
 
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ attribute_map.values
48
+ end
49
+
43
50
  # Attribute type mapping.
44
51
  def self.openapi_types
45
52
  {
46
- :'submitter' => :'Object',
47
- :'owners' => :'Object',
48
- :'group' => :'Object',
49
- :'group_context' => :'Object',
50
- :'original_submitted_time' => :'Object',
51
- :'custom' => :'Object'
53
+ :'submitter' => :'Users',
54
+ :'owners' => :'Array<Users>',
55
+ :'group' => :'Group',
56
+ :'group_context' => :'GroupContext',
57
+ :'original_submitted_time' => :'Time',
58
+ :'custom' => :'String'
52
59
  }
53
60
  end
54
61
 
@@ -57,7 +64,7 @@ module TCAClient
57
64
  Set.new([
58
65
  ])
59
66
  end
60
-
67
+
61
68
  # Initializes the object
62
69
  # @param [Hash] attributes Model attributes in the form of hash
63
70
  def initialize(attributes = {})
@@ -150,8 +157,11 @@ module TCAClient
150
157
  # @return [Object] Returns the model itself
151
158
  def build_from_hash(attributes)
152
159
  return nil unless attributes.is_a?(Hash)
160
+ attributes = attributes.transform_keys(&:to_sym)
153
161
  self.class.openapi_types.each_pair do |key, type|
154
- if type =~ /\AArray<(.*)>/i
162
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
163
+ self.send("#{key}=", nil)
164
+ elsif type =~ /\AArray<(.*)>/i
155
165
  # check to ensure the input is an array given that the attribute
156
166
  # is documented as an array but the input is not
157
167
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -159,8 +169,6 @@ module TCAClient
159
169
  end
160
170
  elsif !attributes[self.class.attribute_map[key]].nil?
161
171
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
162
- elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
163
- self.send("#{key}=", nil)
164
172
  end
165
173
  end
166
174
 
@@ -173,8 +181,8 @@ module TCAClient
173
181
  # @return [Object] Deserialized data
174
182
  def _deserialize(type, value)
175
183
  case type.to_sym
176
- when :DateTime
177
- DateTime.parse(value)
184
+ when :Time
185
+ Time.parse(value)
178
186
  when :Date
179
187
  Date.parse(value)
180
188
  when :String
@@ -204,7 +212,9 @@ module TCAClient
204
212
  end
205
213
  end
206
214
  else # model
207
- TCAClient.const_get(type).build_from_hash(value)
215
+ # models (e.g. Pet) or oneOf
216
+ klass = TCAClient.const_get(type)
217
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
208
218
  end
209
219
  end
210
220
 
@@ -252,5 +262,8 @@ module TCAClient
252
262
  else
253
263
  value
254
264
  end
255
- end end
265
+ end
266
+
267
+ end
268
+
256
269
  end