tca_client 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/docs/AddGroupAttachmentRequest.md +16 -4
  4. data/docs/AddGroupAttachmentResponse.md +14 -3
  5. data/docs/AggregateGroup.md +24 -8
  6. data/docs/AnnotationsSettings.md +18 -0
  7. data/docs/AuthorMetadataOverride.md +16 -4
  8. data/docs/EULAApi.md +166 -92
  9. data/docs/Error.md +16 -4
  10. data/docs/Eula.md +18 -5
  11. data/docs/EulaAcceptListItem.md +20 -6
  12. data/docs/EulaAcceptRequest.md +20 -6
  13. data/docs/EulaVersion.md +22 -7
  14. data/docs/FeaturesApi.md +41 -23
  15. data/docs/FeaturesEnabled.md +20 -6
  16. data/docs/FeaturesGenerationSettings.md +16 -4
  17. data/docs/FeaturesSimilarity.md +18 -5
  18. data/docs/FeaturesSimilarityViewSettings.md +38 -15
  19. data/docs/FeaturesTenant.md +14 -3
  20. data/docs/FeaturesViewerModes.md +16 -4
  21. data/docs/GenerateSimilarityPDF.md +18 -0
  22. data/docs/GetGroupAttachments200Response.md +18 -0
  23. data/docs/Group.md +18 -5
  24. data/docs/GroupAttachmentResponse.md +20 -6
  25. data/docs/GroupContext.md +18 -5
  26. data/docs/GroupsApi.md +321 -177
  27. data/docs/IndexApi.md +84 -44
  28. data/docs/IndexStateSettings.md +14 -3
  29. data/docs/IndexingSettings.md +14 -3
  30. data/docs/PDFStatusWebhookRequest.md +24 -0
  31. data/docs/PdfStatusResponse.md +14 -3
  32. data/docs/RateLimitError.md +16 -4
  33. data/docs/RequestPdfResponse.md +14 -3
  34. data/docs/Sidebar.md +14 -3
  35. data/docs/SimilarityApi.md +239 -129
  36. data/docs/SimilarityCompleteWebhookRequest.md +38 -0
  37. data/docs/SimilarityGenerationSettings.md +20 -6
  38. data/docs/SimilarityMetadata.md +32 -12
  39. data/docs/SimilarityMetadataAllOf.md +28 -0
  40. data/docs/SimilarityMetadataAllOfTopMatches.md +30 -0
  41. data/docs/SimilarityPutRequest.md +18 -5
  42. data/docs/SimilarityScoreData.md +20 -6
  43. data/docs/SimilaritySettings.md +18 -5
  44. data/docs/SimilaritySettingsModes.md +16 -4
  45. data/docs/SimilaritySettingsViewSettings.md +14 -3
  46. data/docs/SimilarityViewSettings.md +38 -15
  47. data/docs/SimilarityViewerUrlResponse.md +14 -3
  48. data/docs/SimilarityViewerUrlSettings.md +30 -10
  49. data/docs/SimpleSubmissionResponse.md +22 -2
  50. data/docs/SimpleSubmissionResponseAllOf.md +26 -0
  51. data/docs/Submission.md +34 -2
  52. data/docs/SubmissionAllOf.md +38 -0
  53. data/docs/SubmissionApi.md +203 -112
  54. data/docs/SubmissionBase.md +30 -11
  55. data/docs/SubmissionBaseMetadata.md +24 -8
  56. data/docs/SubmissionCompleteWebhookRequest.md +40 -0
  57. data/docs/SubmissionCompleteWebhookRequestAllOf.md +18 -0
  58. data/docs/SubmissionCompleteWebhookRequestAllOfMetadata.md +18 -0
  59. data/docs/SubmissionSizeError.md +16 -4
  60. data/docs/SuccessMessage.md +14 -3
  61. data/docs/Users.md +20 -6
  62. data/docs/ViewerPermissions.md +22 -7
  63. data/docs/Webhook.md +24 -6
  64. data/docs/WebhookAllOf.md +20 -0
  65. data/docs/WebhookApi.md +193 -103
  66. data/docs/WebhookBase.md +20 -6
  67. data/docs/WebhookPathRequest.md +16 -4
  68. data/docs/WebhookWithSecret.md +22 -6
  69. data/docs/WebhookWithSecretAllOf.md +18 -0
  70. data/lib/tca_client/api/eula_api.rb +96 -63
  71. data/lib/tca_client/api/features_api.rb +21 -12
  72. data/lib/tca_client/api/groups_api.rb +225 -155
  73. data/lib/tca_client/api/index_api.rb +46 -27
  74. data/lib/tca_client/api/similarity_api.rb +165 -104
  75. data/lib/tca_client/api/submission_api.rb +140 -97
  76. data/lib/tca_client/api/webhook_api.rb +120 -77
  77. data/lib/tca_client/api_client.rb +61 -57
  78. data/lib/tca_client/api_error.rb +4 -4
  79. data/lib/tca_client/configuration.rb +93 -13
  80. data/lib/tca_client/models/add_group_attachment_request.rb +50 -13
  81. data/lib/tca_client/models/add_group_attachment_response.rb +25 -12
  82. data/lib/tca_client/models/aggregate_group.rb +34 -21
  83. data/lib/tca_client/models/annotations_settings.rb +220 -0
  84. data/lib/tca_client/models/author_metadata_override.rb +26 -13
  85. data/lib/tca_client/models/error.rb +26 -13
  86. data/lib/tca_client/models/eula.rb +27 -14
  87. data/lib/tca_client/models/eula_accept_list_item.rb +28 -15
  88. data/lib/tca_client/models/eula_accept_request.rb +28 -15
  89. data/lib/tca_client/models/eula_version.rb +29 -16
  90. data/lib/tca_client/models/features_enabled.rb +28 -15
  91. data/lib/tca_client/models/features_generation_settings.rb +26 -13
  92. data/lib/tca_client/models/features_similarity.rb +27 -14
  93. data/lib/tca_client/models/features_similarity_view_settings.rb +37 -24
  94. data/lib/tca_client/models/features_tenant.rb +25 -12
  95. data/lib/tca_client/models/features_viewer_modes.rb +26 -13
  96. data/lib/tca_client/models/generate_similarity_pdf.rb +254 -0
  97. data/lib/tca_client/models/{inline_response_200.rb → get_group_attachments200_response.rb} +28 -15
  98. data/lib/tca_client/models/group.rb +29 -16
  99. data/lib/tca_client/models/group_attachment_response.rb +38 -17
  100. data/lib/tca_client/models/group_context.rb +27 -14
  101. data/lib/tca_client/models/index_state_settings.rb +25 -12
  102. data/lib/tca_client/models/indexing_settings.rb +25 -12
  103. data/lib/tca_client/models/pdf_status_response.rb +27 -14
  104. data/lib/tca_client/models/pdf_status_webhook_request.rb +283 -0
  105. data/lib/tca_client/models/rate_limit_error.rb +36 -20
  106. data/lib/tca_client/models/request_pdf_response.rb +25 -12
  107. data/lib/tca_client/models/sidebar.rb +27 -14
  108. data/lib/tca_client/models/similarity_complete_webhook_request.rb +366 -0
  109. data/lib/tca_client/models/similarity_generation_settings.rb +30 -17
  110. data/lib/tca_client/models/similarity_metadata.rb +45 -28
  111. data/lib/tca_client/models/similarity_metadata_all_of.rb +301 -0
  112. data/lib/tca_client/models/{similarity_metadata_top_matches.rb → similarity_metadata_all_of_top_matches.rb} +34 -21
  113. data/lib/tca_client/models/similarity_put_request.rb +27 -14
  114. data/lib/tca_client/models/similarity_score_data.rb +28 -15
  115. data/lib/tca_client/models/similarity_settings.rb +29 -16
  116. data/lib/tca_client/models/similarity_settings_modes.rb +26 -13
  117. data/lib/tca_client/models/similarity_settings_view_settings.rb +25 -12
  118. data/lib/tca_client/models/similarity_view_settings.rb +37 -24
  119. data/lib/tca_client/models/similarity_viewer_url_response.rb +25 -12
  120. data/lib/tca_client/models/similarity_viewer_url_settings.rb +46 -24
  121. data/lib/tca_client/models/simple_submission_response.rb +117 -13
  122. data/lib/tca_client/models/simple_submission_response_all_of.rb +294 -0
  123. data/lib/tca_client/models/submission.rb +191 -13
  124. data/lib/tca_client/models/submission_all_of.rb +368 -0
  125. data/lib/tca_client/models/submission_base.rb +82 -23
  126. data/lib/tca_client/models/submission_base_metadata.rb +30 -17
  127. data/lib/tca_client/models/submission_complete_webhook_request.rb +385 -0
  128. data/lib/tca_client/models/submission_complete_webhook_request_all_of.rb +219 -0
  129. data/lib/tca_client/models/submission_complete_webhook_request_all_of_metadata.rb +219 -0
  130. data/lib/tca_client/models/submission_size_error.rb +36 -20
  131. data/lib/tca_client/models/success_message.rb +25 -12
  132. data/lib/tca_client/models/users.rb +28 -15
  133. data/lib/tca_client/models/viewer_permissions.rb +29 -16
  134. data/lib/tca_client/models/webhook.rb +62 -16
  135. data/lib/tca_client/models/webhook_all_of.rb +235 -0
  136. data/lib/tca_client/models/webhook_base.rb +28 -15
  137. data/lib/tca_client/models/webhook_path_request.rb +26 -13
  138. data/lib/tca_client/models/webhook_with_secret.rb +52 -16
  139. data/lib/tca_client/models/webhook_with_secret_all_of.rb +225 -0
  140. data/lib/tca_client/version.rb +5 -4
  141. data/lib/tca_client.rb +18 -5
  142. data/spec/api/submission_api_spec.rb +2 -2
  143. data/tca_client-1.0.0.gem +0 -0
  144. data/tca_client-1.0.1.gem +0 -0
  145. data/tca_client.gemspec +7 -7
  146. metadata +44 -38
  147. data/docs/InlineResponse200.md +0 -7
  148. data/docs/SimilarityMetadataTopMatches.md +0 -13
@@ -0,0 +1,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
@@ -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