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.
- checksums.yaml +4 -4
- data/docs/AddGroupAttachmentRequest.md +16 -4
- data/docs/AddGroupAttachmentResponse.md +14 -3
- data/docs/AggregateGroup.md +24 -8
- data/docs/AnnotationsSettings.md +18 -0
- data/docs/AuthorMetadataOverride.md +16 -4
- data/docs/EULAApi.md +166 -92
- data/docs/Error.md +16 -4
- data/docs/Eula.md +18 -5
- data/docs/EulaAcceptListItem.md +20 -6
- data/docs/EulaAcceptRequest.md +20 -6
- data/docs/EulaVersion.md +22 -7
- data/docs/FeaturesApi.md +41 -23
- data/docs/FeaturesEnabled.md +20 -6
- data/docs/FeaturesGenerationSettings.md +16 -4
- data/docs/FeaturesSimilarity.md +18 -5
- data/docs/FeaturesSimilarityViewSettings.md +38 -15
- data/docs/FeaturesTenant.md +14 -3
- data/docs/FeaturesViewerModes.md +16 -4
- data/docs/GenerateSimilarityPDF.md +18 -0
- data/docs/GetGroupAttachments200Response.md +18 -0
- data/docs/Group.md +18 -5
- data/docs/GroupAttachmentResponse.md +20 -6
- data/docs/GroupContext.md +18 -5
- data/docs/GroupsApi.md +321 -177
- data/docs/IndexApi.md +84 -44
- data/docs/IndexStateSettings.md +14 -3
- data/docs/IndexingSettings.md +14 -3
- data/docs/PDFStatusWebhookRequest.md +24 -0
- data/docs/PdfStatusResponse.md +14 -3
- data/docs/RateLimitError.md +16 -4
- data/docs/RequestPdfResponse.md +14 -3
- data/docs/Sidebar.md +14 -3
- data/docs/SimilarityApi.md +239 -129
- data/docs/SimilarityCompleteWebhookRequest.md +38 -0
- data/docs/SimilarityGenerationSettings.md +20 -6
- data/docs/SimilarityMetadata.md +32 -12
- data/docs/SimilarityMetadataAllOf.md +28 -0
- data/docs/SimilarityMetadataAllOfTopMatches.md +30 -0
- data/docs/SimilarityPutRequest.md +18 -5
- data/docs/SimilarityScoreData.md +20 -6
- data/docs/SimilaritySettings.md +18 -5
- data/docs/SimilaritySettingsModes.md +16 -4
- data/docs/SimilaritySettingsViewSettings.md +14 -3
- data/docs/SimilarityViewSettings.md +38 -15
- data/docs/SimilarityViewerUrlResponse.md +14 -3
- data/docs/SimilarityViewerUrlSettings.md +30 -10
- data/docs/SimpleSubmissionResponse.md +22 -2
- data/docs/SimpleSubmissionResponseAllOf.md +26 -0
- data/docs/Submission.md +34 -2
- data/docs/SubmissionAllOf.md +38 -0
- data/docs/SubmissionApi.md +202 -111
- data/docs/SubmissionBase.md +30 -11
- data/docs/SubmissionBaseMetadata.md +24 -8
- data/docs/SubmissionCompleteWebhookRequest.md +40 -0
- data/docs/SubmissionCompleteWebhookRequestAllOf.md +18 -0
- data/docs/SubmissionCompleteWebhookRequestAllOfMetadata.md +18 -0
- data/docs/SubmissionSizeError.md +16 -4
- data/docs/SuccessMessage.md +14 -3
- data/docs/Users.md +20 -6
- data/docs/ViewerPermissions.md +22 -7
- data/docs/Webhook.md +24 -6
- data/docs/WebhookAllOf.md +20 -0
- data/docs/WebhookApi.md +193 -103
- data/docs/WebhookBase.md +20 -6
- data/docs/WebhookPathRequest.md +16 -4
- data/docs/WebhookWithSecret.md +22 -6
- data/docs/WebhookWithSecretAllOf.md +18 -0
- data/lib/tca_client/api/eula_api.rb +96 -63
- data/lib/tca_client/api/features_api.rb +21 -12
- data/lib/tca_client/api/groups_api.rb +225 -155
- data/lib/tca_client/api/index_api.rb +46 -27
- data/lib/tca_client/api/similarity_api.rb +165 -104
- data/lib/tca_client/api/submission_api.rb +132 -89
- data/lib/tca_client/api/webhook_api.rb +120 -77
- data/lib/tca_client/api_client.rb +61 -57
- data/lib/tca_client/api_error.rb +4 -4
- data/lib/tca_client/configuration.rb +93 -13
- data/lib/tca_client/models/add_group_attachment_request.rb +50 -13
- data/lib/tca_client/models/add_group_attachment_response.rb +25 -12
- data/lib/tca_client/models/aggregate_group.rb +34 -21
- data/lib/tca_client/models/annotations_settings.rb +220 -0
- data/lib/tca_client/models/author_metadata_override.rb +26 -13
- data/lib/tca_client/models/error.rb +26 -13
- data/lib/tca_client/models/eula.rb +27 -14
- data/lib/tca_client/models/eula_accept_list_item.rb +28 -15
- data/lib/tca_client/models/eula_accept_request.rb +28 -15
- data/lib/tca_client/models/eula_version.rb +29 -16
- data/lib/tca_client/models/features_enabled.rb +28 -15
- data/lib/tca_client/models/features_generation_settings.rb +26 -13
- data/lib/tca_client/models/features_similarity.rb +27 -14
- data/lib/tca_client/models/features_similarity_view_settings.rb +37 -24
- data/lib/tca_client/models/features_tenant.rb +25 -12
- data/lib/tca_client/models/features_viewer_modes.rb +26 -13
- data/lib/tca_client/models/generate_similarity_pdf.rb +254 -0
- data/lib/tca_client/models/{inline_response_200.rb → get_group_attachments200_response.rb} +28 -15
- data/lib/tca_client/models/group.rb +29 -16
- data/lib/tca_client/models/group_attachment_response.rb +30 -17
- data/lib/tca_client/models/group_context.rb +27 -14
- data/lib/tca_client/models/index_state_settings.rb +25 -12
- data/lib/tca_client/models/indexing_settings.rb +25 -12
- data/lib/tca_client/models/pdf_status_response.rb +27 -14
- data/lib/tca_client/models/pdf_status_webhook_request.rb +283 -0
- data/lib/tca_client/models/rate_limit_error.rb +36 -20
- data/lib/tca_client/models/request_pdf_response.rb +25 -12
- data/lib/tca_client/models/sidebar.rb +27 -14
- data/lib/tca_client/models/similarity_complete_webhook_request.rb +366 -0
- data/lib/tca_client/models/similarity_generation_settings.rb +30 -17
- data/lib/tca_client/models/similarity_metadata.rb +45 -28
- data/lib/tca_client/models/similarity_metadata_all_of.rb +301 -0
- data/lib/tca_client/models/{similarity_metadata_top_matches.rb → similarity_metadata_all_of_top_matches.rb} +34 -21
- data/lib/tca_client/models/similarity_put_request.rb +27 -14
- data/lib/tca_client/models/similarity_score_data.rb +28 -15
- data/lib/tca_client/models/similarity_settings.rb +29 -16
- data/lib/tca_client/models/similarity_settings_modes.rb +26 -13
- data/lib/tca_client/models/similarity_settings_view_settings.rb +25 -12
- data/lib/tca_client/models/similarity_view_settings.rb +37 -24
- data/lib/tca_client/models/similarity_viewer_url_response.rb +25 -12
- data/lib/tca_client/models/similarity_viewer_url_settings.rb +46 -24
- data/lib/tca_client/models/simple_submission_response.rb +117 -13
- data/lib/tca_client/models/simple_submission_response_all_of.rb +294 -0
- data/lib/tca_client/models/submission.rb +191 -13
- data/lib/tca_client/models/submission_all_of.rb +368 -0
- data/lib/tca_client/models/submission_base.rb +82 -23
- data/lib/tca_client/models/submission_base_metadata.rb +30 -17
- data/lib/tca_client/models/submission_complete_webhook_request.rb +385 -0
- data/lib/tca_client/models/submission_complete_webhook_request_all_of.rb +219 -0
- data/lib/tca_client/models/submission_complete_webhook_request_all_of_metadata.rb +219 -0
- data/lib/tca_client/models/submission_size_error.rb +36 -20
- data/lib/tca_client/models/success_message.rb +25 -12
- data/lib/tca_client/models/users.rb +28 -15
- data/lib/tca_client/models/viewer_permissions.rb +29 -16
- data/lib/tca_client/models/webhook.rb +62 -16
- data/lib/tca_client/models/webhook_all_of.rb +235 -0
- data/lib/tca_client/models/webhook_base.rb +28 -15
- data/lib/tca_client/models/webhook_path_request.rb +26 -13
- data/lib/tca_client/models/webhook_with_secret.rb +52 -16
- data/lib/tca_client/models/webhook_with_secret_all_of.rb +225 -0
- data/lib/tca_client/version.rb +5 -4
- data/lib/tca_client.rb +18 -5
- data/tca_client-1.0.0.gem +0 -0
- data/tca_client.gemspec +7 -7
- metadata +34 -29
- data/docs/InlineResponse200.md +0 -7
- data/docs/SimilarityMetadataTopMatches.md +0 -13
@@ -3,13 +3,15 @@
|
|
3
3
|
|
4
4
|
#Turnitin Core API (TCA) provides direct API access to the core functionality provided by Turnitin. TCA supports file submission, similarity report generation, group management, and visualization of report matches via Cloud Viewer or PDF download. Below is the full flow to successfully set up an integration scope, an API Key, and make calls to TCA. Integration Scope and API Key management is done via the Admin Console UI by logging in as an admin user. For more details, go to our [developer portal documentation page](https://developers.turnitin.com/docs). ## Integration Scope and API Key Management TCA API calls must provide an API Key for authentication, so you must first have at least one integration scope associated with at least one API Key to use TCA. ### Admin Console UI First, login to Admin Console UI as an *Admin* user with permission to create Integration Scopes, under a tenant that is licensed to use the TCA product Integration Scopes (you can create a new one, or add keys to existing) * Click `Integrations` in the side bar --> `+ Add Integration` at top the top of the page --> Enter a name --> `Add` Button API Keys * Click `Integrations` in the side bar --> `Create API Key` Button next to a given Integration Scope --> Enter a name --> click `Create and View button` * Copy/Save the key manually or click save to clipboard button to copy it (this is the only time it will show) ## TCA Flow * Register a webhook * Create a submission * Upload a file for the submission * Wait for the submission upload to process * If you registered a webhook, a callback will be sent to it when upload is complete * The status of the *submission* will also update to `COMPLETE` * Request a Similarity Report * Wait for similarity report to process * If you registered a webhook, a callback will be sent to it when report is complete * The status of the *report* will also be updated to `COMPLETE` * Request a URL with parameters to view the Similarity Report
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 1.0.258
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.3.0-SNAPSHOT
|
7
10
|
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 3.0.35
|
10
11
|
=end
|
11
12
|
|
12
13
|
require 'date'
|
14
|
+
require 'time'
|
13
15
|
|
14
16
|
module TCAClient
|
15
17
|
# A Submission is the base object on which other services (such as similarity) are offered. In order to use other services a Submission must first be created and successfully process, then other service objects can be created.
|
@@ -76,27 +78,33 @@ module TCAClient
|
|
76
78
|
}
|
77
79
|
end
|
78
80
|
|
81
|
+
# Returns all the JSON keys this model knows about
|
82
|
+
def self.acceptable_attributes
|
83
|
+
attribute_map.values
|
84
|
+
end
|
85
|
+
|
79
86
|
# Attribute type mapping.
|
80
87
|
def self.openapi_types
|
81
88
|
{
|
82
89
|
:'id' => :'Object',
|
83
|
-
:'owner' => :'
|
84
|
-
:'owner_default_permission_set' => :'
|
85
|
-
:'title' => :'
|
86
|
-
:'submitter' => :'
|
87
|
-
:'submitter_default_permission_set' => :'
|
88
|
-
:'eula' => :'
|
89
|
-
:'metadata' => :'
|
90
|
-
:'extract_text_only' => :'
|
90
|
+
:'owner' => :'String',
|
91
|
+
:'owner_default_permission_set' => :'String',
|
92
|
+
:'title' => :'String',
|
93
|
+
:'submitter' => :'String',
|
94
|
+
:'submitter_default_permission_set' => :'String',
|
95
|
+
:'eula' => :'Eula',
|
96
|
+
:'metadata' => :'SubmissionBaseMetadata',
|
97
|
+
:'extract_text_only' => :'Boolean'
|
91
98
|
}
|
92
99
|
end
|
93
100
|
|
94
101
|
# List of attributes with nullable: true
|
95
102
|
def self.openapi_nullable
|
96
103
|
Set.new([
|
104
|
+
:'id',
|
97
105
|
])
|
98
106
|
end
|
99
|
-
|
107
|
+
|
100
108
|
# Initializes the object
|
101
109
|
# @param [Hash] attributes Model attributes in the form of hash
|
102
110
|
def initialize(attributes = {})
|
@@ -153,33 +161,78 @@ module TCAClient
|
|
153
161
|
# @return Array for valid properties with the reasons
|
154
162
|
def list_invalid_properties
|
155
163
|
invalid_properties = Array.new
|
164
|
+
if !@owner.nil? && @owner.to_s.length > 132
|
165
|
+
invalid_properties.push('invalid value for "owner", the character length must be smaller than or equal to 132.')
|
166
|
+
end
|
167
|
+
|
168
|
+
if !@title.nil? && @title.to_s.length > 500
|
169
|
+
invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 500.')
|
170
|
+
end
|
171
|
+
|
172
|
+
if !@submitter.nil? && @submitter.to_s.length > 132
|
173
|
+
invalid_properties.push('invalid value for "submitter", the character length must be smaller than or equal to 132.')
|
174
|
+
end
|
175
|
+
|
156
176
|
invalid_properties
|
157
177
|
end
|
158
178
|
|
159
179
|
# Check to see if the all the properties in the model are valid
|
160
180
|
# @return true if the model is valid
|
161
181
|
def valid?
|
162
|
-
|
182
|
+
return false if !@owner.nil? && @owner.to_s.length > 132
|
183
|
+
owner_default_permission_set_validator = EnumAttributeValidator.new('String', ["INSTRUCTOR", "LEARNER", "EDITOR", "USER", "APPLICANT", "ADMINISTRATOR", "UNDEFINED"])
|
163
184
|
return false unless owner_default_permission_set_validator.valid?(@owner_default_permission_set)
|
164
|
-
|
185
|
+
return false if !@title.nil? && @title.to_s.length > 500
|
186
|
+
return false if !@submitter.nil? && @submitter.to_s.length > 132
|
187
|
+
submitter_default_permission_set_validator = EnumAttributeValidator.new('String', ["INSTRUCTOR", "LEARNER", "EDITOR", "USER", "APPLICANT", "ADMINISTRATOR", "UNDEFINED"])
|
165
188
|
return false unless submitter_default_permission_set_validator.valid?(@submitter_default_permission_set)
|
166
189
|
true
|
167
190
|
end
|
168
191
|
|
192
|
+
# Custom attribute writer method with validation
|
193
|
+
# @param [Object] owner Value to be assigned
|
194
|
+
def owner=(owner)
|
195
|
+
if !owner.nil? && owner.to_s.length > 132
|
196
|
+
fail ArgumentError, 'invalid value for "owner", the character length must be smaller than or equal to 132.'
|
197
|
+
end
|
198
|
+
|
199
|
+
@owner = owner
|
200
|
+
end
|
201
|
+
|
169
202
|
# Custom attribute writer method checking allowed values (enum).
|
170
203
|
# @param [Object] owner_default_permission_set Object to be assigned
|
171
204
|
def owner_default_permission_set=(owner_default_permission_set)
|
172
|
-
validator = EnumAttributeValidator.new('
|
205
|
+
validator = EnumAttributeValidator.new('String', ["INSTRUCTOR", "LEARNER", "EDITOR", "USER", "APPLICANT", "ADMINISTRATOR", "UNDEFINED"])
|
173
206
|
unless validator.valid?(owner_default_permission_set)
|
174
207
|
fail ArgumentError, "invalid value for \"owner_default_permission_set\", must be one of #{validator.allowable_values}."
|
175
208
|
end
|
176
209
|
@owner_default_permission_set = owner_default_permission_set
|
177
210
|
end
|
178
211
|
|
212
|
+
# Custom attribute writer method with validation
|
213
|
+
# @param [Object] title Value to be assigned
|
214
|
+
def title=(title)
|
215
|
+
if !title.nil? && title.to_s.length > 500
|
216
|
+
fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 500.'
|
217
|
+
end
|
218
|
+
|
219
|
+
@title = title
|
220
|
+
end
|
221
|
+
|
222
|
+
# Custom attribute writer method with validation
|
223
|
+
# @param [Object] submitter Value to be assigned
|
224
|
+
def submitter=(submitter)
|
225
|
+
if !submitter.nil? && submitter.to_s.length > 132
|
226
|
+
fail ArgumentError, 'invalid value for "submitter", the character length must be smaller than or equal to 132.'
|
227
|
+
end
|
228
|
+
|
229
|
+
@submitter = submitter
|
230
|
+
end
|
231
|
+
|
179
232
|
# Custom attribute writer method checking allowed values (enum).
|
180
233
|
# @param [Object] submitter_default_permission_set Object to be assigned
|
181
234
|
def submitter_default_permission_set=(submitter_default_permission_set)
|
182
|
-
validator = EnumAttributeValidator.new('
|
235
|
+
validator = EnumAttributeValidator.new('String', ["INSTRUCTOR", "LEARNER", "EDITOR", "USER", "APPLICANT", "ADMINISTRATOR", "UNDEFINED"])
|
183
236
|
unless validator.valid?(submitter_default_permission_set)
|
184
237
|
fail ArgumentError, "invalid value for \"submitter_default_permission_set\", must be one of #{validator.allowable_values}."
|
185
238
|
end
|
@@ -226,8 +279,11 @@ module TCAClient
|
|
226
279
|
# @return [Object] Returns the model itself
|
227
280
|
def build_from_hash(attributes)
|
228
281
|
return nil unless attributes.is_a?(Hash)
|
282
|
+
attributes = attributes.transform_keys(&:to_sym)
|
229
283
|
self.class.openapi_types.each_pair do |key, type|
|
230
|
-
if
|
284
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
285
|
+
self.send("#{key}=", nil)
|
286
|
+
elsif type =~ /\AArray<(.*)>/i
|
231
287
|
# check to ensure the input is an array given that the attribute
|
232
288
|
# is documented as an array but the input is not
|
233
289
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -235,8 +291,6 @@ module TCAClient
|
|
235
291
|
end
|
236
292
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
237
293
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
238
|
-
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
239
|
-
self.send("#{key}=", nil)
|
240
294
|
end
|
241
295
|
end
|
242
296
|
|
@@ -249,8 +303,8 @@ module TCAClient
|
|
249
303
|
# @return [Object] Deserialized data
|
250
304
|
def _deserialize(type, value)
|
251
305
|
case type.to_sym
|
252
|
-
when :
|
253
|
-
|
306
|
+
when :Time
|
307
|
+
Time.parse(value)
|
254
308
|
when :Date
|
255
309
|
Date.parse(value)
|
256
310
|
when :String
|
@@ -280,7 +334,9 @@ module TCAClient
|
|
280
334
|
end
|
281
335
|
end
|
282
336
|
else # model
|
283
|
-
|
337
|
+
# models (e.g. Pet) or oneOf
|
338
|
+
klass = TCAClient.const_get(type)
|
339
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
284
340
|
end
|
285
341
|
end
|
286
342
|
|
@@ -328,5 +384,8 @@ module TCAClient
|
|
328
384
|
else
|
329
385
|
value
|
330
386
|
end
|
331
|
-
end
|
387
|
+
end
|
388
|
+
|
389
|
+
end
|
390
|
+
|
332
391
|
end
|
@@ -3,13 +3,15 @@
|
|
3
3
|
|
4
4
|
#Turnitin Core API (TCA) provides direct API access to the core functionality provided by Turnitin. TCA supports file submission, similarity report generation, group management, and visualization of report matches via Cloud Viewer or PDF download. Below is the full flow to successfully set up an integration scope, an API Key, and make calls to TCA. Integration Scope and API Key management is done via the Admin Console UI by logging in as an admin user. For more details, go to our [developer portal documentation page](https://developers.turnitin.com/docs). ## Integration Scope and API Key Management TCA API calls must provide an API Key for authentication, so you must first have at least one integration scope associated with at least one API Key to use TCA. ### Admin Console UI First, login to Admin Console UI as an *Admin* user with permission to create Integration Scopes, under a tenant that is licensed to use the TCA product Integration Scopes (you can create a new one, or add keys to existing) * Click `Integrations` in the side bar --> `+ Add Integration` at top the top of the page --> Enter a name --> `Add` Button API Keys * Click `Integrations` in the side bar --> `Create API Key` Button next to a given Integration Scope --> Enter a name --> click `Create and View button` * Copy/Save the key manually or click save to clipboard button to copy it (this is the only time it will show) ## TCA Flow * Register a webhook * Create a submission * Upload a file for the submission * Wait for the submission upload to process * If you registered a webhook, a callback will be sent to it when upload is complete * The status of the *submission* will also update to `COMPLETE` * Request a Similarity Report * Wait for similarity report to process * If you registered a webhook, a callback will be sent to it when report is complete * The status of the *report* will also be updated to `COMPLETE` * Request a URL with parameters to view the Similarity Report
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 1.0.258
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.3.0-SNAPSHOT
|
7
10
|
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 3.0.35
|
10
11
|
=end
|
11
12
|
|
12
13
|
require 'date'
|
14
|
+
require 'time'
|
13
15
|
|
14
16
|
module TCAClient
|
15
17
|
# (optional) Submission metadata. If a group context is included, it must be associated to a group
|
@@ -40,15 +42,20 @@ module TCAClient
|
|
40
42
|
}
|
41
43
|
end
|
42
44
|
|
45
|
+
# Returns all the JSON keys this model knows about
|
46
|
+
def self.acceptable_attributes
|
47
|
+
attribute_map.values
|
48
|
+
end
|
49
|
+
|
43
50
|
# Attribute type mapping.
|
44
51
|
def self.openapi_types
|
45
52
|
{
|
46
|
-
:'submitter' => :'
|
47
|
-
:'owners' => :'
|
48
|
-
:'group' => :'
|
49
|
-
:'group_context' => :'
|
50
|
-
:'original_submitted_time' => :'
|
51
|
-
:'custom' => :'
|
53
|
+
:'submitter' => :'Users',
|
54
|
+
:'owners' => :'Array<Users>',
|
55
|
+
:'group' => :'Group',
|
56
|
+
:'group_context' => :'GroupContext',
|
57
|
+
:'original_submitted_time' => :'Time',
|
58
|
+
:'custom' => :'String'
|
52
59
|
}
|
53
60
|
end
|
54
61
|
|
@@ -57,7 +64,7 @@ module TCAClient
|
|
57
64
|
Set.new([
|
58
65
|
])
|
59
66
|
end
|
60
|
-
|
67
|
+
|
61
68
|
# Initializes the object
|
62
69
|
# @param [Hash] attributes Model attributes in the form of hash
|
63
70
|
def initialize(attributes = {})
|
@@ -150,8 +157,11 @@ module TCAClient
|
|
150
157
|
# @return [Object] Returns the model itself
|
151
158
|
def build_from_hash(attributes)
|
152
159
|
return nil unless attributes.is_a?(Hash)
|
160
|
+
attributes = attributes.transform_keys(&:to_sym)
|
153
161
|
self.class.openapi_types.each_pair do |key, type|
|
154
|
-
if
|
162
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
163
|
+
self.send("#{key}=", nil)
|
164
|
+
elsif type =~ /\AArray<(.*)>/i
|
155
165
|
# check to ensure the input is an array given that the attribute
|
156
166
|
# is documented as an array but the input is not
|
157
167
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -159,8 +169,6 @@ module TCAClient
|
|
159
169
|
end
|
160
170
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
161
171
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
162
|
-
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
163
|
-
self.send("#{key}=", nil)
|
164
172
|
end
|
165
173
|
end
|
166
174
|
|
@@ -173,8 +181,8 @@ module TCAClient
|
|
173
181
|
# @return [Object] Deserialized data
|
174
182
|
def _deserialize(type, value)
|
175
183
|
case type.to_sym
|
176
|
-
when :
|
177
|
-
|
184
|
+
when :Time
|
185
|
+
Time.parse(value)
|
178
186
|
when :Date
|
179
187
|
Date.parse(value)
|
180
188
|
when :String
|
@@ -204,7 +212,9 @@ module TCAClient
|
|
204
212
|
end
|
205
213
|
end
|
206
214
|
else # model
|
207
|
-
|
215
|
+
# models (e.g. Pet) or oneOf
|
216
|
+
klass = TCAClient.const_get(type)
|
217
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
208
218
|
end
|
209
219
|
end
|
210
220
|
|
@@ -252,5 +262,8 @@ module TCAClient
|
|
252
262
|
else
|
253
263
|
value
|
254
264
|
end
|
255
|
-
end
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
|
256
269
|
end
|