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,25 +3,109 @@
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 Submission
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
+
16
73
  # Attribute mapping from ruby-style variable name to JSON key.
17
74
  def self.attribute_map
18
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'
19
87
  }
20
88
  end
21
89
 
90
+ # Returns all the JSON keys this model knows about
91
+ def self.acceptable_attributes
92
+ attribute_map.values
93
+ end
94
+
22
95
  # Attribute type mapping.
23
96
  def self.openapi_types
24
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>'
25
109
  }
26
110
  end
27
111
 
@@ -30,7 +114,14 @@ module TCAClient
30
114
  Set.new([
31
115
  ])
32
116
  end
33
-
117
+
118
+ # List of class defined in allOf (OpenAPI v3)
119
+ def self.openapi_all_of
120
+ [
121
+ :'SubmissionAllOf'
122
+ ]
123
+ end
124
+
34
125
  # Initializes the object
35
126
  # @param [Hash] attributes Model attributes in the form of hash
36
127
  def initialize(attributes = {})
@@ -45,6 +136,52 @@ module TCAClient
45
136
  end
46
137
  h[k.to_sym] = v
47
138
  }
139
+
140
+ if attributes.key?(:'owner')
141
+ self.owner = attributes[:'owner']
142
+ end
143
+
144
+ if attributes.key?(:'title')
145
+ self.title = attributes[:'title']
146
+ end
147
+
148
+ if attributes.key?(:'status')
149
+ self.status = attributes[:'status']
150
+ end
151
+
152
+ if attributes.key?(:'id')
153
+ self.id = attributes[:'id']
154
+ end
155
+
156
+ if attributes.key?(:'content_type')
157
+ self.content_type = attributes[:'content_type']
158
+ end
159
+
160
+ if attributes.key?(:'page_count')
161
+ self.page_count = attributes[:'page_count']
162
+ end
163
+
164
+ if attributes.key?(:'word_count')
165
+ self.word_count = attributes[:'word_count']
166
+ end
167
+
168
+ if attributes.key?(:'character_count')
169
+ self.character_count = attributes[:'character_count']
170
+ end
171
+
172
+ if attributes.key?(:'error_code')
173
+ self.error_code = attributes[:'error_code']
174
+ end
175
+
176
+ if attributes.key?(:'created_time')
177
+ self.created_time = attributes[:'created_time']
178
+ end
179
+
180
+ if attributes.key?(:'capabilities')
181
+ if (value = attributes[:'capabilities']).is_a?(Array)
182
+ self.capabilities = value
183
+ end
184
+ end
48
185
  end
49
186
 
50
187
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -57,14 +194,49 @@ module TCAClient
57
194
  # Check to see if the all the properties in the model are valid
58
195
  # @return true if the model is valid
59
196
  def valid?
197
+ status_validator = EnumAttributeValidator.new('String', ["CREATED", "PROCESSING", "COMPLETE", "DELETED", "ERROR"])
198
+ return false unless status_validator.valid?(@status)
199
+ 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"])
200
+ return false unless error_code_validator.valid?(@error_code)
60
201
  true
61
202
  end
62
203
 
204
+ # Custom attribute writer method checking allowed values (enum).
205
+ # @param [Object] status Object to be assigned
206
+ def status=(status)
207
+ validator = EnumAttributeValidator.new('String', ["CREATED", "PROCESSING", "COMPLETE", "DELETED", "ERROR"])
208
+ unless validator.valid?(status)
209
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
210
+ end
211
+ @status = status
212
+ end
213
+
214
+ # Custom attribute writer method checking allowed values (enum).
215
+ # @param [Object] error_code Object to be assigned
216
+ def error_code=(error_code)
217
+ validator = EnumAttributeValidator.new('String', ["UNSUPPORTED_FILETYPE", "PROCESSING_ERROR", "CANNOT_EXTRACT_TEXT", "TOO_LITTLE_TEXT", "TOO_MUCH_TEXT", "TOO_MANY_PAGES", "FILE_LOCKED", "CORRUPT_FILE"])
218
+ unless validator.valid?(error_code)
219
+ fail ArgumentError, "invalid value for \"error_code\", must be one of #{validator.allowable_values}."
220
+ end
221
+ @error_code = error_code
222
+ end
223
+
63
224
  # Checks equality by comparing each attribute.
64
225
  # @param [Object] Object to be compared
65
226
  def ==(o)
66
227
  return true if self.equal?(o)
67
- self.class == o.class
228
+ self.class == o.class &&
229
+ owner == o.owner &&
230
+ title == o.title &&
231
+ status == o.status &&
232
+ id == o.id &&
233
+ content_type == o.content_type &&
234
+ page_count == o.page_count &&
235
+ word_count == o.word_count &&
236
+ character_count == o.character_count &&
237
+ error_code == o.error_code &&
238
+ created_time == o.created_time &&
239
+ capabilities == o.capabilities
68
240
  end
69
241
 
70
242
  # @see the `==` method
@@ -76,7 +248,7 @@ module TCAClient
76
248
  # Calculates hash code according to all attributes.
77
249
  # @return [Integer] Hash code
78
250
  def hash
79
- [].hash
251
+ [owner, title, status, id, content_type, page_count, word_count, character_count, error_code, created_time, capabilities].hash
80
252
  end
81
253
 
82
254
  # Builds the object from hash
@@ -91,8 +263,11 @@ module TCAClient
91
263
  # @return [Object] Returns the model itself
92
264
  def build_from_hash(attributes)
93
265
  return nil unless attributes.is_a?(Hash)
266
+ attributes = attributes.transform_keys(&:to_sym)
94
267
  self.class.openapi_types.each_pair do |key, type|
95
- if type =~ /\AArray<(.*)>/i
268
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
269
+ self.send("#{key}=", nil)
270
+ elsif type =~ /\AArray<(.*)>/i
96
271
  # check to ensure the input is an array given that the attribute
97
272
  # is documented as an array but the input is not
98
273
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -100,8 +275,6 @@ module TCAClient
100
275
  end
101
276
  elsif !attributes[self.class.attribute_map[key]].nil?
102
277
  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
278
  end
106
279
  end
107
280
 
@@ -114,8 +287,8 @@ module TCAClient
114
287
  # @return [Object] Deserialized data
115
288
  def _deserialize(type, value)
116
289
  case type.to_sym
117
- when :DateTime
118
- DateTime.parse(value)
290
+ when :Time
291
+ Time.parse(value)
119
292
  when :Date
120
293
  Date.parse(value)
121
294
  when :String
@@ -145,7 +318,9 @@ module TCAClient
145
318
  end
146
319
  end
147
320
  else # model
148
- TCAClient.const_get(type).build_from_hash(value)
321
+ # models (e.g. Pet) or oneOf
322
+ klass = TCAClient.const_get(type)
323
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
149
324
  end
150
325
  end
151
326
 
@@ -193,5 +368,8 @@ module TCAClient
193
368
  else
194
369
  value
195
370
  end
196
- end end
371
+ end
372
+
373
+ end
374
+
197
375
  end
@@ -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