aspose_words_cloud 25.11 → 25.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8e68543214be2e10067a65021a517e51f861761ee5397c877bd322278a4486a
4
- data.tar.gz: e4bf6a0d5fde7f987da98af7b6b572c554025e360b3ae300fde78e7567d9477a
3
+ metadata.gz: 9db27341cb9d221a915a91ecbc90562da3e53ee2a761bf2dbb9c424379c2f98d
4
+ data.tar.gz: 4653b7775122f701eb1b7f8e6d16781da9e64d954bece87d55a98b7cddf5fdf9
5
5
  SHA512:
6
- metadata.gz: bb1b0377f42967cdaa5c6ec05462825899245046d4ade6cc507ed662fad0e221636fd15a9d09ad464e62dee4a227ae281d90af6d0c380b21d75f05f05540afb7
7
- data.tar.gz: af7e787a368753b49b73c76773342c889bd94ff2922af5601c6a470aa697a7e891424e7b3a9b7a24d90cb138b375c0de3293485321b7edd5fa112b66d250168c
6
+ metadata.gz: 65c30c3eeb2c230f6fa9196b7e9f38d3e2e72a310b4ec9bfb5d208a3dd2dc2177d419c628f4c822bab470b2802d9009797bbcb1b5370774d88ec118c09e45d24
7
+ data.tar.gz: ffe81f8c4cf917f1fa3ced6e22cbebafc25032d8ad89039b03c4efbe760b1aa831aec65dcb3217a616083756fb088f2c9e17103b751693fa7d4ce775af020307
@@ -413,132 +413,6 @@ module AsposeWordsCloud
413
413
  [data, status_code, headers]
414
414
  end
415
415
 
416
- # Runs a multi-class text classification for the specified raw text.
417
- # @param request ClassifyRequest
418
- # @return [ClassificationResponse]
419
- def classify(request)
420
- begin
421
- data, _status_code, _headers = classify_with_http_info(request)
422
- rescue ApiError => e
423
- if e.code == 401
424
- request_token
425
- data, _status_code, _headers = classify_with_http_info(request)
426
- else
427
- raise
428
- end
429
- end
430
- data
431
- end
432
-
433
- # Runs a multi-class text classification for the specified raw text.
434
- # @param request ClassifyRequest
435
- # @return [Array<(ClassificationResponse, Fixnum, Hash)>]
436
- # ClassificationResponse, response status code and response headers
437
- private def classify_with_http_info(request)
438
- raise ArgumentError, 'Incorrect request type' unless request.is_a? ClassifyRequest
439
-
440
- @api_client.config.logger.debug 'Calling API: WordsApi.classify ...' if @api_client.config.debugging
441
- request_data = request.create_http_request(@api_client)
442
-
443
- data, status_code, headers = @api_client.call_api(
444
- request_data[:'method'],
445
- request_data[:'path'],
446
- header_params: request_data[:'header_params'],
447
- query_params: request_data[:'query_params'],
448
- body: request_data[:'body'],
449
- return_type: 'ClassificationResponse')
450
- if @api_client.config.debugging
451
- @api_client.config.logger.debug "API called:
452
- WordsApi#classify\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
453
- end
454
-
455
- [data, status_code, headers]
456
- end
457
-
458
- # Runs a multi-class text classification for the document.
459
- # @param request ClassifyDocumentRequest
460
- # @return [ClassificationResponse]
461
- def classify_document(request)
462
- begin
463
- data, _status_code, _headers = classify_document_with_http_info(request)
464
- rescue ApiError => e
465
- if e.code == 401
466
- request_token
467
- data, _status_code, _headers = classify_document_with_http_info(request)
468
- else
469
- raise
470
- end
471
- end
472
- data
473
- end
474
-
475
- # Runs a multi-class text classification for the document.
476
- # @param request ClassifyDocumentRequest
477
- # @return [Array<(ClassificationResponse, Fixnum, Hash)>]
478
- # ClassificationResponse, response status code and response headers
479
- private def classify_document_with_http_info(request)
480
- raise ArgumentError, 'Incorrect request type' unless request.is_a? ClassifyDocumentRequest
481
-
482
- @api_client.config.logger.debug 'Calling API: WordsApi.classify_document ...' if @api_client.config.debugging
483
- request_data = request.create_http_request(@api_client)
484
-
485
- data, status_code, headers = @api_client.call_api(
486
- request_data[:'method'],
487
- request_data[:'path'],
488
- header_params: request_data[:'header_params'],
489
- query_params: request_data[:'query_params'],
490
- body: request_data[:'body'],
491
- return_type: 'ClassificationResponse')
492
- if @api_client.config.debugging
493
- @api_client.config.logger.debug "API called:
494
- WordsApi#classify_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
495
- end
496
-
497
- [data, status_code, headers]
498
- end
499
-
500
- # Runs a multi-class text classification for the document.
501
- # @param request ClassifyDocumentOnlineRequest
502
- # @return [ClassificationResponse]
503
- def classify_document_online(request)
504
- begin
505
- data, _status_code, _headers = classify_document_online_with_http_info(request)
506
- rescue ApiError => e
507
- if e.code == 401
508
- request_token
509
- data, _status_code, _headers = classify_document_online_with_http_info(request)
510
- else
511
- raise
512
- end
513
- end
514
- data
515
- end
516
-
517
- # Runs a multi-class text classification for the document.
518
- # @param request ClassifyDocumentOnlineRequest
519
- # @return [Array<(ClassificationResponse, Fixnum, Hash)>]
520
- # ClassificationResponse, response status code and response headers
521
- private def classify_document_online_with_http_info(request)
522
- raise ArgumentError, 'Incorrect request type' unless request.is_a? ClassifyDocumentOnlineRequest
523
-
524
- @api_client.config.logger.debug 'Calling API: WordsApi.classify_document_online ...' if @api_client.config.debugging
525
- request_data = request.create_http_request(@api_client)
526
-
527
- data, status_code, headers = @api_client.call_api(
528
- request_data[:'method'],
529
- request_data[:'path'],
530
- header_params: request_data[:'header_params'],
531
- query_params: request_data[:'query_params'],
532
- body: request_data[:'body'],
533
- return_type: 'ClassificationResponse')
534
- if @api_client.config.debugging
535
- @api_client.config.logger.debug "API called:
536
- WordsApi#classify_document_online\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
537
- end
538
-
539
- [data, status_code, headers]
540
- end
541
-
542
416
  # Compares two documents.
543
417
  # @param request CompareDocumentRequest
544
418
  # @return [DocumentResponse]
@@ -38,6 +38,9 @@ module AsposeWordsCloud
38
38
  # Gets or sets the name of the file.
39
39
  attr_accessor :file_name
40
40
 
41
+ # Gets or sets the file size.
42
+ attr_accessor :file_size
43
+
41
44
  # Gets or sets a value indicating whether the document is encrypted and requires a password to open.
42
45
  attr_accessor :is_encrypted
43
46
 
@@ -75,6 +78,7 @@ module AsposeWordsCloud
75
78
  :'links' => :'Links',
76
79
  :'document_properties' => :'DocumentProperties',
77
80
  :'file_name' => :'FileName',
81
+ :'file_size' => :'FileSize',
78
82
  :'is_encrypted' => :'IsEncrypted',
79
83
  :'is_signed' => :'IsSigned',
80
84
  :'source_format' => :'SourceFormat'
@@ -87,6 +91,7 @@ module AsposeWordsCloud
87
91
  :'links' => :'Array<Link>',
88
92
  :'document_properties' => :'DocumentProperties',
89
93
  :'file_name' => :'String',
94
+ :'file_size' => :'Integer',
90
95
  :'is_encrypted' => :'BOOLEAN',
91
96
  :'is_signed' => :'BOOLEAN',
92
97
  :'source_format' => :'String'
@@ -115,6 +120,10 @@ module AsposeWordsCloud
115
120
  self.file_name = attributes[:'FileName']
116
121
  end
117
122
 
123
+ if attributes.key?(:'FileSize')
124
+ self.file_size = attributes[:'FileSize']
125
+ end
126
+
118
127
  if attributes.key?(:'IsEncrypted')
119
128
  self.is_encrypted = attributes[:'IsEncrypted']
120
129
  end
@@ -160,6 +169,7 @@ module AsposeWordsCloud
160
169
  links == other.links &&
161
170
  document_properties == other.document_properties &&
162
171
  file_name == other.file_name &&
172
+ file_size == other.file_size &&
163
173
  is_encrypted == other.is_encrypted &&
164
174
  is_signed == other.is_signed &&
165
175
  source_format == other.source_format
@@ -174,7 +184,7 @@ module AsposeWordsCloud
174
184
  # Calculates hash code according to all attributes.
175
185
  # @return [Fixnum] Hash code
176
186
  def hash
177
- [links, document_properties, file_name, is_encrypted, is_signed, source_format].hash
187
+ [links, document_properties, file_name, file_size, is_encrypted, is_signed, source_format].hash
178
188
  end
179
189
 
180
190
  # Builds the object from hash
@@ -24,5 +24,5 @@
24
24
  # ------------------------------------------------------------------------------------
25
25
 
26
26
  module AsposeWordsCloud
27
- VERSION = "25.11".freeze
27
+ VERSION = "25.12".freeze
28
28
  end
@@ -46,8 +46,6 @@ require_relative 'aspose_words_cloud/models/border'
46
46
  require_relative 'aspose_words_cloud/models/border_response'
47
47
  require_relative 'aspose_words_cloud/models/borders_collection'
48
48
  require_relative 'aspose_words_cloud/models/borders_response'
49
- require_relative 'aspose_words_cloud/models/classification_response'
50
- require_relative 'aspose_words_cloud/models/classification_result'
51
49
  require_relative 'aspose_words_cloud/models/comment'
52
50
  require_relative 'aspose_words_cloud/models/comment_insert'
53
51
  require_relative 'aspose_words_cloud/models/comment_link'
@@ -316,9 +314,6 @@ require_relative 'aspose_words_cloud/models/requests/apply_style_to_document_ele
316
314
  require_relative 'aspose_words_cloud/models/requests/apply_style_to_document_element_online_request'
317
315
  require_relative 'aspose_words_cloud/models/requests/build_report_request'
318
316
  require_relative 'aspose_words_cloud/models/requests/build_report_online_request'
319
- require_relative 'aspose_words_cloud/models/requests/classify_request'
320
- require_relative 'aspose_words_cloud/models/requests/classify_document_request'
321
- require_relative 'aspose_words_cloud/models/requests/classify_document_online_request'
322
317
  require_relative 'aspose_words_cloud/models/requests/compare_document_request'
323
318
  require_relative 'aspose_words_cloud/models/requests/compare_document_online_request'
324
319
  require_relative 'aspose_words_cloud/models/requests/compress_document_request'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aspose_words_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: '25.11'
4
+ version: '25.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aspose
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-01 00:00:00.000000000 Z
11
+ date: 2025-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -104,8 +104,6 @@ files:
104
104
  - lib/aspose_words_cloud/models/border_response.rb
105
105
  - lib/aspose_words_cloud/models/borders_collection.rb
106
106
  - lib/aspose_words_cloud/models/borders_response.rb
107
- - lib/aspose_words_cloud/models/classification_response.rb
108
- - lib/aspose_words_cloud/models/classification_result.rb
109
107
  - lib/aspose_words_cloud/models/comment.rb
110
108
  - lib/aspose_words_cloud/models/comment_insert.rb
111
109
  - lib/aspose_words_cloud/models/comment_link.rb
@@ -288,9 +286,6 @@ files:
288
286
  - lib/aspose_words_cloud/models/requests/batch_part_request.rb
289
287
  - lib/aspose_words_cloud/models/requests/build_report_online_request.rb
290
288
  - lib/aspose_words_cloud/models/requests/build_report_request.rb
291
- - lib/aspose_words_cloud/models/requests/classify_document_online_request.rb
292
- - lib/aspose_words_cloud/models/requests/classify_document_request.rb
293
- - lib/aspose_words_cloud/models/requests/classify_request.rb
294
289
  - lib/aspose_words_cloud/models/requests/compare_document_online_request.rb
295
290
  - lib/aspose_words_cloud/models/requests/compare_document_request.rb
296
291
  - lib/aspose_words_cloud/models/requests/compress_document_online_request.rb
@@ -1,246 +0,0 @@
1
- # ------------------------------------------------------------------------------------
2
- # <copyright company="Aspose" file="classification_response.rb">
3
- # Copyright (c) 2025 Aspose.Words for Cloud
4
- # </copyright>
5
- # <summary>
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in all
14
- # copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- # SOFTWARE.
23
- # </summary>
24
- # ------------------------------------------------------------------------------------
25
-
26
- require 'date'
27
-
28
- module AsposeWordsCloud
29
-
30
- # The REST response with data on multi-class text classification.
31
- # This response is returned by the Service when handling "PUT https://api.aspose.cloud/v4.0/words/classify" REST API requests.
32
- class ClassificationResponse
33
- # Gets or sets the request Id.
34
- attr_accessor :request_id
35
-
36
- # Gets or sets the best class name.
37
- attr_accessor :best_class_name
38
-
39
- # Gets or sets the best class probability.
40
- attr_accessor :best_class_probability
41
-
42
- # Gets or sets the array of best classes results.
43
- attr_accessor :best_results
44
- # Attribute mapping from ruby-style variable name to JSON key.
45
- def self.attribute_map
46
- {
47
- :'request_id' => :'RequestId',
48
- :'best_class_name' => :'BestClassName',
49
- :'best_class_probability' => :'BestClassProbability',
50
- :'best_results' => :'BestResults'
51
- }
52
- end
53
-
54
- # Attribute type mapping.
55
- def self.swagger_types
56
- {
57
- :'request_id' => :'String',
58
- :'best_class_name' => :'String',
59
- :'best_class_probability' => :'Float',
60
- :'best_results' => :'Array<ClassificationResult>'
61
- }
62
- end
63
-
64
- # Initializes the object
65
- # @param [Hash] attributes Model attributes in the form of hash
66
- def initialize(attributes = {})
67
- return unless attributes.is_a?(Hash)
68
-
69
- # convert string to symbol for hash key
70
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
71
-
72
- if attributes.key?(:'RequestId')
73
- self.request_id = attributes[:'RequestId']
74
- end
75
-
76
- if attributes.key?(:'BestClassName')
77
- self.best_class_name = attributes[:'BestClassName']
78
- end
79
-
80
- if attributes.key?(:'BestClassProbability')
81
- self.best_class_probability = attributes[:'BestClassProbability']
82
- end
83
-
84
- if attributes.key?(:'BestResults')
85
- if (value = attributes[:'BestResults']).is_a?(Array)
86
- self.best_results = value
87
- end
88
- end
89
- end
90
-
91
- # Check to see if the all the properties in the model are valid
92
- # @return true if the model is valid
93
- def valid?
94
- return true
95
- end
96
-
97
- # Checks equality by comparing each attribute.
98
- # @param [Object] Object to be compared
99
- def ==(other)
100
- return true if self.equal?(other)
101
- self.class == other.class &&
102
- request_id == other.request_id &&
103
- best_class_name == other.best_class_name &&
104
- best_class_probability == other.best_class_probability &&
105
- best_results == other.best_results
106
- end
107
-
108
- # @see the `==` method
109
- # @param [Object] Object to be compared
110
- def eql?(other)
111
- self == other
112
- end
113
-
114
- # Calculates hash code according to all attributes.
115
- # @return [Fixnum] Hash code
116
- def hash
117
- [request_id, best_class_name, best_class_probability, best_results].hash
118
- end
119
-
120
- # Builds the object from hash
121
- # @param [Hash] attributes Model attributes in the form of hash
122
- # @return [Object] Returns the model itself
123
- def build_from_hash(attributes)
124
- return nil unless attributes.is_a?(Hash)
125
- self.class.swagger_types.each_pair do |key, type|
126
- if type =~ /\AArray<(.*)>/i
127
- # check to ensure the input is an array given that the the attribute
128
- # is documented as an array but the input is not
129
- if attributes[self.class.attribute_map[key]].is_a?(Array)
130
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
131
- end
132
- elsif !attributes[self.class.attribute_map[key]].nil?
133
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
- end
135
- # or else data not found in attributes(hash), not an issue as the data can be optional
136
- end
137
-
138
- self
139
- end
140
-
141
- # Deserializes the data based on type
142
- # @param string type Data type
143
- # @param string value Value to be deserialized
144
- # @return [Object] Deserialized data
145
- def _deserialize(type, value)
146
- case type.to_sym
147
- when :DateTime
148
- Time.at(/\d/.match(value)[0].to_f).to_datetime
149
- when :Date
150
- Time.at(/\d/.match(value)[0].to_f).to_date
151
- when :String
152
- value.to_s
153
- when :Integer
154
- value.to_i
155
- when :Float
156
- value.to_f
157
- when :BOOLEAN
158
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
- true
160
- else
161
- false
162
- end
163
- when :Object
164
- # generic object (usually a Hash), return directly
165
- value
166
- when /\AArray<(?<inner_type>.+)>\z/
167
- inner_type = Regexp.last_match[:inner_type]
168
- value.map { |v| _deserialize(inner_type, v) }
169
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
- k_type = Regexp.last_match[:k_type]
171
- v_type = Regexp.last_match[:v_type]
172
- {}.tap do |hash|
173
- value.each do |k, v|
174
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
- end
176
- end
177
- else
178
- # model
179
- if value[:'$type']
180
- type = value[:'$type'][0..-4]
181
- end
182
-
183
- temp_model = AsposeWordsCloud.const_get(type).new
184
- temp_model.build_from_hash(value)
185
- end
186
- end
187
-
188
- # Returns the string representation of the object
189
- # @return [String] String presentation of the object
190
- def to_s
191
- to_hash.to_s
192
- end
193
-
194
- # to_body is an alias to to_hash (backward compatibility)
195
- # @return [Hash] Returns the object in the form of hash
196
- def to_body
197
- to_hash
198
- end
199
-
200
- # Returns the object in the form of hash
201
- # @return [Hash] Returns the object in the form of hash
202
- def to_hash
203
- hash = {}
204
- self.class.attribute_map.each_pair do |attr, param|
205
- value = self.send(attr)
206
- next if value.nil?
207
- hash[param] = _to_hash(value)
208
- end
209
- hash
210
- end
211
-
212
- # Outputs non-array value in the form of hash
213
- # For object, use to_hash. Otherwise, just return the value
214
- # @param [Object] value Any valid value
215
- # @return [Hash] Returns the value in the form of hash
216
- def _to_hash(value)
217
- if value.is_a?(Array)
218
- value.compact.map { |v| _to_hash(v) }
219
- elsif value.is_a?(Hash)
220
- {}.tap do |hash|
221
- value.each { |k, v| hash[k] = _to_hash(v) }
222
- end
223
- elsif value.respond_to? :to_hash
224
- value.to_hash
225
- else
226
- value
227
- end
228
- end
229
-
230
- def collectFilesContent(resultFilesContent)
231
- end
232
-
233
- def validate()
234
- raise ArgumentError, 'Property best_class_probability in ClassificationResponse is required.' if self.best_class_probability.nil?
235
- unless self.best_results.nil?
236
- for elementBestResults in self.best_results
237
- unless elementBestResults.nil?
238
- elementBestResults.validate
239
- end
240
- end
241
- end
242
-
243
- end
244
-
245
- end
246
- end
@@ -1,215 +0,0 @@
1
- # ------------------------------------------------------------------------------------
2
- # <copyright company="Aspose" file="classification_result.rb">
3
- # Copyright (c) 2025 Aspose.Words for Cloud
4
- # </copyright>
5
- # <summary>
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in all
14
- # copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- # SOFTWARE.
23
- # </summary>
24
- # ------------------------------------------------------------------------------------
25
-
26
- require 'date'
27
-
28
- module AsposeWordsCloud
29
-
30
- # Represents a single classification result.
31
- class ClassificationResult
32
- # Gets or sets the name of the class.
33
- attr_accessor :class_name
34
-
35
- # Gets or sets the probability of class.
36
- attr_accessor :class_probability
37
- # Attribute mapping from ruby-style variable name to JSON key.
38
- def self.attribute_map
39
- {
40
- :'class_name' => :'ClassName',
41
- :'class_probability' => :'ClassProbability'
42
- }
43
- end
44
-
45
- # Attribute type mapping.
46
- def self.swagger_types
47
- {
48
- :'class_name' => :'String',
49
- :'class_probability' => :'Float'
50
- }
51
- end
52
-
53
- # Initializes the object
54
- # @param [Hash] attributes Model attributes in the form of hash
55
- def initialize(attributes = {})
56
- return unless attributes.is_a?(Hash)
57
-
58
- # convert string to symbol for hash key
59
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
60
-
61
- if attributes.key?(:'ClassName')
62
- self.class_name = attributes[:'ClassName']
63
- end
64
-
65
- if attributes.key?(:'ClassProbability')
66
- self.class_probability = attributes[:'ClassProbability']
67
- end
68
- end
69
-
70
- # Check to see if the all the properties in the model are valid
71
- # @return true if the model is valid
72
- def valid?
73
- return true
74
- end
75
-
76
- # Checks equality by comparing each attribute.
77
- # @param [Object] Object to be compared
78
- def ==(other)
79
- return true if self.equal?(other)
80
- self.class == other.class &&
81
- class_name == other.class_name &&
82
- class_probability == other.class_probability
83
- end
84
-
85
- # @see the `==` method
86
- # @param [Object] Object to be compared
87
- def eql?(other)
88
- self == other
89
- end
90
-
91
- # Calculates hash code according to all attributes.
92
- # @return [Fixnum] Hash code
93
- def hash
94
- [class_name, class_probability].hash
95
- end
96
-
97
- # Builds the object from hash
98
- # @param [Hash] attributes Model attributes in the form of hash
99
- # @return [Object] Returns the model itself
100
- def build_from_hash(attributes)
101
- return nil unless attributes.is_a?(Hash)
102
- self.class.swagger_types.each_pair do |key, type|
103
- if type =~ /\AArray<(.*)>/i
104
- # check to ensure the input is an array given that the the attribute
105
- # is documented as an array but the input is not
106
- if attributes[self.class.attribute_map[key]].is_a?(Array)
107
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
108
- end
109
- elsif !attributes[self.class.attribute_map[key]].nil?
110
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
111
- end
112
- # or else data not found in attributes(hash), not an issue as the data can be optional
113
- end
114
-
115
- self
116
- end
117
-
118
- # Deserializes the data based on type
119
- # @param string type Data type
120
- # @param string value Value to be deserialized
121
- # @return [Object] Deserialized data
122
- def _deserialize(type, value)
123
- case type.to_sym
124
- when :DateTime
125
- Time.at(/\d/.match(value)[0].to_f).to_datetime
126
- when :Date
127
- Time.at(/\d/.match(value)[0].to_f).to_date
128
- when :String
129
- value.to_s
130
- when :Integer
131
- value.to_i
132
- when :Float
133
- value.to_f
134
- when :BOOLEAN
135
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
136
- true
137
- else
138
- false
139
- end
140
- when :Object
141
- # generic object (usually a Hash), return directly
142
- value
143
- when /\AArray<(?<inner_type>.+)>\z/
144
- inner_type = Regexp.last_match[:inner_type]
145
- value.map { |v| _deserialize(inner_type, v) }
146
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
147
- k_type = Regexp.last_match[:k_type]
148
- v_type = Regexp.last_match[:v_type]
149
- {}.tap do |hash|
150
- value.each do |k, v|
151
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
152
- end
153
- end
154
- else
155
- # model
156
- if value[:'$type']
157
- type = value[:'$type'][0..-4]
158
- end
159
-
160
- temp_model = AsposeWordsCloud.const_get(type).new
161
- temp_model.build_from_hash(value)
162
- end
163
- end
164
-
165
- # Returns the string representation of the object
166
- # @return [String] String presentation of the object
167
- def to_s
168
- to_hash.to_s
169
- end
170
-
171
- # to_body is an alias to to_hash (backward compatibility)
172
- # @return [Hash] Returns the object in the form of hash
173
- def to_body
174
- to_hash
175
- end
176
-
177
- # Returns the object in the form of hash
178
- # @return [Hash] Returns the object in the form of hash
179
- def to_hash
180
- hash = {}
181
- self.class.attribute_map.each_pair do |attr, param|
182
- value = self.send(attr)
183
- next if value.nil?
184
- hash[param] = _to_hash(value)
185
- end
186
- hash
187
- end
188
-
189
- # Outputs non-array value in the form of hash
190
- # For object, use to_hash. Otherwise, just return the value
191
- # @param [Object] value Any valid value
192
- # @return [Hash] Returns the value in the form of hash
193
- def _to_hash(value)
194
- if value.is_a?(Array)
195
- value.compact.map { |v| _to_hash(v) }
196
- elsif value.is_a?(Hash)
197
- {}.tap do |hash|
198
- value.each { |k, v| hash[k] = _to_hash(v) }
199
- end
200
- elsif value.respond_to? :to_hash
201
- value.to_hash
202
- else
203
- value
204
- end
205
- end
206
-
207
- def collectFilesContent(resultFilesContent)
208
- end
209
-
210
- def validate()
211
- raise ArgumentError, 'Property class_probability in ClassificationResult is required.' if self.class_probability.nil?
212
- end
213
-
214
- end
215
- end
@@ -1,193 +0,0 @@
1
- # ------------------------------------------------------------------------------------
2
- # <copyright company="Aspose" file="classify_document_online_request.rb">
3
- # Copyright (c) 2025 Aspose.Words for Cloud
4
- # </copyright>
5
- # <summary>
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in all
14
- # copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- # SOFTWARE.
23
- # </summary>
24
- # ------------------------------------------------------------------------------------
25
-
26
- module AsposeWordsCloud
27
-
28
- #
29
- # Request model for classify_document_online operation.
30
- #
31
- class ClassifyDocumentOnlineRequest
32
- # The document.
33
- attr_accessor :document
34
-
35
- # Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
36
- attr_accessor :load_encoding
37
-
38
- # Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don't recommend to use the parameter to pass a plain password for direct call of API.
39
- attr_accessor :password
40
-
41
- # Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
42
- attr_accessor :encrypted_password
43
-
44
- # The value indicates whether OpenType support is on.
45
- attr_accessor :open_type_support
46
-
47
- # The number of the best classes to return.
48
- attr_accessor :best_classes_count
49
-
50
- # The taxonomy to use.
51
- attr_accessor :taxonomy
52
-
53
- #
54
- # Initializes a new instance.
55
- # @param document The document.
56
- # @param load_encoding Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
57
- # @param password Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don't recommend to use the parameter to pass a plain password for direct call of API.
58
- # @param encrypted_password Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
59
- # @param open_type_support The value indicates whether OpenType support is on.
60
- # @param best_classes_count The number of the best classes to return.
61
- # @param taxonomy The taxonomy to use.
62
-
63
- def initialize(document:, load_encoding: nil, password: nil, encrypted_password: nil, open_type_support: nil, best_classes_count: nil, taxonomy: nil)
64
- self.document = document
65
- self.load_encoding = load_encoding
66
- self.password = password
67
- self.encrypted_password = encrypted_password
68
- self.open_type_support = open_type_support
69
- self.best_classes_count = best_classes_count
70
- self.taxonomy = taxonomy
71
- end
72
-
73
- # Creating batch part from request
74
- def to_batch_part(api_client, requestId, parentRequestId = nil)
75
- # verify the required parameter 'document' is set
76
- raise ArgumentError, 'Missing the required parameter document when calling WordsApi.classify_document_online' if api_client.config.client_side_validation && self.document.nil?
77
-
78
- # resource path
79
- local_var_path = '/words/online/get/classify'[7..-1]
80
- local_var_path = local_var_path.sub('//', '/')
81
-
82
- # query parameters
83
- query_params = {}
84
- query_params[downcase_first_letter('LoadEncoding')] = self.load_encoding unless self.load_encoding.nil?
85
- query_params[downcase_first_letter('Password')] = self.password unless self.password.nil?
86
- query_params[downcase_first_letter('EncryptedPassword')] = self.encrypted_password unless self.encrypted_password.nil?
87
- query_params[downcase_first_letter('OpenTypeSupport')] = self.open_type_support unless self.open_type_support.nil?
88
- query_params[downcase_first_letter('BestClassesCount')] = self.best_classes_count unless self.best_classes_count.nil?
89
- query_params[downcase_first_letter('Taxonomy')] = self.taxonomy unless self.taxonomy.nil?
90
-
91
- if query_params
92
- query_params.each { |key, value| local_var_path = api_client.add_param_to_query(local_var_path, key, value) }
93
- end
94
-
95
- header_params = {}
96
- # header parameters
97
- # HTTP header 'Content-Type'
98
- header_params['Content-Type'] = api_client.select_header_content_type(['multipart/form-data'])
99
- header_params['RequestId'] = requestId
100
-
101
- if parentRequestId != nil
102
- header_params['DependsOn'] = parentRequestId
103
- end
104
-
105
- # form parameters
106
- form_params = []
107
- files_content = []
108
- if self.document.nil?
109
- raise "Parameter Document is required."
110
- end
111
- unless self.document.nil?
112
- form_params.push({:'Name' => 'document', :'Data' => self.document, :'MimeType' =>'application/octet-stream'})
113
- end
114
-
115
-
116
- # http body (model)
117
- body = api_client.build_request_body_batch(header_params, form_params, files_content)
118
- part = ""
119
- part.concat("PUT".force_encoding('UTF-8'))
120
- part.concat(" ".force_encoding('UTF-8'))
121
- part.concat(local_var_path.force_encoding('UTF-8'))
122
- part.concat(" \r\n".force_encoding('UTF-8'))
123
-
124
- header_params.each_pair {|key, value| part.concat(key.dup.force_encoding('UTF-8') , ": ".force_encoding('UTF-8'), value.dup.force_encoding('UTF-8'), "\r\n".force_encoding('UTF-8')) }
125
- part.concat("\r\n".force_encoding('UTF-8'))
126
- if body
127
- if body.is_a?(Hash)
128
- body.each do |key, value|
129
- part.concat(value, "\r\n")
130
- end
131
- else
132
- part.concat(body)
133
- end
134
- end
135
- part
136
- end
137
-
138
- def create_http_request(api_client)
139
- # verify the required parameter 'document' is set
140
- raise ArgumentError, 'Missing the required parameter document when calling WordsApi.classify_document_online' if api_client.config.client_side_validation && self.document.nil?
141
-
142
- # resource path
143
- local_var_path = '/words/online/get/classify'[1..-1]
144
- local_var_path = local_var_path.sub('//', '/')
145
-
146
- # query parameters
147
- query_params = {}
148
- query_params[downcase_first_letter('LoadEncoding')] = self.load_encoding unless self.load_encoding.nil?
149
- query_params[downcase_first_letter('Password')] = self.password unless self.password.nil?
150
- query_params[downcase_first_letter('EncryptedPassword')] = self.encrypted_password unless self.encrypted_password.nil?
151
- query_params[downcase_first_letter('OpenTypeSupport')] = self.open_type_support unless self.open_type_support.nil?
152
- query_params[downcase_first_letter('BestClassesCount')] = self.best_classes_count unless self.best_classes_count.nil?
153
- query_params[downcase_first_letter('Taxonomy')] = self.taxonomy unless self.taxonomy.nil?
154
-
155
- # header parameters
156
- header_params = {}
157
- # HTTP header 'Content-Type'
158
- header_params['Content-Type'] = api_client.select_header_content_type(['multipart/form-data'])
159
-
160
- # form parameters
161
- form_params = []
162
- files_content = []
163
- if self.document.nil?
164
- raise "Parameter Document is required."
165
- end
166
- unless self.document.nil?
167
- form_params.push({:'Name' => 'document', :'Data' => self.document, :'MimeType' =>'application/octet-stream'})
168
- end
169
-
170
- body = api_client.build_request_body(header_params, form_params, files_content)
171
- {
172
- 'method': :PUT,
173
- 'path': local_var_path,
174
- 'header_params': header_params,
175
- 'query_params': query_params,
176
- 'body': body,
177
- 'auth_names': ['JWT']
178
- }
179
- end
180
-
181
- #
182
- # Helper method to convert first letter to downcase
183
- #
184
- def downcase_first_letter(str)
185
- str[0].downcase + str[1..-1]
186
- end
187
-
188
- # Get response type
189
- def get_response_type
190
- 'ClassificationResponse'
191
- end
192
- end
193
- end
@@ -1,192 +0,0 @@
1
- # ------------------------------------------------------------------------------------
2
- # <copyright company="Aspose" file="classify_document_request.rb">
3
- # Copyright (c) 2025 Aspose.Words for Cloud
4
- # </copyright>
5
- # <summary>
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in all
14
- # copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- # SOFTWARE.
23
- # </summary>
24
- # ------------------------------------------------------------------------------------
25
-
26
- module AsposeWordsCloud
27
-
28
- #
29
- # Request model for classify_document operation.
30
- #
31
- class ClassifyDocumentRequest
32
- # The document name.
33
- attr_accessor :name
34
-
35
- # Original document folder.
36
- attr_accessor :folder
37
-
38
- # Original document storage.
39
- attr_accessor :storage
40
-
41
- # Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
42
- attr_accessor :load_encoding
43
-
44
- # Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don't recommend to use the parameter to pass a plain password for direct call of API.
45
- attr_accessor :password
46
-
47
- # Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
48
- attr_accessor :encrypted_password
49
-
50
- # The value indicates whether OpenType support is on.
51
- attr_accessor :open_type_support
52
-
53
- # The number of the best classes to return.
54
- attr_accessor :best_classes_count
55
-
56
- # The taxonomy to use.
57
- attr_accessor :taxonomy
58
-
59
- #
60
- # Initializes a new instance.
61
- # @param name The document name.
62
- # @param folder Original document folder.
63
- # @param storage Original document storage.
64
- # @param load_encoding Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
65
- # @param password Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don't recommend to use the parameter to pass a plain password for direct call of API.
66
- # @param encrypted_password Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
67
- # @param open_type_support The value indicates whether OpenType support is on.
68
- # @param best_classes_count The number of the best classes to return.
69
- # @param taxonomy The taxonomy to use.
70
-
71
- def initialize(name:, folder: nil, storage: nil, load_encoding: nil, password: nil, encrypted_password: nil, open_type_support: nil, best_classes_count: nil, taxonomy: nil)
72
- self.name = name
73
- self.folder = folder
74
- self.storage = storage
75
- self.load_encoding = load_encoding
76
- self.password = password
77
- self.encrypted_password = encrypted_password
78
- self.open_type_support = open_type_support
79
- self.best_classes_count = best_classes_count
80
- self.taxonomy = taxonomy
81
- end
82
-
83
- # Creating batch part from request
84
- def to_batch_part(api_client, requestId, parentRequestId = nil)
85
- # verify the required parameter 'name' is set
86
- raise ArgumentError, 'Missing the required parameter name when calling WordsApi.classify_document' if api_client.config.client_side_validation && self.name.nil?
87
-
88
- # resource path
89
- local_var_path = '/words/{name}/classify'[7..-1]
90
- local_var_path = local_var_path.sub('{' + downcase_first_letter('Name') + '}', self.name.nil? ? '' : self.name.to_s)
91
- local_var_path = local_var_path.sub('//', '/')
92
-
93
- # query parameters
94
- query_params = {}
95
- query_params[downcase_first_letter('Folder')] = self.folder unless self.folder.nil?
96
- query_params[downcase_first_letter('Storage')] = self.storage unless self.storage.nil?
97
- query_params[downcase_first_letter('LoadEncoding')] = self.load_encoding unless self.load_encoding.nil?
98
- query_params[downcase_first_letter('Password')] = self.password unless self.password.nil?
99
- query_params[downcase_first_letter('EncryptedPassword')] = self.encrypted_password unless self.encrypted_password.nil?
100
- query_params[downcase_first_letter('OpenTypeSupport')] = self.open_type_support unless self.open_type_support.nil?
101
- query_params[downcase_first_letter('BestClassesCount')] = self.best_classes_count unless self.best_classes_count.nil?
102
- query_params[downcase_first_letter('Taxonomy')] = self.taxonomy unless self.taxonomy.nil?
103
-
104
- if query_params
105
- query_params.each { |key, value| local_var_path = api_client.add_param_to_query(local_var_path, key, value) }
106
- end
107
-
108
- header_params = {}
109
- header_params['RequestId'] = requestId
110
-
111
- if parentRequestId != nil
112
- header_params['DependsOn'] = parentRequestId
113
- end
114
-
115
- # form parameters
116
- form_params = []
117
- files_content = []
118
-
119
- # http body (model)
120
- body = api_client.build_request_body_batch(header_params, form_params, files_content)
121
- part = ""
122
- part.concat("GET".force_encoding('UTF-8'))
123
- part.concat(" ".force_encoding('UTF-8'))
124
- part.concat(local_var_path.force_encoding('UTF-8'))
125
- part.concat(" \r\n".force_encoding('UTF-8'))
126
-
127
- header_params.each_pair {|key, value| part.concat(key.dup.force_encoding('UTF-8') , ": ".force_encoding('UTF-8'), value.dup.force_encoding('UTF-8'), "\r\n".force_encoding('UTF-8')) }
128
- part.concat("\r\n".force_encoding('UTF-8'))
129
- if body
130
- if body.is_a?(Hash)
131
- body.each do |key, value|
132
- part.concat(value, "\r\n")
133
- end
134
- else
135
- part.concat(body)
136
- end
137
- end
138
- part
139
- end
140
-
141
- def create_http_request(api_client)
142
- # verify the required parameter 'name' is set
143
- raise ArgumentError, 'Missing the required parameter name when calling WordsApi.classify_document' if api_client.config.client_side_validation && self.name.nil?
144
-
145
- # resource path
146
- local_var_path = '/words/{name}/classify'[1..-1]
147
- local_var_path = local_var_path.sub('{' + downcase_first_letter('Name') + '}', self.name.nil? ? '' : self.name.to_s)
148
- local_var_path = local_var_path.sub('//', '/')
149
-
150
- # query parameters
151
- query_params = {}
152
- query_params[downcase_first_letter('Folder')] = self.folder unless self.folder.nil?
153
- query_params[downcase_first_letter('Storage')] = self.storage unless self.storage.nil?
154
- query_params[downcase_first_letter('LoadEncoding')] = self.load_encoding unless self.load_encoding.nil?
155
- query_params[downcase_first_letter('Password')] = self.password unless self.password.nil?
156
- query_params[downcase_first_letter('EncryptedPassword')] = self.encrypted_password unless self.encrypted_password.nil?
157
- query_params[downcase_first_letter('OpenTypeSupport')] = self.open_type_support unless self.open_type_support.nil?
158
- query_params[downcase_first_letter('BestClassesCount')] = self.best_classes_count unless self.best_classes_count.nil?
159
- query_params[downcase_first_letter('Taxonomy')] = self.taxonomy unless self.taxonomy.nil?
160
-
161
- # header parameters
162
- header_params = {}
163
- # HTTP header 'Content-Type'
164
- header_params['Content-Type'] = api_client.select_header_content_type(['application/xml', 'application/json'])
165
-
166
- # form parameters
167
- form_params = []
168
- files_content = []
169
- body = api_client.build_request_body(header_params, form_params, files_content)
170
- {
171
- 'method': :GET,
172
- 'path': local_var_path,
173
- 'header_params': header_params,
174
- 'query_params': query_params,
175
- 'body': body,
176
- 'auth_names': ['JWT']
177
- }
178
- end
179
-
180
- #
181
- # Helper method to convert first letter to downcase
182
- #
183
- def downcase_first_letter(str)
184
- str[0].downcase + str[1..-1]
185
- end
186
-
187
- # Get response type
188
- def get_response_type
189
- 'ClassificationResponse'
190
- end
191
- end
192
- end
@@ -1,158 +0,0 @@
1
- # ------------------------------------------------------------------------------------
2
- # <copyright company="Aspose" file="classify_request.rb">
3
- # Copyright (c) 2025 Aspose.Words for Cloud
4
- # </copyright>
5
- # <summary>
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in all
14
- # copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- # SOFTWARE.
23
- # </summary>
24
- # ------------------------------------------------------------------------------------
25
-
26
- module AsposeWordsCloud
27
-
28
- #
29
- # Request model for classify operation.
30
- #
31
- class ClassifyRequest
32
- # The text to classify.
33
- attr_accessor :text
34
-
35
- # The number of the best classes to return.
36
- attr_accessor :best_classes_count
37
-
38
- #
39
- # Initializes a new instance.
40
- # @param text The text to classify.
41
- # @param best_classes_count The number of the best classes to return.
42
-
43
- def initialize(text:, best_classes_count: nil)
44
- self.text = text
45
- self.best_classes_count = best_classes_count
46
- end
47
-
48
- # Creating batch part from request
49
- def to_batch_part(api_client, requestId, parentRequestId = nil)
50
- # verify the required parameter 'text' is set
51
- raise ArgumentError, 'Missing the required parameter text when calling WordsApi.classify' if api_client.config.client_side_validation && self.text.nil?
52
-
53
- # resource path
54
- local_var_path = '/words/classify'[7..-1]
55
- local_var_path = local_var_path.sub('//', '/')
56
-
57
- # query parameters
58
- query_params = {}
59
- query_params[downcase_first_letter('BestClassesCount')] = self.best_classes_count unless self.best_classes_count.nil?
60
-
61
- if query_params
62
- query_params.each { |key, value| local_var_path = api_client.add_param_to_query(local_var_path, key, value) }
63
- end
64
-
65
- header_params = {}
66
- # header parameters
67
- # HTTP header 'Content-Type'
68
- header_params['Content-Type'] = api_client.select_header_content_type(['multipart/form-data'])
69
- header_params['RequestId'] = requestId
70
-
71
- if parentRequestId != nil
72
- header_params['DependsOn'] = parentRequestId
73
- end
74
-
75
- # form parameters
76
- form_params = []
77
- files_content = []
78
- if self.text.nil?
79
- raise "Parameter Text is required."
80
- end
81
- unless self.text.nil?
82
- form_params.push({:'Name' => 'text', :'Data' => self.text, :'MimeType' =>'text/plain'})
83
- end
84
-
85
-
86
- # http body (model)
87
- body = api_client.build_request_body_batch(header_params, form_params, files_content)
88
- part = ""
89
- part.concat("PUT".force_encoding('UTF-8'))
90
- part.concat(" ".force_encoding('UTF-8'))
91
- part.concat(local_var_path.force_encoding('UTF-8'))
92
- part.concat(" \r\n".force_encoding('UTF-8'))
93
-
94
- header_params.each_pair {|key, value| part.concat(key.dup.force_encoding('UTF-8') , ": ".force_encoding('UTF-8'), value.dup.force_encoding('UTF-8'), "\r\n".force_encoding('UTF-8')) }
95
- part.concat("\r\n".force_encoding('UTF-8'))
96
- if body
97
- if body.is_a?(Hash)
98
- body.each do |key, value|
99
- part.concat(value, "\r\n")
100
- end
101
- else
102
- part.concat(body)
103
- end
104
- end
105
- part
106
- end
107
-
108
- def create_http_request(api_client)
109
- # verify the required parameter 'text' is set
110
- raise ArgumentError, 'Missing the required parameter text when calling WordsApi.classify' if api_client.config.client_side_validation && self.text.nil?
111
-
112
- # resource path
113
- local_var_path = '/words/classify'[1..-1]
114
- local_var_path = local_var_path.sub('//', '/')
115
-
116
- # query parameters
117
- query_params = {}
118
- query_params[downcase_first_letter('BestClassesCount')] = self.best_classes_count unless self.best_classes_count.nil?
119
-
120
- # header parameters
121
- header_params = {}
122
- # HTTP header 'Content-Type'
123
- header_params['Content-Type'] = api_client.select_header_content_type(['multipart/form-data'])
124
-
125
- # form parameters
126
- form_params = []
127
- files_content = []
128
- if self.text.nil?
129
- raise "Parameter Text is required."
130
- end
131
- unless self.text.nil?
132
- form_params.push({:'Name' => 'text', :'Data' => self.text, :'MimeType' =>'text/plain'})
133
- end
134
-
135
- body = api_client.build_request_body(header_params, form_params, files_content)
136
- {
137
- 'method': :PUT,
138
- 'path': local_var_path,
139
- 'header_params': header_params,
140
- 'query_params': query_params,
141
- 'body': body,
142
- 'auth_names': ['JWT']
143
- }
144
- end
145
-
146
- #
147
- # Helper method to convert first letter to downcase
148
- #
149
- def downcase_first_letter(str)
150
- str[0].downcase + str[1..-1]
151
- end
152
-
153
- # Get response type
154
- def get_response_type
155
- 'ClassificationResponse'
156
- end
157
- end
158
- end