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,257 @@
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
+ class FeaturesEnabled
16
+ attr_accessor :similarity
17
+
18
+ attr_accessor :tenant
19
+
20
+ attr_accessor :product_name
21
+
22
+ attr_accessor :access_options
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'similarity' => :'similarity',
50
+ :'tenant' => :'tenant',
51
+ :'product_name' => :'product_name',
52
+ :'access_options' => :'access_options'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'similarity' => :'Object',
60
+ :'tenant' => :'Object',
61
+ :'product_name' => :'Object',
62
+ :'access_options' => :'Object'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TCAClient::FeaturesEnabled` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!self.class.attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TCAClient::FeaturesEnabled`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'similarity')
88
+ self.similarity = attributes[:'similarity']
89
+ end
90
+
91
+ if attributes.key?(:'tenant')
92
+ self.tenant = attributes[:'tenant']
93
+ end
94
+
95
+ if attributes.key?(:'product_name')
96
+ self.product_name = attributes[:'product_name']
97
+ end
98
+
99
+ if attributes.key?(:'access_options')
100
+ if (value = attributes[:'access_options']).is_a?(Array)
101
+ self.access_options = value
102
+ end
103
+ end
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properties with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ true
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ similarity == o.similarity &&
125
+ tenant == o.tenant &&
126
+ product_name == o.product_name &&
127
+ access_options == o.access_options
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Integer] Hash code
138
+ def hash
139
+ [similarity, tenant, product_name, access_options].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def self.build_from_hash(attributes)
146
+ new.build_from_hash(attributes)
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ self.class.openapi_types.each_pair do |key, type|
155
+ if type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
159
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
160
+ end
161
+ elsif !attributes[self.class.attribute_map[key]].nil?
162
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
163
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
164
+ self.send("#{key}=", nil)
165
+ end
166
+ end
167
+
168
+ self
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def _deserialize(type, value)
176
+ case type.to_sym
177
+ when :DateTime
178
+ DateTime.parse(value)
179
+ when :Date
180
+ Date.parse(value)
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :Boolean
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ TCAClient.const_get(type).build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ if value.nil?
231
+ is_nullable = self.class.openapi_nullable.include?(attr)
232
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
233
+ end
234
+
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map { |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end end
257
+ end
@@ -0,0 +1,240 @@
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
+ class FeaturesGenerationSettings
16
+ # List of repositories to search
17
+ attr_accessor :search_repositories
18
+
19
+ attr_accessor :submission_auto_excludes
20
+
21
+ class EnumAttributeValidator
22
+ attr_reader :datatype
23
+ attr_reader :allowable_values
24
+
25
+ def initialize(datatype, allowable_values)
26
+ @allowable_values = allowable_values.map do |value|
27
+ case datatype.to_s
28
+ when /Integer/i
29
+ value.to_i
30
+ when /Float/i
31
+ value.to_f
32
+ else
33
+ value
34
+ end
35
+ end
36
+ end
37
+
38
+ def valid?(value)
39
+ !value || allowable_values.include?(value)
40
+ end
41
+ end
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'search_repositories' => :'search_repositories',
47
+ :'submission_auto_excludes' => :'submission_auto_excludes'
48
+ }
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'search_repositories' => :'Object',
55
+ :'submission_auto_excludes' => :'Object'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TCAClient::FeaturesGenerationSettings` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TCAClient::FeaturesGenerationSettings`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'search_repositories')
81
+ if (value = attributes[:'search_repositories']).is_a?(Array)
82
+ self.search_repositories = value
83
+ end
84
+ end
85
+
86
+ if attributes.key?(:'submission_auto_excludes')
87
+ self.submission_auto_excludes = attributes[:'submission_auto_excludes']
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ invalid_properties = Array.new
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ search_repositories == o.search_repositories &&
110
+ submission_auto_excludes == o.submission_auto_excludes
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [search_repositories, submission_auto_excludes].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
147
+ self.send("#{key}=", nil)
148
+ end
149
+ end
150
+
151
+ self
152
+ end
153
+
154
+ # Deserializes the data based on type
155
+ # @param string type Data type
156
+ # @param string value Value to be deserialized
157
+ # @return [Object] Deserialized data
158
+ def _deserialize(type, value)
159
+ case type.to_sym
160
+ when :DateTime
161
+ DateTime.parse(value)
162
+ when :Date
163
+ Date.parse(value)
164
+ when :String
165
+ value.to_s
166
+ when :Integer
167
+ value.to_i
168
+ when :Float
169
+ value.to_f
170
+ when :Boolean
171
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ TCAClient.const_get(type).build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ # Outputs non-array value in the form of hash
224
+ # For object, use to_hash. Otherwise, just return the value
225
+ # @param [Object] value Any valid value
226
+ # @return [Hash] Returns the value in the form of hash
227
+ def _to_hash(value)
228
+ if value.is_a?(Array)
229
+ value.compact.map { |v| _to_hash(v) }
230
+ elsif value.is_a?(Hash)
231
+ {}.tap do |hash|
232
+ value.each { |k, v| hash[k] = _to_hash(v) }
233
+ end
234
+ elsif value.respond_to? :to_hash
235
+ value.to_hash
236
+ else
237
+ value
238
+ end
239
+ end end
240
+ end