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,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
  class SimilarityViewerUrlSettings
@@ -32,6 +34,8 @@ module TCAClient
32
34
 
33
35
  attr_accessor :similarity
34
36
 
37
+ attr_accessor :annotations
38
+
35
39
  class EnumAttributeValidator
36
40
  attr_reader :datatype
37
41
  attr_reader :allowable_values
@@ -64,21 +68,28 @@ module TCAClient
64
68
  :'viewer_permissions' => :'viewer_permissions',
65
69
  :'eula' => :'eula',
66
70
  :'sidebar' => :'sidebar',
67
- :'similarity' => :'similarity'
71
+ :'similarity' => :'similarity',
72
+ :'annotations' => :'annotations'
68
73
  }
69
74
  end
70
75
 
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ attribute_map.values
79
+ end
80
+
71
81
  # Attribute type mapping.
72
82
  def self.openapi_types
73
83
  {
74
- :'author_metadata_override' => :'Object',
75
- :'viewer_user_id' => :'Object',
76
- :'locale' => :'Object',
77
- :'viewer_default_permission_set' => :'Object',
78
- :'viewer_permissions' => :'Object',
79
- :'eula' => :'Object',
80
- :'sidebar' => :'Object',
81
- :'similarity' => :'Object'
84
+ :'author_metadata_override' => :'AuthorMetadataOverride',
85
+ :'viewer_user_id' => :'String',
86
+ :'locale' => :'String',
87
+ :'viewer_default_permission_set' => :'String',
88
+ :'viewer_permissions' => :'ViewerPermissions',
89
+ :'eula' => :'Eula',
90
+ :'sidebar' => :'Sidebar',
91
+ :'similarity' => :'SimilaritySettings',
92
+ :'annotations' => :'AnnotationsSettings'
82
93
  }
83
94
  end
84
95
 
@@ -87,7 +98,7 @@ module TCAClient
87
98
  Set.new([
88
99
  ])
89
100
  end
90
-
101
+
91
102
  # Initializes the object
92
103
  # @param [Hash] attributes Model attributes in the form of hash
93
104
  def initialize(attributes = {})
@@ -134,6 +145,10 @@ module TCAClient
134
145
  if attributes.key?(:'similarity')
135
146
  self.similarity = attributes[:'similarity']
136
147
  end
148
+
149
+ if attributes.key?(:'annotations')
150
+ self.annotations = attributes[:'annotations']
151
+ end
137
152
  end
138
153
 
139
154
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -146,7 +161,7 @@ module TCAClient
146
161
  # Check to see if the all the properties in the model are valid
147
162
  # @return true if the model is valid
148
163
  def valid?
149
- locale_validator = EnumAttributeValidator.new('Object', ['ar-SA', 'cs-CZ', 'de-DE', 'el-GR', 'en-US', 'es-MX', 'fi-FI', 'fr-FR', 'it-IT', 'ja-JP', 'ko-KR', 'nl-NL', 'pl-PL', 'pt-BR', 'ro-RO', 'ru-RU', 'sv-SE', 'tr-TR', 'vi-VN', 'zh-CN', 'zh-TW'])
164
+ locale_validator = EnumAttributeValidator.new('String', ["ar-SA", "cs-CZ", "de-DE", "el-GR", "en-US", "es-MX", "fi-FI", "fr-FR", "it-IT", "ja-JP", "ko-KR", "nl-NL", "pl-PL", "pt-BR", "ro-RO", "ru-RU", "sv-SE", "tr-TR", "vi-VN", "zh-CN", "zh-TW"])
150
165
  return false unless locale_validator.valid?(@locale)
151
166
  true
152
167
  end
@@ -154,7 +169,7 @@ module TCAClient
154
169
  # Custom attribute writer method checking allowed values (enum).
155
170
  # @param [Object] locale Object to be assigned
156
171
  def locale=(locale)
157
- validator = EnumAttributeValidator.new('Object', ['ar-SA', 'cs-CZ', 'de-DE', 'el-GR', 'en-US', 'es-MX', 'fi-FI', 'fr-FR', 'it-IT', 'ja-JP', 'ko-KR', 'nl-NL', 'pl-PL', 'pt-BR', 'ro-RO', 'ru-RU', 'sv-SE', 'tr-TR', 'vi-VN', 'zh-CN', 'zh-TW'])
172
+ validator = EnumAttributeValidator.new('String', ["ar-SA", "cs-CZ", "de-DE", "el-GR", "en-US", "es-MX", "fi-FI", "fr-FR", "it-IT", "ja-JP", "ko-KR", "nl-NL", "pl-PL", "pt-BR", "ro-RO", "ru-RU", "sv-SE", "tr-TR", "vi-VN", "zh-CN", "zh-TW"])
158
173
  unless validator.valid?(locale)
159
174
  fail ArgumentError, "invalid value for \"locale\", must be one of #{validator.allowable_values}."
160
175
  end
@@ -173,7 +188,8 @@ module TCAClient
173
188
  viewer_permissions == o.viewer_permissions &&
174
189
  eula == o.eula &&
175
190
  sidebar == o.sidebar &&
176
- similarity == o.similarity
191
+ similarity == o.similarity &&
192
+ annotations == o.annotations
177
193
  end
178
194
 
179
195
  # @see the `==` method
@@ -185,7 +201,7 @@ module TCAClient
185
201
  # Calculates hash code according to all attributes.
186
202
  # @return [Integer] Hash code
187
203
  def hash
188
- [author_metadata_override, viewer_user_id, locale, viewer_default_permission_set, viewer_permissions, eula, sidebar, similarity].hash
204
+ [author_metadata_override, viewer_user_id, locale, viewer_default_permission_set, viewer_permissions, eula, sidebar, similarity, annotations].hash
189
205
  end
190
206
 
191
207
  # Builds the object from hash
@@ -200,8 +216,11 @@ module TCAClient
200
216
  # @return [Object] Returns the model itself
201
217
  def build_from_hash(attributes)
202
218
  return nil unless attributes.is_a?(Hash)
219
+ attributes = attributes.transform_keys(&:to_sym)
203
220
  self.class.openapi_types.each_pair do |key, type|
204
- if type =~ /\AArray<(.*)>/i
221
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
222
+ self.send("#{key}=", nil)
223
+ elsif type =~ /\AArray<(.*)>/i
205
224
  # check to ensure the input is an array given that the attribute
206
225
  # is documented as an array but the input is not
207
226
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -209,8 +228,6 @@ module TCAClient
209
228
  end
210
229
  elsif !attributes[self.class.attribute_map[key]].nil?
211
230
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
212
- elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
213
- self.send("#{key}=", nil)
214
231
  end
215
232
  end
216
233
 
@@ -223,8 +240,8 @@ module TCAClient
223
240
  # @return [Object] Deserialized data
224
241
  def _deserialize(type, value)
225
242
  case type.to_sym
226
- when :DateTime
227
- DateTime.parse(value)
243
+ when :Time
244
+ Time.parse(value)
228
245
  when :Date
229
246
  Date.parse(value)
230
247
  when :String
@@ -254,7 +271,9 @@ module TCAClient
254
271
  end
255
272
  end
256
273
  else # model
257
- TCAClient.const_get(type).build_from_hash(value)
274
+ # models (e.g. Pet) or oneOf
275
+ klass = TCAClient.const_get(type)
276
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
258
277
  end
259
278
  end
260
279
 
@@ -302,5 +321,8 @@ module TCAClient
302
321
  else
303
322
  value
304
323
  end
305
- end end
324
+ end
325
+
326
+ end
327
+
306
328
  end
@@ -3,25 +3,79 @@
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
  class SimpleSubmissionResponse
18
+ # the unique ID of the submission
19
+ attr_accessor :id
20
+
21
+ # the owner of the submission
22
+ attr_accessor :owner
23
+
24
+ # the title of the submission
25
+ attr_accessor :title
26
+
27
+ # the current status of the Submission
28
+ attr_accessor :status
29
+
30
+ # RFC3339 timestamp of when this submission was initially created. This is the time at which the POST to /submissions was made.
31
+ attr_accessor :created_time
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
16
55
  # Attribute mapping from ruby-style variable name to JSON key.
17
56
  def self.attribute_map
18
57
  {
58
+ :'id' => :'id',
59
+ :'owner' => :'owner',
60
+ :'title' => :'title',
61
+ :'status' => :'status',
62
+ :'created_time' => :'created_time'
19
63
  }
20
64
  end
21
65
 
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ attribute_map.values
69
+ end
70
+
22
71
  # Attribute type mapping.
23
72
  def self.openapi_types
24
73
  {
74
+ :'id' => :'String',
75
+ :'owner' => :'String',
76
+ :'title' => :'String',
77
+ :'status' => :'String',
78
+ :'created_time' => :'Time'
25
79
  }
26
80
  end
27
81
 
@@ -30,7 +84,14 @@ module TCAClient
30
84
  Set.new([
31
85
  ])
32
86
  end
33
-
87
+
88
+ # List of class defined in allOf (OpenAPI v3)
89
+ def self.openapi_all_of
90
+ [
91
+ :'SimpleSubmissionResponseAllOf'
92
+ ]
93
+ end
94
+
34
95
  # Initializes the object
35
96
  # @param [Hash] attributes Model attributes in the form of hash
36
97
  def initialize(attributes = {})
@@ -45,6 +106,26 @@ module TCAClient
45
106
  end
46
107
  h[k.to_sym] = v
47
108
  }
109
+
110
+ if attributes.key?(:'id')
111
+ self.id = attributes[:'id']
112
+ end
113
+
114
+ if attributes.key?(:'owner')
115
+ self.owner = attributes[:'owner']
116
+ end
117
+
118
+ if attributes.key?(:'title')
119
+ self.title = attributes[:'title']
120
+ end
121
+
122
+ if attributes.key?(:'status')
123
+ self.status = attributes[:'status']
124
+ end
125
+
126
+ if attributes.key?(:'created_time')
127
+ self.created_time = attributes[:'created_time']
128
+ end
48
129
  end
49
130
 
50
131
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -57,14 +138,31 @@ module TCAClient
57
138
  # Check to see if the all the properties in the model are valid
58
139
  # @return true if the model is valid
59
140
  def valid?
141
+ status_validator = EnumAttributeValidator.new('String', ["CREATED", "PROCESSING", "COMPLETE", "DELETED", "ERROR"])
142
+ return false unless status_validator.valid?(@status)
60
143
  true
61
144
  end
62
145
 
146
+ # Custom attribute writer method checking allowed values (enum).
147
+ # @param [Object] status Object to be assigned
148
+ def status=(status)
149
+ validator = EnumAttributeValidator.new('String', ["CREATED", "PROCESSING", "COMPLETE", "DELETED", "ERROR"])
150
+ unless validator.valid?(status)
151
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
152
+ end
153
+ @status = status
154
+ end
155
+
63
156
  # Checks equality by comparing each attribute.
64
157
  # @param [Object] Object to be compared
65
158
  def ==(o)
66
159
  return true if self.equal?(o)
67
- self.class == o.class
160
+ self.class == o.class &&
161
+ id == o.id &&
162
+ owner == o.owner &&
163
+ title == o.title &&
164
+ status == o.status &&
165
+ created_time == o.created_time
68
166
  end
69
167
 
70
168
  # @see the `==` method
@@ -76,7 +174,7 @@ module TCAClient
76
174
  # Calculates hash code according to all attributes.
77
175
  # @return [Integer] Hash code
78
176
  def hash
79
- [].hash
177
+ [id, owner, title, status, created_time].hash
80
178
  end
81
179
 
82
180
  # Builds the object from hash
@@ -91,8 +189,11 @@ module TCAClient
91
189
  # @return [Object] Returns the model itself
92
190
  def build_from_hash(attributes)
93
191
  return nil unless attributes.is_a?(Hash)
192
+ attributes = attributes.transform_keys(&:to_sym)
94
193
  self.class.openapi_types.each_pair do |key, type|
95
- if type =~ /\AArray<(.*)>/i
194
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
195
+ self.send("#{key}=", nil)
196
+ elsif type =~ /\AArray<(.*)>/i
96
197
  # check to ensure the input is an array given that the attribute
97
198
  # is documented as an array but the input is not
98
199
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -100,8 +201,6 @@ module TCAClient
100
201
  end
101
202
  elsif !attributes[self.class.attribute_map[key]].nil?
102
203
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
103
- elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
104
- self.send("#{key}=", nil)
105
204
  end
106
205
  end
107
206
 
@@ -114,8 +213,8 @@ module TCAClient
114
213
  # @return [Object] Deserialized data
115
214
  def _deserialize(type, value)
116
215
  case type.to_sym
117
- when :DateTime
118
- DateTime.parse(value)
216
+ when :Time
217
+ Time.parse(value)
119
218
  when :Date
120
219
  Date.parse(value)
121
220
  when :String
@@ -145,7 +244,9 @@ module TCAClient
145
244
  end
146
245
  end
147
246
  else # model
148
- TCAClient.const_get(type).build_from_hash(value)
247
+ # models (e.g. Pet) or oneOf
248
+ klass = TCAClient.const_get(type)
249
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
149
250
  end
150
251
  end
151
252
 
@@ -193,5 +294,8 @@ module TCAClient
193
294
  else
194
295
  value
195
296
  end
196
- end end
297
+ end
298
+
299
+ end
300
+
197
301
  end
@@ -0,0 +1,294 @@
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 SimpleSubmissionResponseAllOf
18
+ # the unique ID of the submission
19
+ attr_accessor :id
20
+
21
+ # the owner of the submission
22
+ attr_accessor :owner
23
+
24
+ # the title of the submission
25
+ attr_accessor :title
26
+
27
+ # the current status of the Submission
28
+ attr_accessor :status
29
+
30
+ # RFC3339 timestamp of when this submission was initially created. This is the time at which the POST to /submissions was made.
31
+ attr_accessor :created_time
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'id' => :'id',
59
+ :'owner' => :'owner',
60
+ :'title' => :'title',
61
+ :'status' => :'status',
62
+ :'created_time' => :'created_time'
63
+ }
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'id' => :'String',
75
+ :'owner' => :'String',
76
+ :'title' => :'String',
77
+ :'status' => :'String',
78
+ :'created_time' => :'Time'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ ])
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TCAClient::SimpleSubmissionResponseAllOf` initialize method"
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!self.class.attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TCAClient::SimpleSubmissionResponseAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'id')
104
+ self.id = attributes[:'id']
105
+ end
106
+
107
+ if attributes.key?(:'owner')
108
+ self.owner = attributes[:'owner']
109
+ end
110
+
111
+ if attributes.key?(:'title')
112
+ self.title = attributes[:'title']
113
+ end
114
+
115
+ if attributes.key?(:'status')
116
+ self.status = attributes[:'status']
117
+ end
118
+
119
+ if attributes.key?(:'created_time')
120
+ self.created_time = attributes[:'created_time']
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ invalid_properties = Array.new
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ status_validator = EnumAttributeValidator.new('String', ["CREATED", "PROCESSING", "COMPLETE", "DELETED", "ERROR"])
135
+ return false unless status_validator.valid?(@status)
136
+ true
137
+ end
138
+
139
+ # Custom attribute writer method checking allowed values (enum).
140
+ # @param [Object] status Object to be assigned
141
+ def status=(status)
142
+ validator = EnumAttributeValidator.new('String', ["CREATED", "PROCESSING", "COMPLETE", "DELETED", "ERROR"])
143
+ unless validator.valid?(status)
144
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
145
+ end
146
+ @status = status
147
+ end
148
+
149
+ # Checks equality by comparing each attribute.
150
+ # @param [Object] Object to be compared
151
+ def ==(o)
152
+ return true if self.equal?(o)
153
+ self.class == o.class &&
154
+ id == o.id &&
155
+ owner == o.owner &&
156
+ title == o.title &&
157
+ status == o.status &&
158
+ created_time == o.created_time
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(o)
164
+ self == o
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Integer] Hash code
169
+ def hash
170
+ [id, owner, title, status, created_time].hash
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def self.build_from_hash(attributes)
177
+ new.build_from_hash(attributes)
178
+ end
179
+
180
+ # Builds the object from hash
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ # @return [Object] Returns the model itself
183
+ def build_from_hash(attributes)
184
+ return nil unless attributes.is_a?(Hash)
185
+ attributes = attributes.transform_keys(&:to_sym)
186
+ self.class.openapi_types.each_pair do |key, type|
187
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
188
+ self.send("#{key}=", nil)
189
+ elsif type =~ /\AArray<(.*)>/i
190
+ # check to ensure the input is an array given that the attribute
191
+ # is documented as an array but the input is not
192
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
193
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
194
+ end
195
+ elsif !attributes[self.class.attribute_map[key]].nil?
196
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
197
+ end
198
+ end
199
+
200
+ self
201
+ end
202
+
203
+ # Deserializes the data based on type
204
+ # @param string type Data type
205
+ # @param string value Value to be deserialized
206
+ # @return [Object] Deserialized data
207
+ def _deserialize(type, value)
208
+ case type.to_sym
209
+ when :Time
210
+ Time.parse(value)
211
+ when :Date
212
+ Date.parse(value)
213
+ when :String
214
+ value.to_s
215
+ when :Integer
216
+ value.to_i
217
+ when :Float
218
+ value.to_f
219
+ when :Boolean
220
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
221
+ true
222
+ else
223
+ false
224
+ end
225
+ when :Object
226
+ # generic object (usually a Hash), return directly
227
+ value
228
+ when /\AArray<(?<inner_type>.+)>\z/
229
+ inner_type = Regexp.last_match[:inner_type]
230
+ value.map { |v| _deserialize(inner_type, v) }
231
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
232
+ k_type = Regexp.last_match[:k_type]
233
+ v_type = Regexp.last_match[:v_type]
234
+ {}.tap do |hash|
235
+ value.each do |k, v|
236
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
237
+ end
238
+ end
239
+ else # model
240
+ # models (e.g. Pet) or oneOf
241
+ klass = TCAClient.const_get(type)
242
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
243
+ end
244
+ end
245
+
246
+ # Returns the string representation of the object
247
+ # @return [String] String presentation of the object
248
+ def to_s
249
+ to_hash.to_s
250
+ end
251
+
252
+ # to_body is an alias to to_hash (backward compatibility)
253
+ # @return [Hash] Returns the object in the form of hash
254
+ def to_body
255
+ to_hash
256
+ end
257
+
258
+ # Returns the object in the form of hash
259
+ # @return [Hash] Returns the object in the form of hash
260
+ def to_hash
261
+ hash = {}
262
+ self.class.attribute_map.each_pair do |attr, param|
263
+ value = self.send(attr)
264
+ if value.nil?
265
+ is_nullable = self.class.openapi_nullable.include?(attr)
266
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
267
+ end
268
+
269
+ hash[param] = _to_hash(value)
270
+ end
271
+ hash
272
+ end
273
+
274
+ # Outputs non-array value in the form of hash
275
+ # For object, use to_hash. Otherwise, just return the value
276
+ # @param [Object] value Any valid value
277
+ # @return [Hash] Returns the value in the form of hash
278
+ def _to_hash(value)
279
+ if value.is_a?(Array)
280
+ value.compact.map { |v| _to_hash(v) }
281
+ elsif value.is_a?(Hash)
282
+ {}.tap do |hash|
283
+ value.each { |k, v| hash[k] = _to_hash(v) }
284
+ end
285
+ elsif value.respond_to? :to_hash
286
+ value.to_hash
287
+ else
288
+ value
289
+ end
290
+ end
291
+
292
+ end
293
+
294
+ end