aspose_html_cloud 22.11.1 → 25.12.1

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
- SHA256:
3
- metadata.gz: 5d1b7ca4f575f576715bd56b470d6e326e18439c9f626e941f8242b9632e73e9
4
- data.tar.gz: e32204d5d61c8e07a66cfa3c6ed1bf7483948ea79af04210dc2b80023b696594
2
+ SHA1:
3
+ metadata.gz: ed0fa6996d6f10b1315f7396882f2d9f9fd367b2
4
+ data.tar.gz: 334771ccec0c53589d50a74a1869838f6a512734
5
5
  SHA512:
6
- metadata.gz: 5f89551d802e98480870d680e176524482be01506aee6971d86236412e3cba069998b208d6ae31aff814e265f68ee293ba18c29c838e15302d7862f0fdc58709
7
- data.tar.gz: 3af762e1b9007b820d08ddadef2291cd506b8e30687fd086770954fa4cfd25f79a1feca89d7a4ebcff52c97dd0e7f7fb9da9c675582fb59ff6cdcd9801482ffd
6
+ metadata.gz: 629834350fc0d90ec58000150a6bd04944908868bde02d461a571e1245b06370a655b70ee2d5d146b7e60fa420ee561083446436f7a7cc1fff2cba1446f7d569
7
+ data.tar.gz: 6efed6276e85835e15f7fc97c9e2c1d766673a37c788287ec4c03c88638ee9a55061137b4b0b3da8e06b258c66aa5e6eb53fad4e4c6e30276b37219875f94a89
@@ -39,69 +39,69 @@ module AsposeHtml
39
39
  end
40
40
 
41
41
 
42
- # Converting the HTML, EPUB document from the local file and putting the result in the local file
42
+ # Converting a document from the local file and putting the result in the local file
43
43
  #
44
44
  # @param src Full path to source file.
45
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
45
+ # @param dst Full path to a result file.
46
46
  # @param [Hash, nil] options the optional parameters
47
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
48
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
49
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
50
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
51
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
52
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
53
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
47
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
48
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
49
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
50
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
51
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
52
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
53
+ # @return [OperationResult] Result of operation. See OperationResult object.
54
54
  def convert_local_to_local(src, dst, options = nil)
55
55
  convert(src, dst, true, true, false, options)
56
56
  end
57
57
 
58
- # Converting the HTML, EPUB document from the local file and putting the result in the storage
58
+ # Converting a document from the local file and putting the result in the storage
59
59
  #
60
60
  # @param src Full path to source file.
61
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
61
+ # @param dst Full path to a result file.
62
62
  # @param storage Storage name. Default storage is nil.
63
63
  # @param [Hash, nil] options the optional parameters
64
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
65
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
66
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
67
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
68
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
69
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
70
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
64
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
65
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
66
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
67
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
68
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
69
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
70
+ # @return [OperationResult] Result of operation. See OperationResult object.
71
71
  def convert_local_to_storage(src, dst, storage, options=nil)
72
72
  convert(src, dst, true, false, false, options, storage)
73
73
  end
74
74
 
75
- # Converting the HTML, EPUB document from the storage and putting the result in the local file
75
+ # Converting a document from the storage and putting the result in the local file
76
76
  #
77
77
  # @param src Full path to source file.
78
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
78
+ # @param dst Full path to a result file.
79
79
  # @param storage Storage name. Default storage is nil.
80
80
  # @param [Hash, nil] options the optional parameters
81
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
82
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
83
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
84
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
85
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
86
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
87
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
81
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
82
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
83
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
84
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
85
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
86
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
87
+ # @return [OperationResult] Result of operation. See OperationResult object.
88
88
  def convert_storage_to_local(src, dst, storage, options=nil)
89
89
  convert(src, dst, false, true, false, options, storage)
90
90
  end
91
91
 
92
- # Converting the HTML, EPUB document from the storage and putting the result in the storage
92
+ # Converting a document from the storage and putting the result in the storage
93
93
  #
94
94
  # @param src Full path to source file.
95
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
95
+ # @param dst Full path to a result file.
96
96
  # @param storage Storage name. Default storage is nil.
97
97
  # @param [Hash, nil] options the optional parameters
98
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
99
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
100
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
101
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
102
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
103
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
104
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
98
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
99
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
100
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
101
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
102
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
103
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
104
+ # @return [OperationResult] Result of operation. See OperationResult object.
105
105
  def convert_storage_to_storage(src, dst, storage, options=nil)
106
106
  convert(src, dst, false, false, false, options, storage)
107
107
  end
@@ -109,15 +109,15 @@ module AsposeHtml
109
109
  # Converting the HTML page from URL and putting the result in the local file
110
110
  #
111
111
  # @param src URI of the website.
112
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
112
+ # @param dst Full path to a result file.
113
113
  # @param [Hash, nil] options the optional parameters
114
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
115
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
116
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
117
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
118
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
119
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
120
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
114
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
115
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
116
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
117
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
118
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
119
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
120
+ # @return [OperationResult] Result of operation. See OperationResult object.
121
121
  def convert_url_to_local(src, dst, options=nil)
122
122
  convert(src, dst, false, true, true, options)
123
123
  end
@@ -125,36 +125,117 @@ module AsposeHtml
125
125
  # Converting the HTML page from URL and putting the result in the storage
126
126
  #
127
127
  # @param src URI of the website.
128
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
128
+ # @param dst Full path to a result file.
129
129
  # @param storage Storage name. Default storage is nil.
130
130
  # @param [Hash, nil] options the optional parameters
131
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
132
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
133
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
134
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
135
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
136
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
137
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
131
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
132
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
133
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
134
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
135
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
136
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
137
+ # @return [OperationResult] Result of operation. See OperationResult object.
138
138
  def convert_url_to_storage(src, dst, storage, options=nil)
139
139
  convert(src, dst, false, false, true, options, storage)
140
140
  end
141
141
 
142
- # Converting the HTML document to various formats
142
+ # Vectorization an image from the local file and putting the result in the local file
143
+ #
144
+ # @param src Full path to source file(bmp, png, gif, tiff, jpeg).
145
+ # @param dst Full path to a result file (svg).
146
+ # @param [Hash, nil] options the optional parameters
147
+ # @option options [Float] :error_threshold Defines maximum deviation of points to fitted curve. By default it is 30.
148
+ # @option options [Integer] :max_iterations Defines number of iteration for least-squares approximation method. By default, it is 30.
149
+ # @option options [Integer] :colors_limit The maximum number of colors used to quantize an image. Default value is 25.
150
+ # @option options [Float] :line_width The value of this parameter is affected by the graphics scale. Default value is 1.
151
+ # @return [OperationResult] Result of operation. See OperationResult object.
152
+ def vectorize_local_to_local(src, dst, options = nil)
153
+ vectorize(src, dst, true, true, options)
154
+ end
155
+
156
+ # Vectorization an image from the local file and putting the result in the storage
157
+ #
158
+ # @param src Full path to source file(bmp, png, gif, tiff, jpeg).
159
+ # @param dst Full path to a result file (svg).
160
+ # @param storage Storage name. Default storage is nil.
161
+ # @param [Hash, nil] options the optional parameters
162
+ # @option options [Float] :error_threshold Defines maximum deviation of points to fitted curve. By default it is 30.
163
+ # @option options [Integer] :max_iterations Defines number of iteration for least-squares approximation method. By default, it is 30.
164
+ # @option options [Integer] :colors_limit The maximum number of colors used to quantize an image. Default value is 25.
165
+ # @option options [Float] :line_width The value of this parameter is affected by the graphics scale. Default value is 1.
166
+ # @return [OperationResult] Result of operation. See OperationResult object.
167
+ def vectorize_local_to_storage(src, dst, storage, options=nil)
168
+ vectorize(src, dst, true, false, options, storage)
169
+ end
170
+
171
+ # Vectorization an image from the storage and putting the result in the local file
172
+ #
173
+ # @param src Full path to source file(bmp, png, gif, tiff, jpeg).
174
+ # @param dst Full path to a result file (svg).
175
+ # @param storage Storage name. Default storage is nil.
176
+ # @param [Hash, nil] options the optional parameters
177
+ # @option options [Float] :error_threshold Defines maximum deviation of points to fitted curve. By default it is 30.
178
+ # @option options [Integer] :max_iterations Defines number of iteration for least-squares approximation method. By default, it is 30.
179
+ # @option options [Integer] :colors_limit The maximum number of colors used to quantize an image. Default value is 25.
180
+ # @option options [Float] :line_width The value of this parameter is affected by the graphics scale. Default value is 1.
181
+ # @return [OperationResult] Result of operation. See OperationResult object.
182
+ def vectorize_storage_to_local(src, dst, storage, options=nil)
183
+ vectorize(src, dst, false, true, options, storage)
184
+ end
185
+
186
+ # Vectorization an image from the storage and putting the result in the storage
187
+ #
188
+ # @param src Full path to source file(bmp, png, gif, tiff, jpeg).
189
+ # @param dst Full path to a result file (svg).
190
+ # @param storage Storage name. Default storage is nil.
191
+ # @param [Hash, nil] options the optional parameters
192
+ # @option options [Float] :error_threshold Defines maximum deviation of points to fitted curve. By default it is 30.
193
+ # @option options [Integer] :max_iterations Defines number of iteration for least-squares approximation method. By default, it is 30.
194
+ # @option options [Integer] :colors_limit The maximum number of colors used to quantize an image. Default value is 25.
195
+ # @option options [Float] :line_width The value of this parameter is affected by the graphics scale. Default value is 1.
196
+ # @return [OperationResult] Result of operation. See OperationResult object.
197
+ def vectorize_storage_to_storage(src, dst, storage, options=nil)
198
+ vectorize(src, dst, false, false, options, storage)
199
+ end
200
+
201
+ # Vectorization an image from to SVG format
202
+ #
203
+ # @param src Full path to source file(bmp, png, gif, tiff, jpeg).
204
+ # @param dst Full path to a result file (svg).
205
+ # @param src_in_local Flag, true if source in the local file.
206
+ # @param dst_in_local Flag, true if result in the local file.
207
+ # @param [Hash, nil] options the optional parameters
208
+ # @option options [Float] :error_threshold Defines maximum deviation of points to fitted curve. By default it is 30.
209
+ # @option options [Integer] :max_iterations Defines number of iteration for least-squares approximation method. By default, it is 30.
210
+ # @option options [Integer] :colors_limit The maximum number of colors used to quantize an image. Default value is 25.
211
+ # @option options [Float] :line_width The value of this parameter is affected by the graphics scale. Default value is 1.
212
+ # @param storage_name Storage name. Default storage is nil.
213
+ # @return [OperationResult] Result of operation. See OperationResult object.
214
+ def vectorize(src, dst, src_in_local, dst_in_local, options=nil, storage_name=nil)
215
+ input_format = get_input_format(src)
216
+ output_format = File.extname(dst).strip.downcase[1..-1]
217
+ fail ApiError.new('Input format must be bmp, jpeg, gif, tiff, png') unless %w[bmp jpeg gif tiff png].include? input_format
218
+ fail ApiError.new('Output format must be SVG') if output_format != 'svg'
219
+ convert(src, dst, src_in_local, dst_in_local, false, options, storage_name)
220
+ end
221
+
222
+
223
+ # Converting a document to various formats
143
224
  #
144
225
  # @param src Source file or URL.
145
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
226
+ # @param dst Full path to a result file.
146
227
  # @param src_in_local Flag, true if source in the local file.
147
228
  # @param dst_in_local Flag, true if result in the local file.
148
229
  # @param is_url Flag, true if source is website.
149
230
  # @param [Hash, nil] options the optional parameters
150
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
151
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
152
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
153
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
154
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
155
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
231
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
232
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
233
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
234
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
235
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
236
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
156
237
  # @param storage_name Storage name. Default storage is nil.
157
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
238
+ # @return [OperationResult] Result of operation. See OperationResult object.
158
239
  def convert(src, dst, src_in_local, dst_in_local, is_url, options=nil, storage_name=nil)
159
240
  if src_in_local
160
241
  res = @storage_api.upload_file("/", src)
@@ -224,7 +305,7 @@ module AsposeHtml
224
305
  :query_params => query_params,
225
306
  :form_params => form_params,
226
307
  :body => post_body,
227
- :return_type => 'ConversionResult')
308
+ :return_type => 'OperationResult')
228
309
  if @api_client.config.debug
229
310
  @api_client.config.logger.debug "API called: Create task\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
230
311
  end
@@ -270,7 +351,7 @@ module AsposeHtml
270
351
  :query_params => query_params,
271
352
  :form_params => form_params,
272
353
  :body => post_body,
273
- :return_type => 'ConversionResult')
354
+ :return_type => 'OperationResult')
274
355
 
275
356
  end
276
357
 
@@ -58,7 +58,7 @@ module AsposeHtml
58
58
  @api_client.config.logger.debug 'Calling API: StorageApi.get_disc_usage ...'
59
59
  end
60
60
  # resource path
61
- local_var_path = '/html/storage/disc'
61
+ local_var_path = '/html/storage/disc/usage'
62
62
 
63
63
  # query parameters
64
64
  query_params = {}
@@ -57,7 +57,7 @@ module AsposeHtml
57
57
  'User-Agent' => @user_agent,
58
58
  'Authorization' => "Bearer #{@config.access_token}",
59
59
  'x-aspose-client' => "aspose.html-cloud ruby sdk",
60
- 'x-aspose-client-version' => "22.11.1"
60
+ 'x-aspose-client-version' => "25.12.1"
61
61
  }
62
62
  end
63
63
 
@@ -1,140 +1,140 @@
1
- # -*- coding: utf-8 -*-
2
- =begin
3
- --------------------------------------------------------------------------------------------------------------------
4
- <copyright company="Aspose" file="conversion_result.rb">
5
- </copyright>
6
- Copyright (c) 2022 Aspose.HTML for Cloud
7
- <summary>
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in all
16
- copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- SOFTWARE.
25
- </summary>
26
- --------------------------------------------------------------------------------------------------------------------
27
- =end
28
-
29
- require_relative 'base_model'
30
-
31
- module AsposeHtml
32
- class ConversionResult < BaseModel
33
- attr_accessor :code
34
-
35
- attr_accessor :id
36
-
37
- attr_accessor :status
38
-
39
- attr_accessor :description
40
-
41
- attr_accessor :links
42
-
43
- attr_accessor :file
44
-
45
- # Attribute mapping from ruby-style variable name to JSON key.
46
- def self.attribute_map
47
- {
48
- :'code' => :'code',
49
- :'id' => :'id',
50
- :'status' => :'status',
51
- :'description' => :'description',
52
- :'links' => :'links',
53
- :'file' => :'file'
54
- }
55
- end
56
-
57
- # Attribute type mapping.
58
- def self.model_types
59
- {
60
- :'code' => :'Integer',
61
- :'id' => :'String',
62
- :'status' => :'String',
63
- :'description' => :'String',
64
- :'links' => :'Object',
65
- :'file' => :'String'
66
- }
67
- end
68
-
69
- # Initializes the object
70
- # @param [Hash] attributes Model attributes in the form of hash
71
- def initialize(attributes = {})
72
- return unless attributes.is_a?(Hash)
73
-
74
- # convert string to symbol for hash key
75
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
76
-
77
- if attributes.has_key?(:'code')
78
- self.code = attributes[:'code']
79
- end
80
-
81
- if attributes.has_key?(:'id')
82
- self.id = attributes[:'id']
83
- end
84
-
85
- if attributes.has_key?(:'status')
86
- self.status = attributes[:'status']
87
- end
88
-
89
- if attributes.has_key?(:'description')
90
- self.description = attributes[:'description']
91
- end
92
-
93
- if attributes.has_key?(:'links')
94
- self.links = attributes[:'links']
95
- end
96
-
97
- if attributes.has_key?(:'file')
98
- self.file = attributes[:'file']
99
- end
100
- end
101
-
102
- # Show invalid properties with the reasons. Usually used together with valid?
103
- # @return Array for valid properties with the reasons
104
- def list_invalid_properties
105
- invalid_properties = Array.new
106
- if @code.nil?
107
- invalid_properties.push('invalid value for "code", code cannot be nil.')
108
- end
109
-
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
- return false if @code.nil?
117
- true
118
- end
119
-
120
- # Checks equality by comparing each attribute.
121
- # @param [Object] Object to be compared
122
- def ==(o)
123
- return true if self.equal?(o)
124
- self.class == o.class &&
125
- code == o.code &&
126
- id == o.id &&
127
- status == o.status &&
128
- description == o.description &&
129
- links == o.links &&
130
- file == o.file
131
- end
132
-
133
- # Calculates hash code according to all attributes.
134
- # @return [Fixnum] Hash code
135
- def hash
136
- [code, id, status, description, links, file].hash
137
- end
138
-
139
- end
140
- end
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ --------------------------------------------------------------------------------------------------------------------
4
+ <copyright company="Aspose" file="conversion_result.rb">
5
+ </copyright>
6
+ Copyright (c) 2022 Aspose.HTML for Cloud
7
+ <summary>
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
25
+ </summary>
26
+ --------------------------------------------------------------------------------------------------------------------
27
+ =end
28
+
29
+ require_relative 'base_model'
30
+
31
+ module AsposeHtml
32
+ class OperationResult < BaseModel
33
+ attr_accessor :code
34
+
35
+ attr_accessor :id
36
+
37
+ attr_accessor :status
38
+
39
+ attr_accessor :description
40
+
41
+ attr_accessor :links
42
+
43
+ attr_accessor :file
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'code' => :'code',
49
+ :'id' => :'id',
50
+ :'status' => :'status',
51
+ :'description' => :'description',
52
+ :'links' => :'links',
53
+ :'file' => :'file'
54
+ }
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.model_types
59
+ {
60
+ :'code' => :'Integer',
61
+ :'id' => :'String',
62
+ :'status' => :'String',
63
+ :'description' => :'String',
64
+ :'links' => :'Object',
65
+ :'file' => :'String'
66
+ }
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ return unless attributes.is_a?(Hash)
73
+
74
+ # convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
76
+
77
+ if attributes.has_key?(:'code')
78
+ self.code = attributes[:'code']
79
+ end
80
+
81
+ if attributes.has_key?(:'id')
82
+ self.id = attributes[:'id']
83
+ end
84
+
85
+ if attributes.has_key?(:'status')
86
+ self.status = attributes[:'status']
87
+ end
88
+
89
+ if attributes.has_key?(:'description')
90
+ self.description = attributes[:'description']
91
+ end
92
+
93
+ if attributes.has_key?(:'links')
94
+ self.links = attributes[:'links']
95
+ end
96
+
97
+ if attributes.has_key?(:'file')
98
+ self.file = attributes[:'file']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ if @code.nil?
107
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
108
+ end
109
+
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
+ return false if @code.nil?
117
+ true
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ code == o.code &&
126
+ id == o.id &&
127
+ status == o.status &&
128
+ description == o.description &&
129
+ links == o.links &&
130
+ file == o.file
131
+ end
132
+
133
+ # Calculates hash code according to all attributes.
134
+ # @return [Fixnum] Hash code
135
+ def hash
136
+ [code, id, status, description, links, file].hash
137
+ end
138
+
139
+ end
140
+ end
@@ -49,7 +49,7 @@ require 'aspose_html_cloud/models/files_upload_result'
49
49
  require 'aspose_html_cloud/models/object_exist'
50
50
  require 'aspose_html_cloud/models/storage_exist'
51
51
  require 'aspose_html_cloud/models/storage_file'
52
- require 'aspose_html_cloud/models/conversion_result'
52
+ require 'aspose_html_cloud/models/operation_result'
53
53
 
54
54
  module AsposeHtml
55
55
  class << self
@@ -68,7 +68,7 @@ describe 'Test html_api_V4' do
68
68
 
69
69
  describe 'convert local to local html to image' do
70
70
 
71
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
71
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
72
72
  it "Convert html to " + ext do
73
73
 
74
74
  dst = dst_dir + 'locToLocImg.' + ext
@@ -92,7 +92,7 @@ describe 'Test html_api_V4' do
92
92
  bottom_margin: 50
93
93
  }
94
94
 
95
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
95
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
96
96
  it "Convert html to " + ext do
97
97
 
98
98
  dst = dst_dir + 'locToLocImgOpt.' + ext
@@ -120,14 +120,14 @@ describe 'Test html_api_V4' do
120
120
 
121
121
  expect(answer.code).to eql(200)
122
122
  expect(answer.status).to eql('completed')
123
- expect(@storage_api.object_exists(answer.file)).to be_truthy
123
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
124
124
  end
125
125
  }
126
126
  end
127
127
 
128
128
  describe 'convert local to storage html to image' do
129
129
 
130
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
130
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
131
131
  it "Convert html to " + ext do
132
132
 
133
133
  dst = dst_dir + '/locToStorImg.' + ext
@@ -135,7 +135,7 @@ describe 'Test html_api_V4' do
135
135
 
136
136
  expect(answer.code).to eql(200)
137
137
  expect(answer.status).to eql('completed')
138
- expect(@storage_api.object_exists(answer.file)).to be_truthy
138
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
139
139
  end
140
140
  }
141
141
  end
@@ -151,7 +151,7 @@ describe 'Test html_api_V4' do
151
151
  bottom_margin: 50
152
152
  }
153
153
 
154
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
154
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
155
155
  it "Convert html to " + ext do
156
156
 
157
157
  dst = dst_dir + '/locToStorImgOpt.' + ext
@@ -159,7 +159,7 @@ describe 'Test html_api_V4' do
159
159
 
160
160
  expect(answer.code).to eql(200)
161
161
  expect(answer.status).to eql('completed')
162
- expect(@storage_api.object_exists(answer.file)).to be_truthy
162
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
163
163
  end
164
164
  }
165
165
  end
@@ -191,7 +191,7 @@ describe 'Test html_api_V4' do
191
191
 
192
192
  describe 'convert storage to local html to image' do
193
193
 
194
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
194
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
195
195
  it "Convert html to " + ext do
196
196
 
197
197
  dst = dst_dir + 'storToLocImg.' + ext
@@ -215,7 +215,7 @@ describe 'Test html_api_V4' do
215
215
  bottom_margin: 50
216
216
  }
217
217
 
218
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
218
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
219
219
  it "Convert html to " + ext do
220
220
 
221
221
  dst = dst_dir + 'storToLocImgOpt.' + ext
@@ -248,14 +248,14 @@ describe 'Test html_api_V4' do
248
248
 
249
249
  expect(answer.code).to eql(200)
250
250
  expect(answer.status).to eql('completed')
251
- expect(@storage_api.object_exists(answer.file)).to be_truthy
251
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
252
252
  end
253
253
  }
254
254
  end
255
255
 
256
256
  describe 'convert storage to storage html to image' do
257
257
 
258
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
258
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
259
259
  it "Convert html to " + ext do
260
260
 
261
261
  dst = dst_dir + 'storToStorImg.' + ext
@@ -263,7 +263,7 @@ describe 'Test html_api_V4' do
263
263
 
264
264
  expect(answer.code).to eql(200)
265
265
  expect(answer.status).to eql('completed')
266
- expect(@storage_api.object_exists(answer.file)).to be_truthy
266
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
267
267
  end
268
268
  }
269
269
  end
@@ -279,7 +279,7 @@ describe 'Test html_api_V4' do
279
279
  bottom_margin: 50
280
280
  }
281
281
 
282
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
282
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
283
283
  it "Convert html to " + ext do
284
284
 
285
285
  dst = dst_dir + 'storToStorImgOpt.' + ext
@@ -287,7 +287,7 @@ describe 'Test html_api_V4' do
287
287
 
288
288
  expect(answer.code).to eql(200)
289
289
  expect(answer.status).to eql('completed')
290
- expect(@storage_api.object_exists(answer.file)).to be_truthy
290
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
291
291
  end
292
292
  }
293
293
  end
@@ -315,7 +315,7 @@ describe 'Test html_api_V4' do
315
315
 
316
316
  describe 'convert url to local image' do
317
317
 
318
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
318
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
319
319
  it "Convert url to " + ext do
320
320
 
321
321
  dst = dst_dir + 'urlLocImg.' + ext
@@ -339,7 +339,7 @@ describe 'Test html_api_V4' do
339
339
  bottom_margin: 50
340
340
  }
341
341
 
342
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
342
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
343
343
  it "Convert url to " + ext do
344
344
 
345
345
  dst = dst_dir + 'urlLocImgOpt.' + ext
@@ -367,14 +367,14 @@ describe 'Test html_api_V4' do
367
367
 
368
368
  expect(answer.code).to eql(200)
369
369
  expect(answer.status).to eql('completed')
370
- expect(@storage_api.object_exists(answer.file)).to be_truthy
370
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
371
371
  end
372
372
  }
373
373
  end
374
374
 
375
375
  describe 'convert url to storage image' do
376
376
 
377
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
377
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
378
378
  it "Convert url to " + ext do
379
379
 
380
380
  dst = dst_dir + '/urlStorImg.' + ext
@@ -382,7 +382,7 @@ describe 'Test html_api_V4' do
382
382
 
383
383
  expect(answer.code).to eql(200)
384
384
  expect(answer.status).to eql('completed')
385
- expect(@storage_api.object_exists(answer.file)).to be_truthy
385
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
386
386
  end
387
387
  }
388
388
  end
@@ -398,7 +398,7 @@ describe 'Test html_api_V4' do
398
398
  bottom_margin: 50
399
399
  }
400
400
 
401
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
401
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
402
402
  it "Convert url to " + ext do
403
403
 
404
404
  dst = dst_dir + '/urlStorImgOpt.' + ext
@@ -406,7 +406,7 @@ describe 'Test html_api_V4' do
406
406
 
407
407
  expect(answer.code).to eql(200)
408
408
  expect(answer.status).to eql('completed')
409
- expect(@storage_api.object_exists(answer.file)).to be_truthy
409
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
410
410
  end
411
411
  }
412
412
  end
@@ -458,7 +458,7 @@ describe 'Test html_api_V4' do
458
458
 
459
459
  describe 'convert local to local markdown to image' do
460
460
 
461
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
461
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
462
462
  it "Convert markdown to " + ext do
463
463
 
464
464
  dst = dst_dir + 'locToLocMDImg.' + ext
@@ -482,7 +482,7 @@ describe 'Test html_api_V4' do
482
482
  bottom_margin: 50
483
483
  }
484
484
 
485
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
485
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
486
486
  it "Convert markdown to " + ext do
487
487
 
488
488
  dst = dst_dir + 'locToLocMDImgOpt.' + ext
@@ -542,7 +542,7 @@ describe 'Test html_api_V4' do
542
542
 
543
543
  describe 'convert local to local MHTML to image' do
544
544
 
545
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
545
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
546
546
  it "Convert MHTML to " + ext do
547
547
 
548
548
  dst = dst_dir + 'locToLocMHTMLImg.' + ext
@@ -566,7 +566,7 @@ describe 'Test html_api_V4' do
566
566
  bottom_margin: 50
567
567
  }
568
568
 
569
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
569
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
570
570
  it "Convert MHTML to " + ext do
571
571
 
572
572
  dst = dst_dir + 'locToLocMHTMLImgOpt.' + ext
@@ -626,7 +626,7 @@ describe 'Test html_api_V4' do
626
626
 
627
627
  describe 'convert local to local SVG to image' do
628
628
 
629
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
629
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
630
630
  it "Convert SVG to " + ext do
631
631
 
632
632
  dst = dst_dir + 'locToLocSVGImg.' + ext
@@ -650,7 +650,7 @@ describe 'Test html_api_V4' do
650
650
  bottom_margin: 50
651
651
  }
652
652
 
653
- %w[jpeg jpg bmp png tiff tif gif].each { |ext|
653
+ %w[jpeg jpg bmp png tiff tif gif webp].each { |ext|
654
654
  it "Convert SVG to " + ext do
655
655
 
656
656
  dst = dst_dir + 'locToLocSVGImgOpt.' + ext
@@ -703,6 +703,193 @@ describe 'Test html_api_V4' do
703
703
  end
704
704
  }
705
705
  end
706
+ end
707
+
708
+ describe 'vectorize an image to SVG local to local' do
709
+
710
+ src = File.realpath(__dir__ + '/../../testdata') + '/car.'
711
+ dst_dir = File.realpath(__dir__ + '/../../testresult') + '/'
712
+
713
+ describe 'vectorize to SVG' do
714
+
715
+ %w[bmp jpg gif tiff png].each { |ext|
716
+ it "Vectorize " + ext + " to svg" do
717
+ dst = dst_dir + ext.upcase + 'VectorizetoSVG.svg'
718
+ answer = @html_api.vectorize_local_to_local(src + ext, dst)
719
+
720
+ expect(answer.code).to eql(200)
721
+ expect(answer.status).to eql('completed')
722
+ expect(File.exist?(answer.file)).to be_truthy
723
+ end
724
+ }
725
+ end
726
+
727
+ describe 'vectorize to SVG with options' do
728
+
729
+ %w[bmp jpg gif tiff png].each { |ext|
730
+ it "Vectorize to SVG with opts " + ext do
731
+
732
+ opts = {
733
+ error_threshold: 30,
734
+ max_iterations: 50,
735
+ colors_limit: 3,
736
+ line_width: 2.0,
737
+ }
738
+ dst = dst_dir + ext.upcase + 'VectorizeToSVGWithOpts.svg'
739
+ answer = @html_api.vectorize_local_to_local(src + ext, dst, opts)
740
+
741
+ expect(answer.code).to eql(200)
742
+ expect(answer.status).to eql('completed')
743
+ expect(File.exist?(answer.file)).to be_truthy
744
+ end
745
+ }
746
+ end
747
+ end
748
+
749
+ describe 'vectorize an image to SVG local to storage' do
750
+
751
+ src = File.realpath(__dir__ + '/../../testdata') + '/car.'
752
+ dst_dir = '/VectorizeSvgRuby/'
753
+
754
+ describe 'vectorize to SVG' do
755
+
756
+ %w[bmp jpg gif tiff png].each { |ext|
757
+ it "Vectorize " + ext + " to svg" do
758
+ dst = dst_dir + ext.upcase + 'VectorizetoSVG.svg'
759
+ answer = @html_api.vectorize_local_to_storage(src + ext, dst, nil)
760
+
761
+ expect(answer.code).to eql(200)
762
+ expect(answer.status).to eql('completed')
763
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
764
+ end
765
+ }
766
+ end
767
+
768
+ describe 'vectorize to SVG with options' do
769
+
770
+ %w[bmp jpg gif tiff png].each { |ext|
771
+ it "Vectorize to SVG with opts " + ext do
772
+
773
+ opts = {
774
+ error_threshold: 30,
775
+ max_iterations: 50,
776
+ colors_limit: 3,
777
+ line_width: 2.0,
778
+ }
779
+ dst = dst_dir + ext.upcase + 'VectorizeToSVGWithOpts.svg'
780
+ answer = @html_api.vectorize_local_to_storage(src + ext, dst, opts)
781
+
782
+ expect(answer.code).to eql(200)
783
+ expect(answer.status).to eql('completed')
784
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
785
+ end
786
+ }
787
+ end
788
+ end
789
+
790
+ describe 'vectorize an image to SVG storage to local' do
791
+
792
+ src = File.realpath(__dir__ + '/../../testdata') + '/car.'
793
+ src_dir = '/RubyTest/'
794
+ dst_dir = File.realpath(__dir__ + '/../../testresult') + '/'
795
+
796
+ describe 'vectorize to SVG' do
797
+ %w[bmp jpg gif tiff png].each { |ext|
798
+ it "Vectorize " + ext + " to svg" do
799
+ uploaded_file = src + ext
706
800
 
801
+ res = @storage_api.upload_file(src_dir, uploaded_file)
802
+ expect(res.uploaded.length).to eql(1)
803
+ expect(res.errors.length).to eql(0)
804
+
805
+ dst = dst_dir + ext.upcase + 'StorToLoc.svg'
806
+ answer = @html_api.vectorize_storage_to_local(src_dir + 'car.' + ext, dst, nil)
807
+
808
+ expect(answer.code).to eql(200)
809
+ expect(answer.status).to eql('completed')
810
+ expect(File.exist?(answer.file)).to be_truthy
811
+ end
812
+ }
813
+ end
814
+
815
+ describe 'vectorize to SVG with options' do
816
+
817
+ %w[bmp jpg gif tiff png].each { |ext|
818
+ it "Vectorize to SVG with opts " + ext do
819
+
820
+ opts = {
821
+ error_threshold: 30,
822
+ max_iterations: 50,
823
+ colors_limit: 3,
824
+ line_width: 2.0,
825
+ }
826
+ uploaded_file = src + ext
827
+
828
+ res = @storage_api.upload_file(src_dir, uploaded_file)
829
+ expect(res.uploaded.length).to eql(1)
830
+ expect(res.errors.length).to eql(0)
831
+
832
+ dst = dst_dir + ext.upcase + 'StorToLocWithOpts.svg'
833
+ answer = @html_api.vectorize_storage_to_local(src_dir + 'car.' + ext, dst, nil, opts)
834
+
835
+ expect(answer.code).to eql(200)
836
+ expect(answer.status).to eql('completed')
837
+ expect(File.exist?(answer.file)).to be_truthy
838
+ end
839
+ }
840
+ end
841
+ end
842
+
843
+ describe 'vectorize an image to SVG storage to storage' do
844
+
845
+ src = File.realpath(__dir__ + '/../../testdata') + '/car.'
846
+ src_dir = '/RubyTest/'
847
+
848
+ describe 'vectorize to SVG' do
849
+ %w[bmp jpg gif tiff png].each { |ext|
850
+ it "Vectorize " + ext + " to svg" do
851
+ uploaded_file = src + ext
852
+
853
+ res = @storage_api.upload_file(src_dir, uploaded_file)
854
+ expect(res.uploaded.length).to eql(1)
855
+ expect(res.errors.length).to eql(0)
856
+
857
+ dst = src_dir + ext.upcase + 'StorToStor.svg'
858
+ answer = @html_api.vectorize_storage_to_storage(src_dir + 'car.' + ext, dst, nil)
859
+
860
+ expect(answer.code).to eql(200)
861
+ expect(answer.status).to eql('completed')
862
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
863
+ end
864
+ }
865
+ end
866
+
867
+ describe 'vectorize to SVG with options' do
868
+
869
+ %w[bmp jpg gif tiff png].each { |ext|
870
+ it "Vectorize to SVG with opts " + ext do
871
+
872
+ opts = {
873
+ error_threshold: 30,
874
+ max_iterations: 50,
875
+ colors_limit: 3,
876
+ line_width: 2.0,
877
+ }
878
+ uploaded_file = src + ext
879
+
880
+ res = @storage_api.upload_file(src_dir, uploaded_file)
881
+ expect(res.uploaded.length).to eql(1)
882
+ expect(res.errors.length).to eql(0)
883
+
884
+ dst = src_dir + ext.upcase + 'StorToStorWithOpts.svg'
885
+ answer = @html_api.vectorize_storage_to_storage(src_dir + 'car.' + ext, dst, nil, opts)
886
+
887
+ expect(answer.code).to eql(200)
888
+ expect(answer.status).to eql('completed')
889
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
890
+ end
891
+ }
892
+ end
707
893
  end
894
+
708
895
  end
data/spec/spec_helper.rb CHANGED
@@ -30,14 +30,10 @@
30
30
  require 'aspose_html_cloud'
31
31
 
32
32
  CONFIG = {
33
- # "basePath": "https://api.aspose.cloud/v4.0",
34
- # "authPath": "https://api.aspose.cloud/connect/token",
35
- # "apiKey": "c8dda7d6445d82635b8797d1c8edd153",
36
- # "appSID": "2225baa2-097b-4731-9831-d0d56c28230f",
37
- "basePath": "http://localhost:5000/v4.0",
38
- "authPath": "https://api-qa.aspose.cloud/connect/token",
39
- "apiKey": "html.cloud",
40
- "appSID": "html.cloud",
33
+ "basePath": "https://api.aspose.cloud/v4.0",
34
+ "authPath": "https://api.aspose.cloud/connect/token",
35
+ "apiKey": "c8dda7d6445d82635b8797d1c8edd153",
36
+ "appSID": "2225baa2-097b-4731-9831-d0d56c28230f",
41
37
  "debug": true
42
38
  }
43
39
  # from storage api
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aspose_html_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 22.11.1
4
+ version: 25.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Makogon
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-15 00:00:00.000000000 Z
11
+ date: 2025-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -203,7 +203,6 @@ files:
203
203
  - lib/aspose_html_cloud/api_error.rb
204
204
  - lib/aspose_html_cloud/configuration.rb
205
205
  - lib/aspose_html_cloud/models/base_model.rb
206
- - lib/aspose_html_cloud/models/conversion_result.rb
207
206
  - lib/aspose_html_cloud/models/disc_usage.rb
208
207
  - lib/aspose_html_cloud/models/error.rb
209
208
  - lib/aspose_html_cloud/models/error_details.rb
@@ -212,6 +211,7 @@ files:
212
211
  - lib/aspose_html_cloud/models/files_list.rb
213
212
  - lib/aspose_html_cloud/models/files_upload_result.rb
214
213
  - lib/aspose_html_cloud/models/object_exist.rb
214
+ - lib/aspose_html_cloud/models/operation_result.rb
215
215
  - lib/aspose_html_cloud/models/storage_exist.rb
216
216
  - lib/aspose_html_cloud/models/storage_file.rb
217
217
  - lib/aspose_html_cloud/version.rb
@@ -223,7 +223,7 @@ homepage: https://github.com/aspose-html-cloud/aspose-html-cloud-ruby
223
223
  licenses:
224
224
  - MIT
225
225
  metadata: {}
226
- post_install_message:
226
+ post_install_message:
227
227
  rdoc_options: []
228
228
  require_paths:
229
229
  - lib
@@ -238,8 +238,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
238
  - !ruby/object:Gem::Version
239
239
  version: '0'
240
240
  requirements: []
241
- rubygems_version: 3.3.7
242
- signing_key:
241
+ rubyforge_project:
242
+ rubygems_version: 2.5.2
243
+ signing_key:
243
244
  specification_version: 4
244
245
  summary: A ruby wrapper for the Aspose.HTML Cloud SDK API.
245
246
  test_files: