tca_client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +862 -0
  4. data/Rakefile +8 -0
  5. data/docs/AddGroupAttachmentRequest.md +8 -0
  6. data/docs/AddGroupAttachmentResponse.md +7 -0
  7. data/docs/AggregateGroup.md +12 -0
  8. data/docs/AuthorMetadataOverride.md +8 -0
  9. data/docs/EULAApi.md +241 -0
  10. data/docs/Error.md +8 -0
  11. data/docs/Eula.md +9 -0
  12. data/docs/EulaAcceptListItem.md +10 -0
  13. data/docs/EulaAcceptRequest.md +10 -0
  14. data/docs/EulaVersion.md +11 -0
  15. data/docs/FeaturesApi.md +61 -0
  16. data/docs/FeaturesEnabled.md +10 -0
  17. data/docs/FeaturesGenerationSettings.md +8 -0
  18. data/docs/FeaturesSimilarity.md +9 -0
  19. data/docs/FeaturesSimilarityViewSettings.md +19 -0
  20. data/docs/FeaturesTenant.md +7 -0
  21. data/docs/FeaturesViewerModes.md +8 -0
  22. data/docs/Group.md +9 -0
  23. data/docs/GroupAttachmentResponse.md +10 -0
  24. data/docs/GroupContext.md +9 -0
  25. data/docs/GroupsApi.md +472 -0
  26. data/docs/IndexApi.md +119 -0
  27. data/docs/IndexStateSettings.md +7 -0
  28. data/docs/IndexingSettings.md +7 -0
  29. data/docs/InlineResponse200.md +7 -0
  30. data/docs/PdfStatusResponse.md +7 -0
  31. data/docs/RateLimitError.md +8 -0
  32. data/docs/RequestPdfResponse.md +7 -0
  33. data/docs/Sidebar.md +7 -0
  34. data/docs/SimilarityApi.md +351 -0
  35. data/docs/SimilarityGenerationSettings.md +10 -0
  36. data/docs/SimilarityMetadata.md +16 -0
  37. data/docs/SimilarityMetadataTopMatches.md +13 -0
  38. data/docs/SimilarityPutRequest.md +9 -0
  39. data/docs/SimilarityScoreData.md +10 -0
  40. data/docs/SimilaritySettings.md +9 -0
  41. data/docs/SimilaritySettingsModes.md +8 -0
  42. data/docs/SimilaritySettingsViewSettings.md +7 -0
  43. data/docs/SimilarityViewSettings.md +19 -0
  44. data/docs/SimilarityViewerUrlResponse.md +7 -0
  45. data/docs/SimilarityViewerUrlSettings.md +14 -0
  46. data/docs/SimpleSubmissionResponse.md +6 -0
  47. data/docs/Submission.md +6 -0
  48. data/docs/SubmissionApi.md +296 -0
  49. data/docs/SubmissionBase.md +15 -0
  50. data/docs/SubmissionBaseMetadata.md +12 -0
  51. data/docs/SubmissionSizeError.md +8 -0
  52. data/docs/SuccessMessage.md +7 -0
  53. data/docs/Users.md +10 -0
  54. data/docs/ViewerPermissions.md +11 -0
  55. data/docs/Webhook.md +10 -0
  56. data/docs/WebhookApi.md +286 -0
  57. data/docs/WebhookBase.md +10 -0
  58. data/docs/WebhookPathRequest.md +8 -0
  59. data/docs/WebhookWithSecret.md +10 -0
  60. data/git_push.sh +55 -0
  61. data/lib/tca_client/api/eula_api.rb +312 -0
  62. data/lib/tca_client/api/features_api.rb +82 -0
  63. data/lib/tca_client/api/groups_api.rb +627 -0
  64. data/lib/tca_client/api/index_api.rb +156 -0
  65. data/lib/tca_client/api/similarity_api.rb +456 -0
  66. data/lib/tca_client/api/submission_api.rb +387 -0
  67. data/lib/tca_client/api/webhook_api.rb +364 -0
  68. data/lib/tca_client/api_client.rb +388 -0
  69. data/lib/tca_client/api_error.rb +57 -0
  70. data/lib/tca_client/configuration.rb +205 -0
  71. data/lib/tca_client/models/add_group_attachment_request.rb +220 -0
  72. data/lib/tca_client/models/add_group_attachment_response.rb +208 -0
  73. data/lib/tca_client/models/aggregate_group.rb +299 -0
  74. data/lib/tca_client/models/author_metadata_override.rb +217 -0
  75. data/lib/tca_client/models/error.rb +218 -0
  76. data/lib/tca_client/models/eula.rb +228 -0
  77. data/lib/tca_client/models/eula_accept_list_item.rb +237 -0
  78. data/lib/tca_client/models/eula_accept_request.rb +237 -0
  79. data/lib/tca_client/models/eula_version.rb +272 -0
  80. data/lib/tca_client/models/features_enabled.rb +257 -0
  81. data/lib/tca_client/models/features_generation_settings.rb +240 -0
  82. data/lib/tca_client/models/features_similarity.rb +224 -0
  83. data/lib/tca_client/models/features_similarity_view_settings.rb +327 -0
  84. data/lib/tca_client/models/features_tenant.rb +207 -0
  85. data/lib/tca_client/models/features_viewer_modes.rb +215 -0
  86. data/lib/tca_client/models/group.rb +259 -0
  87. data/lib/tca_client/models/group_attachment_response.rb +272 -0
  88. data/lib/tca_client/models/group_context.rb +227 -0
  89. data/lib/tca_client/models/index_state_settings.rb +207 -0
  90. data/lib/tca_client/models/indexing_settings.rb +207 -0
  91. data/lib/tca_client/models/inline_response_200.rb +208 -0
  92. data/lib/tca_client/models/pdf_status_response.rb +241 -0
  93. data/lib/tca_client/models/rate_limit_error.rb +221 -0
  94. data/lib/tca_client/models/request_pdf_response.rb +207 -0
  95. data/lib/tca_client/models/sidebar.rb +241 -0
  96. data/lib/tca_client/models/similarity_generation_settings.rb +280 -0
  97. data/lib/tca_client/models/similarity_metadata.rb +340 -0
  98. data/lib/tca_client/models/similarity_metadata_top_matches.rb +267 -0
  99. data/lib/tca_client/models/similarity_put_request.rb +229 -0
  100. data/lib/tca_client/models/similarity_score_data.rb +245 -0
  101. data/lib/tca_client/models/similarity_settings.rb +259 -0
  102. data/lib/tca_client/models/similarity_settings_modes.rb +217 -0
  103. data/lib/tca_client/models/similarity_settings_view_settings.rb +207 -0
  104. data/lib/tca_client/models/similarity_view_settings.rb +327 -0
  105. data/lib/tca_client/models/similarity_viewer_url_response.rb +207 -0
  106. data/lib/tca_client/models/similarity_viewer_url_settings.rb +306 -0
  107. data/lib/tca_client/models/simple_submission_response.rb +197 -0
  108. data/lib/tca_client/models/submission.rb +197 -0
  109. data/lib/tca_client/models/submission_base.rb +332 -0
  110. data/lib/tca_client/models/submission_base_metadata.rb +256 -0
  111. data/lib/tca_client/models/submission_size_error.rb +221 -0
  112. data/lib/tca_client/models/success_message.rb +208 -0
  113. data/lib/tca_client/models/users.rb +234 -0
  114. data/lib/tca_client/models/viewer_permissions.rb +247 -0
  115. data/lib/tca_client/models/webhook.rb +271 -0
  116. data/lib/tca_client/models/webhook_base.rb +271 -0
  117. data/lib/tca_client/models/webhook_path_request.rb +246 -0
  118. data/lib/tca_client/models/webhook_with_secret.rb +271 -0
  119. data/lib/tca_client/version.rb +14 -0
  120. data/lib/tca_client.rb +93 -0
  121. data/spec/api/eula_api_spec.rb +90 -0
  122. data/spec/api/features_api_spec.rb +46 -0
  123. data/spec/api/groups_api_spec.rb +147 -0
  124. data/spec/api/index_api_spec.rb +60 -0
  125. data/spec/api/similarity_api_spec.rb +116 -0
  126. data/spec/api/submission_api_spec.rb +103 -0
  127. data/spec/api/webhook_api_spec.rb +99 -0
  128. data/spec/api_client_spec.rb +225 -0
  129. data/spec/base_object_spec.rb +109 -0
  130. data/spec/configuration_spec.rb +41 -0
  131. data/spec/models/add_group_attachment_request_spec.rb +46 -0
  132. data/spec/models/add_group_attachment_response_spec.rb +40 -0
  133. data/spec/models/aggregate_group_spec.rb +78 -0
  134. data/spec/models/author_metadata_override_spec.rb +46 -0
  135. data/spec/models/error_spec.rb +46 -0
  136. data/spec/models/eula_accept_list_item_spec.rb +58 -0
  137. data/spec/models/eula_accept_request_spec.rb +58 -0
  138. data/spec/models/eula_spec.rb +52 -0
  139. data/spec/models/eula_version_spec.rb +68 -0
  140. data/spec/models/features_enabled_spec.rb +62 -0
  141. data/spec/models/features_generation_settings_spec.rb +50 -0
  142. data/spec/models/features_similarity_spec.rb +52 -0
  143. data/spec/models/features_similarity_view_settings_spec.rb +112 -0
  144. data/spec/models/features_tenant_spec.rb +40 -0
  145. data/spec/models/features_viewer_modes_spec.rb +46 -0
  146. data/spec/models/group_attachment_response_spec.rb +62 -0
  147. data/spec/models/group_context_spec.rb +52 -0
  148. data/spec/models/group_spec.rb +56 -0
  149. data/spec/models/index_state_settings_spec.rb +40 -0
  150. data/spec/models/indexing_settings_spec.rb +40 -0
  151. data/spec/models/inline_response_200_spec.rb +40 -0
  152. data/spec/models/pdf_status_response_spec.rb +44 -0
  153. data/spec/models/rate_limit_error_spec.rb +46 -0
  154. data/spec/models/request_pdf_response_spec.rb +40 -0
  155. data/spec/models/sidebar_spec.rb +44 -0
  156. data/spec/models/similarity_generation_settings_spec.rb +66 -0
  157. data/spec/models/similarity_metadata_spec.rb +94 -0
  158. data/spec/models/similarity_metadata_top_matches_spec.rb +76 -0
  159. data/spec/models/similarity_put_request_spec.rb +52 -0
  160. data/spec/models/similarity_score_data_spec.rb +58 -0
  161. data/spec/models/similarity_settings_modes_spec.rb +46 -0
  162. data/spec/models/similarity_settings_spec.rb +56 -0
  163. data/spec/models/similarity_settings_view_settings_spec.rb +40 -0
  164. data/spec/models/similarity_view_settings_spec.rb +112 -0
  165. data/spec/models/similarity_viewer_url_response_spec.rb +40 -0
  166. data/spec/models/similarity_viewer_url_settings_spec.rb +86 -0
  167. data/spec/models/simple_submission_response_spec.rb +34 -0
  168. data/spec/models/submission_base_metadata_spec.rb +70 -0
  169. data/spec/models/submission_base_spec.rb +96 -0
  170. data/spec/models/submission_size_error_spec.rb +46 -0
  171. data/spec/models/submission_spec.rb +34 -0
  172. data/spec/models/success_message_spec.rb +40 -0
  173. data/spec/models/users_spec.rb +58 -0
  174. data/spec/models/viewer_permissions_spec.rb +64 -0
  175. data/spec/models/webhook_base_spec.rb +62 -0
  176. data/spec/models/webhook_path_request_spec.rb +50 -0
  177. data/spec/models/webhook_spec.rb +62 -0
  178. data/spec/models/webhook_with_secret_spec.rb +62 -0
  179. data/spec/spec_helper.rb +110 -0
  180. data/tca_client.gemspec +38 -0
  181. metadata +365 -0
@@ -0,0 +1,332 @@
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
+ OpenAPI spec version: 1.0.249
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.35
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module TCAClient
15
+ # 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.
16
+ class SubmissionBase
17
+ # Submission id, optional field
18
+ attr_accessor :id
19
+
20
+ # ID of the owning user
21
+ attr_accessor :owner
22
+
23
+ # Default viewer permission set, accepts INSTRUCTOR, LEARNER, EDITOR, USER, APPLICANT, ADMINISTRATOR, UNDEFINED
24
+ attr_accessor :owner_default_permission_set
25
+
26
+ # the title of the submission
27
+ attr_accessor :title
28
+
29
+ # (optional) ID of the submitting user, if different from the owning user
30
+ attr_accessor :submitter
31
+
32
+ # Default submitter permission set, accepts INSTRUCTOR, LEARNER, EDITOR, USER, APPLICANT, ADMINISTRATOR, UNDEFINED
33
+ attr_accessor :submitter_default_permission_set
34
+
35
+ attr_accessor :eula
36
+
37
+ attr_accessor :metadata
38
+
39
+ # (optional) indicates if the submission should be treated as a text only submission. A text only submission cannot generate full reports or be viewed in the viewer, but can use the index only endpoint to be indexed
40
+ attr_accessor :extract_text_only
41
+
42
+ class EnumAttributeValidator
43
+ attr_reader :datatype
44
+ attr_reader :allowable_values
45
+
46
+ def initialize(datatype, allowable_values)
47
+ @allowable_values = allowable_values.map do |value|
48
+ case datatype.to_s
49
+ when /Integer/i
50
+ value.to_i
51
+ when /Float/i
52
+ value.to_f
53
+ else
54
+ value
55
+ end
56
+ end
57
+ end
58
+
59
+ def valid?(value)
60
+ !value || allowable_values.include?(value)
61
+ end
62
+ end
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ :'id' => :'id',
68
+ :'owner' => :'owner',
69
+ :'owner_default_permission_set' => :'owner_default_permission_set',
70
+ :'title' => :'title',
71
+ :'submitter' => :'submitter',
72
+ :'submitter_default_permission_set' => :'submitter_default_permission_set',
73
+ :'eula' => :'eula',
74
+ :'metadata' => :'metadata',
75
+ :'extract_text_only' => :'extract_text_only'
76
+ }
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.openapi_types
81
+ {
82
+ :'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'
91
+ }
92
+ end
93
+
94
+ # List of attributes with nullable: true
95
+ def self.openapi_nullable
96
+ Set.new([
97
+ ])
98
+ end
99
+
100
+ # Initializes the object
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ def initialize(attributes = {})
103
+ if (!attributes.is_a?(Hash))
104
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TCAClient::SubmissionBase` initialize method"
105
+ end
106
+
107
+ # check to see if the attribute exists and convert string to symbol for hash key
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ if (!self.class.attribute_map.key?(k.to_sym))
110
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TCAClient::SubmissionBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
111
+ end
112
+ h[k.to_sym] = v
113
+ }
114
+
115
+ if attributes.key?(:'id')
116
+ self.id = attributes[:'id']
117
+ end
118
+
119
+ if attributes.key?(:'owner')
120
+ self.owner = attributes[:'owner']
121
+ end
122
+
123
+ if attributes.key?(:'owner_default_permission_set')
124
+ self.owner_default_permission_set = attributes[:'owner_default_permission_set']
125
+ end
126
+
127
+ if attributes.key?(:'title')
128
+ self.title = attributes[:'title']
129
+ end
130
+
131
+ if attributes.key?(:'submitter')
132
+ self.submitter = attributes[:'submitter']
133
+ end
134
+
135
+ if attributes.key?(:'submitter_default_permission_set')
136
+ self.submitter_default_permission_set = attributes[:'submitter_default_permission_set']
137
+ end
138
+
139
+ if attributes.key?(:'eula')
140
+ self.eula = attributes[:'eula']
141
+ end
142
+
143
+ if attributes.key?(:'metadata')
144
+ self.metadata = attributes[:'metadata']
145
+ end
146
+
147
+ if attributes.key?(:'extract_text_only')
148
+ self.extract_text_only = attributes[:'extract_text_only']
149
+ end
150
+ end
151
+
152
+ # Show invalid properties with the reasons. Usually used together with valid?
153
+ # @return Array for valid properties with the reasons
154
+ def list_invalid_properties
155
+ invalid_properties = Array.new
156
+ invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ owner_default_permission_set_validator = EnumAttributeValidator.new('Object', ['INSTRUCTOR', 'LEARNER', 'EDITOR', 'USER', 'APPLICANT', 'ADMINISTRATOR', 'UNDEFINED'])
163
+ 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'])
165
+ return false unless submitter_default_permission_set_validator.valid?(@submitter_default_permission_set)
166
+ true
167
+ end
168
+
169
+ # Custom attribute writer method checking allowed values (enum).
170
+ # @param [Object] owner_default_permission_set Object to be assigned
171
+ def owner_default_permission_set=(owner_default_permission_set)
172
+ validator = EnumAttributeValidator.new('Object', ['INSTRUCTOR', 'LEARNER', 'EDITOR', 'USER', 'APPLICANT', 'ADMINISTRATOR', 'UNDEFINED'])
173
+ unless validator.valid?(owner_default_permission_set)
174
+ fail ArgumentError, "invalid value for \"owner_default_permission_set\", must be one of #{validator.allowable_values}."
175
+ end
176
+ @owner_default_permission_set = owner_default_permission_set
177
+ end
178
+
179
+ # Custom attribute writer method checking allowed values (enum).
180
+ # @param [Object] submitter_default_permission_set Object to be assigned
181
+ def submitter_default_permission_set=(submitter_default_permission_set)
182
+ validator = EnumAttributeValidator.new('Object', ['INSTRUCTOR', 'LEARNER', 'EDITOR', 'USER', 'APPLICANT', 'ADMINISTRATOR', 'UNDEFINED'])
183
+ unless validator.valid?(submitter_default_permission_set)
184
+ fail ArgumentError, "invalid value for \"submitter_default_permission_set\", must be one of #{validator.allowable_values}."
185
+ end
186
+ @submitter_default_permission_set = submitter_default_permission_set
187
+ end
188
+
189
+ # Checks equality by comparing each attribute.
190
+ # @param [Object] Object to be compared
191
+ def ==(o)
192
+ return true if self.equal?(o)
193
+ self.class == o.class &&
194
+ id == o.id &&
195
+ owner == o.owner &&
196
+ owner_default_permission_set == o.owner_default_permission_set &&
197
+ title == o.title &&
198
+ submitter == o.submitter &&
199
+ submitter_default_permission_set == o.submitter_default_permission_set &&
200
+ eula == o.eula &&
201
+ metadata == o.metadata &&
202
+ extract_text_only == o.extract_text_only
203
+ end
204
+
205
+ # @see the `==` method
206
+ # @param [Object] Object to be compared
207
+ def eql?(o)
208
+ self == o
209
+ end
210
+
211
+ # Calculates hash code according to all attributes.
212
+ # @return [Integer] Hash code
213
+ def hash
214
+ [id, owner, owner_default_permission_set, title, submitter, submitter_default_permission_set, eula, metadata, extract_text_only].hash
215
+ end
216
+
217
+ # Builds the object from hash
218
+ # @param [Hash] attributes Model attributes in the form of hash
219
+ # @return [Object] Returns the model itself
220
+ def self.build_from_hash(attributes)
221
+ new.build_from_hash(attributes)
222
+ end
223
+
224
+ # Builds the object from hash
225
+ # @param [Hash] attributes Model attributes in the form of hash
226
+ # @return [Object] Returns the model itself
227
+ def build_from_hash(attributes)
228
+ return nil unless attributes.is_a?(Hash)
229
+ self.class.openapi_types.each_pair do |key, type|
230
+ if type =~ /\AArray<(.*)>/i
231
+ # check to ensure the input is an array given that the attribute
232
+ # is documented as an array but the input is not
233
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
234
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
235
+ end
236
+ elsif !attributes[self.class.attribute_map[key]].nil?
237
+ 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
+ end
241
+ end
242
+
243
+ self
244
+ end
245
+
246
+ # Deserializes the data based on type
247
+ # @param string type Data type
248
+ # @param string value Value to be deserialized
249
+ # @return [Object] Deserialized data
250
+ def _deserialize(type, value)
251
+ case type.to_sym
252
+ when :DateTime
253
+ DateTime.parse(value)
254
+ when :Date
255
+ Date.parse(value)
256
+ when :String
257
+ value.to_s
258
+ when :Integer
259
+ value.to_i
260
+ when :Float
261
+ value.to_f
262
+ when :Boolean
263
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
264
+ true
265
+ else
266
+ false
267
+ end
268
+ when :Object
269
+ # generic object (usually a Hash), return directly
270
+ value
271
+ when /\AArray<(?<inner_type>.+)>\z/
272
+ inner_type = Regexp.last_match[:inner_type]
273
+ value.map { |v| _deserialize(inner_type, v) }
274
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
275
+ k_type = Regexp.last_match[:k_type]
276
+ v_type = Regexp.last_match[:v_type]
277
+ {}.tap do |hash|
278
+ value.each do |k, v|
279
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
280
+ end
281
+ end
282
+ else # model
283
+ TCAClient.const_get(type).build_from_hash(value)
284
+ end
285
+ end
286
+
287
+ # Returns the string representation of the object
288
+ # @return [String] String presentation of the object
289
+ def to_s
290
+ to_hash.to_s
291
+ end
292
+
293
+ # to_body is an alias to to_hash (backward compatibility)
294
+ # @return [Hash] Returns the object in the form of hash
295
+ def to_body
296
+ to_hash
297
+ end
298
+
299
+ # Returns the object in the form of hash
300
+ # @return [Hash] Returns the object in the form of hash
301
+ def to_hash
302
+ hash = {}
303
+ self.class.attribute_map.each_pair do |attr, param|
304
+ value = self.send(attr)
305
+ if value.nil?
306
+ is_nullable = self.class.openapi_nullable.include?(attr)
307
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
308
+ end
309
+
310
+ hash[param] = _to_hash(value)
311
+ end
312
+ hash
313
+ end
314
+
315
+ # Outputs non-array value in the form of hash
316
+ # For object, use to_hash. Otherwise, just return the value
317
+ # @param [Object] value Any valid value
318
+ # @return [Hash] Returns the value in the form of hash
319
+ def _to_hash(value)
320
+ if value.is_a?(Array)
321
+ value.compact.map { |v| _to_hash(v) }
322
+ elsif value.is_a?(Hash)
323
+ {}.tap do |hash|
324
+ value.each { |k, v| hash[k] = _to_hash(v) }
325
+ end
326
+ elsif value.respond_to? :to_hash
327
+ value.to_hash
328
+ else
329
+ value
330
+ end
331
+ end end
332
+ end
@@ -0,0 +1,256 @@
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
+ OpenAPI spec version: 1.0.249
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.35
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module TCAClient
15
+ # (optional) Submission metadata. If a group context is included, it must be associated to a group
16
+ class SubmissionBaseMetadata
17
+ attr_accessor :submitter
18
+
19
+ attr_accessor :owners
20
+
21
+ attr_accessor :group
22
+
23
+ attr_accessor :group_context
24
+
25
+ # Optional original submision date
26
+ attr_accessor :original_submitted_time
27
+
28
+ # custom metadata
29
+ attr_accessor :custom
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'submitter' => :'submitter',
35
+ :'owners' => :'owners',
36
+ :'group' => :'group',
37
+ :'group_context' => :'group_context',
38
+ :'original_submitted_time' => :'original_submitted_time',
39
+ :'custom' => :'custom'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'submitter' => :'Object',
47
+ :'owners' => :'Object',
48
+ :'group' => :'Object',
49
+ :'group_context' => :'Object',
50
+ :'original_submitted_time' => :'Object',
51
+ :'custom' => :'Object'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TCAClient::SubmissionBaseMetadata` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TCAClient::SubmissionBaseMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'submitter')
77
+ self.submitter = attributes[:'submitter']
78
+ end
79
+
80
+ if attributes.key?(:'owners')
81
+ if (value = attributes[:'owners']).is_a?(Array)
82
+ self.owners = value
83
+ end
84
+ end
85
+
86
+ if attributes.key?(:'group')
87
+ self.group = attributes[:'group']
88
+ end
89
+
90
+ if attributes.key?(:'group_context')
91
+ self.group_context = attributes[:'group_context']
92
+ end
93
+
94
+ if attributes.key?(:'original_submitted_time')
95
+ self.original_submitted_time = attributes[:'original_submitted_time']
96
+ end
97
+
98
+ if attributes.key?(:'custom')
99
+ self.custom = attributes[:'custom']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ true
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(o)
119
+ return true if self.equal?(o)
120
+ self.class == o.class &&
121
+ submitter == o.submitter &&
122
+ owners == o.owners &&
123
+ group == o.group &&
124
+ group_context == o.group_context &&
125
+ original_submitted_time == o.original_submitted_time &&
126
+ custom == o.custom
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(o)
132
+ self == o
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Integer] Hash code
137
+ def hash
138
+ [submitter, owners, group, group_context, original_submitted_time, custom].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def self.build_from_hash(attributes)
145
+ new.build_from_hash(attributes)
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ self.class.openapi_types.each_pair do |key, type|
154
+ if type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
158
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
159
+ end
160
+ elsif !attributes[self.class.attribute_map[key]].nil?
161
+ 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
+ end
165
+ end
166
+
167
+ self
168
+ end
169
+
170
+ # Deserializes the data based on type
171
+ # @param string type Data type
172
+ # @param string value Value to be deserialized
173
+ # @return [Object] Deserialized data
174
+ def _deserialize(type, value)
175
+ case type.to_sym
176
+ when :DateTime
177
+ DateTime.parse(value)
178
+ when :Date
179
+ Date.parse(value)
180
+ when :String
181
+ value.to_s
182
+ when :Integer
183
+ value.to_i
184
+ when :Float
185
+ value.to_f
186
+ when :Boolean
187
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
+ true
189
+ else
190
+ false
191
+ end
192
+ when :Object
193
+ # generic object (usually a Hash), return directly
194
+ value
195
+ when /\AArray<(?<inner_type>.+)>\z/
196
+ inner_type = Regexp.last_match[:inner_type]
197
+ value.map { |v| _deserialize(inner_type, v) }
198
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
+ k_type = Regexp.last_match[:k_type]
200
+ v_type = Regexp.last_match[:v_type]
201
+ {}.tap do |hash|
202
+ value.each do |k, v|
203
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
+ end
205
+ end
206
+ else # model
207
+ TCAClient.const_get(type).build_from_hash(value)
208
+ end
209
+ end
210
+
211
+ # Returns the string representation of the object
212
+ # @return [String] String presentation of the object
213
+ def to_s
214
+ to_hash.to_s
215
+ end
216
+
217
+ # to_body is an alias to to_hash (backward compatibility)
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_body
220
+ to_hash
221
+ end
222
+
223
+ # Returns the object in the form of hash
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_hash
226
+ hash = {}
227
+ self.class.attribute_map.each_pair do |attr, param|
228
+ value = self.send(attr)
229
+ if value.nil?
230
+ is_nullable = self.class.openapi_nullable.include?(attr)
231
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
232
+ end
233
+
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end end
256
+ end