AsposeDiagramCloud 18.10 → 20.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/AsposeDiagramCloud.gemspec +46 -0
- data/Gemfile +7 -0
- data/README.md +74 -0
- data/Rakefile +8 -0
- data/git_push.sh +55 -0
- data/lib/AsposeDiagramCloud.rb +85 -0
- data/lib/AsposeDiagramCloud/api/diagram_api.rb +768 -0
- data/lib/AsposeDiagramCloud/api/o_auth_api.rb +93 -0
- data/lib/AsposeDiagramCloud/api/storage_api.rb +905 -0
- data/lib/AsposeDiagramCloud/api_client.rb +391 -0
- data/lib/AsposeDiagramCloud/api_error.rb +38 -0
- data/lib/AsposeDiagramCloud/configuration.rb +209 -0
- data/lib/AsposeDiagramCloud/models/access_token_response.rb +251 -0
- data/lib/AsposeDiagramCloud/models/api_response_of_list_of_page_data.rb +190 -0
- data/lib/AsposeDiagramCloud/models/create_new_response.rb +188 -0
- data/lib/AsposeDiagramCloud/models/diagram_save_options.rb +244 -0
- data/lib/AsposeDiagramCloud/models/disc_usage.rb +209 -0
- data/lib/AsposeDiagramCloud/models/draw_shape_data.rb +262 -0
- data/lib/AsposeDiagramCloud/models/ellipse_data.rb +262 -0
- data/lib/AsposeDiagramCloud/models/error.rb +219 -0
- data/lib/AsposeDiagramCloud/models/error_details.rb +204 -0
- data/lib/AsposeDiagramCloud/models/file_version.rb +264 -0
- data/lib/AsposeDiagramCloud/models/file_versions.rb +191 -0
- data/lib/AsposeDiagramCloud/models/files_list.rb +191 -0
- data/lib/AsposeDiagramCloud/models/files_upload_result.rb +203 -0
- data/lib/AsposeDiagramCloud/models/html_save_options.rb +330 -0
- data/lib/AsposeDiagramCloud/models/image_save_options.rb +492 -0
- data/lib/AsposeDiagramCloud/models/line_data.rb +273 -0
- data/lib/AsposeDiagramCloud/models/modify_response.rb +202 -0
- data/lib/AsposeDiagramCloud/models/object_exist.rb +209 -0
- data/lib/AsposeDiagramCloud/models/page_data.rb +216 -0
- data/lib/AsposeDiagramCloud/models/page_setting.rb +219 -0
- data/lib/AsposeDiagramCloud/models/page_size.rb +221 -0
- data/lib/AsposeDiagramCloud/models/pdf_digital_signature_details.rb +248 -0
- data/lib/AsposeDiagramCloud/models/pdf_encryption_details.rb +260 -0
- data/lib/AsposeDiagramCloud/models/pdf_save_options.rb +408 -0
- data/lib/AsposeDiagramCloud/models/point_f.rb +221 -0
- data/lib/AsposeDiagramCloud/models/polyline_data.rb +273 -0
- data/lib/AsposeDiagramCloud/models/rectangle_f.rb +333 -0
- data/lib/AsposeDiagramCloud/models/rendering_save_options.rb +276 -0
- data/lib/AsposeDiagramCloud/models/saa_spose_response.rb +179 -0
- data/lib/AsposeDiagramCloud/models/save_as_response.rb +208 -0
- data/lib/AsposeDiagramCloud/models/save_options_model.rb +235 -0
- data/lib/AsposeDiagramCloud/models/save_options_request.rb +206 -0
- data/lib/AsposeDiagramCloud/models/shape_data.rb +221 -0
- data/lib/AsposeDiagramCloud/models/shape_style_data.rb +189 -0
- data/lib/AsposeDiagramCloud/models/storage_exist.rb +194 -0
- data/lib/AsposeDiagramCloud/models/storage_file.rb +239 -0
- data/lib/AsposeDiagramCloud/models/svg_save_options.rb +321 -0
- data/lib/AsposeDiagramCloud/models/swf_save_options.rb +271 -0
- data/lib/AsposeDiagramCloud/models/text_style_data.rb +253 -0
- data/lib/AsposeDiagramCloud/models/upload_response.rb +188 -0
- data/lib/AsposeDiagramCloud/models/xaml_save_options.rb +262 -0
- data/lib/AsposeDiagramCloud/models/xps_save_options.rb +271 -0
- data/lib/AsposeDiagramCloud/version.rb +15 -0
- data/spec/_spec.rb +308 -0
- data/spec/api/test_convert_spec.rb +308 -0
- data/spec/api/test_drawing_spec.rb +136 -0
- data/spec/api/test_page_spec.rb +92 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/spec_helper.rb +120 -0
- data/testData/FileUpload.vdx +437 -0
- metadata +118 -49
@@ -0,0 +1,15 @@
|
|
1
|
+
=begin
|
2
|
+
#Aspose.Diagram Cloud API Reference
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 3.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module AsposeDiagramCloud
|
14
|
+
VERSION = "20.3"
|
15
|
+
end
|
data/spec/_spec.rb
ADDED
@@ -0,0 +1,308 @@
|
|
1
|
+
=begin
|
2
|
+
#Aspose.Diagram Cloud API Reference
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 3.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
#rspec spec/api/test_convert_spec.rb
|
13
|
+
|
14
|
+
require 'spec_helper'
|
15
|
+
require 'json'
|
16
|
+
|
17
|
+
# Unit tests for AsposeDiagramCloud::DiagramApi
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'DiagramApi' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
#@instance = AsposeDiagramCloud::DiagramApi.new($grant_type,$client_id,$client_secret)
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of DiagramApi' do
|
31
|
+
it 'should create an instance of DiagramApi' do
|
32
|
+
expect($diagramApi).to be_instance_of(AsposeDiagramCloud::DiagramApi)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'test upload file' do
|
37
|
+
it 'should upload file' do
|
38
|
+
file=::File.open(File.expand_path($localtestFile),"r") {|io| io.read(io.size) }
|
39
|
+
result=$storageApi.upload_file($storageTestFOLDER+"/FileUpload.vdx",file)
|
40
|
+
expect(result.uploaded).not_to be_empty
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# unit tests for convert_document
|
45
|
+
# Converts document from the request's content to the specified format.
|
46
|
+
#
|
47
|
+
# @param name Download document name.
|
48
|
+
# @param file File to upload
|
49
|
+
# @param [Hash] opts the optional parameters
|
50
|
+
# @option opts [String] :source_filename Source document name.
|
51
|
+
# @return [File]
|
52
|
+
describe 'convert_document test' do
|
53
|
+
it "should work" do
|
54
|
+
file=::File.open(File.expand_path($localtestFile),"r") {|io| io.read(io.size) }
|
55
|
+
result=$diagramApi.convert_document("Convert.pdf",file,{:source_filename=>"FileUpload.vdx"})
|
56
|
+
#print(result.size)
|
57
|
+
expect(result.size).to be > 0
|
58
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# unit tests for create_new
|
63
|
+
# Create Empty file into the specified format.
|
64
|
+
#
|
65
|
+
# @param name The document name.
|
66
|
+
# @param [Hash] opts the optional parameters
|
67
|
+
# @option opts [String] :folder The document folder.
|
68
|
+
# @option opts [BOOLEAN] :is_overwrite If true overwrite the same name file.The default value is false
|
69
|
+
# @return [CreateNewResponse]
|
70
|
+
describe 'create_new test' do
|
71
|
+
it "should work" do
|
72
|
+
name = 'file_create_ruby.vdx'
|
73
|
+
folder = $storageTestFOLDER
|
74
|
+
is_overwrite=true
|
75
|
+
result=$diagramApi.create_new(name, {:name=>name, :is_overwrite=>is_overwrite, :folder=>folder})
|
76
|
+
print(result)
|
77
|
+
expect(result.created).not_to be_empty
|
78
|
+
#assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# unit tests for download_file_with_format
|
83
|
+
# Exports the document into the specified format.
|
84
|
+
#
|
85
|
+
# @param name The document name.
|
86
|
+
# @param format The destination format.
|
87
|
+
# @param [Hash] opts the optional parameters
|
88
|
+
# @option opts [String] :folder Original document folder.
|
89
|
+
# @return [File]
|
90
|
+
describe 'download_file_with_format test' do
|
91
|
+
it "should work" do
|
92
|
+
folder = $storageTestFOLDER
|
93
|
+
result=$diagramApi.download_file_with_format("FileUpload.vdx","png", {:folder=>folder})
|
94
|
+
expect(result.size).to be > 0
|
95
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# unit tests for save_as
|
100
|
+
# Converts document to destination format with detailed settings and saves result to storage.
|
101
|
+
#
|
102
|
+
# @param name Original document name.
|
103
|
+
# @param save_options_request Save options.
|
104
|
+
# @param [Hash] opts the optional parameters
|
105
|
+
# @option opts [String] :folder Original document folder.
|
106
|
+
# @option opts [BOOLEAN] :is_overwrite If true overwrite the same name file.The default value is false
|
107
|
+
# @return [SaveAsResponse]
|
108
|
+
describe 'save_as test' do
|
109
|
+
it "should work" do
|
110
|
+
folder =$storageTestFOLDER
|
111
|
+
is_overwrite = true
|
112
|
+
|
113
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
114
|
+
save_as_request.file_name="FileSaveAs.pdf"
|
115
|
+
save_as_request.folder=folder
|
116
|
+
|
117
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
118
|
+
expect(result.saved_file).not_to be_empty
|
119
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe 'save_as pdf test' do
|
124
|
+
it "should work" do
|
125
|
+
folder =$storageTestFOLDER
|
126
|
+
is_overwrite = true
|
127
|
+
|
128
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
129
|
+
save_as_request.file_name="FileSaveAs.pdf"
|
130
|
+
save_as_request.folder=folder
|
131
|
+
|
132
|
+
save_options=AsposeDiagramCloud::PdfSaveOptions.new
|
133
|
+
save_options.is_export_comments=true
|
134
|
+
save_options.jpeg_quality=100
|
135
|
+
|
136
|
+
save_as_request.save_options=save_options
|
137
|
+
|
138
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
139
|
+
expect(result.saved_file).not_to be_empty
|
140
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe 'save_as png test' do
|
145
|
+
it "should work" do
|
146
|
+
folder =$storageTestFOLDER
|
147
|
+
is_overwrite = true
|
148
|
+
|
149
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
150
|
+
save_as_request.file_name="FileSaveAs.png"
|
151
|
+
save_as_request.folder=folder
|
152
|
+
|
153
|
+
save_options=AsposeDiagramCloud::ImageSaveOptions.new
|
154
|
+
save_options.is_export_comments=true
|
155
|
+
save_options.jpeg_quality=100
|
156
|
+
|
157
|
+
save_as_request.save_options=save_options
|
158
|
+
|
159
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
160
|
+
expect(result.saved_file).not_to be_empty
|
161
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe 'save_as bmp test' do
|
166
|
+
it "should work" do
|
167
|
+
folder =$storageTestFOLDER
|
168
|
+
is_overwrite = true
|
169
|
+
|
170
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
171
|
+
save_as_request.file_name="FileSaveAs.bmp"
|
172
|
+
save_as_request.folder=folder
|
173
|
+
|
174
|
+
save_options=AsposeDiagramCloud::ImageSaveOptions.new
|
175
|
+
save_options.is_export_comments=true
|
176
|
+
save_options.jpeg_quality=100
|
177
|
+
|
178
|
+
save_as_request.save_options=save_options
|
179
|
+
|
180
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
181
|
+
expect(result.saved_file).not_to be_empty
|
182
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
describe 'save_as vssx test' do
|
187
|
+
it "should work" do
|
188
|
+
folder =$storageTestFOLDER
|
189
|
+
is_overwrite = true
|
190
|
+
|
191
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
192
|
+
save_as_request.file_name="FileSaveAs.vssx"
|
193
|
+
save_as_request.folder=folder
|
194
|
+
|
195
|
+
save_options=AsposeDiagramCloud::DiagramSaveOptions.new
|
196
|
+
save_options.default_font="Times New Roman"
|
197
|
+
|
198
|
+
save_as_request.save_options=save_options
|
199
|
+
|
200
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
201
|
+
expect(result.saved_file).not_to be_empty
|
202
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
describe 'save_as vstm test' do
|
207
|
+
it "should work" do
|
208
|
+
folder =$storageTestFOLDER
|
209
|
+
is_overwrite = true
|
210
|
+
|
211
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
212
|
+
save_as_request.file_name="FileSaveAs.vstm"
|
213
|
+
save_as_request.folder=folder
|
214
|
+
|
215
|
+
save_options=AsposeDiagramCloud::DiagramSaveOptions.new
|
216
|
+
save_options.default_font="Times New Roman"
|
217
|
+
|
218
|
+
save_as_request.save_options=save_options
|
219
|
+
|
220
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
221
|
+
expect(result.saved_file).not_to be_empty
|
222
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
describe 'save_as svg test' do
|
227
|
+
it "should work" do
|
228
|
+
folder =$storageTestFOLDER
|
229
|
+
is_overwrite = true
|
230
|
+
|
231
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
232
|
+
save_as_request.file_name="FileSaveAs.svg"
|
233
|
+
save_as_request.folder=folder
|
234
|
+
|
235
|
+
save_options=AsposeDiagramCloud::SVGSaveOptions.new
|
236
|
+
save_options.quality=100
|
237
|
+
|
238
|
+
save_as_request.save_options=save_options
|
239
|
+
|
240
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
241
|
+
expect(result.saved_file).not_to be_empty
|
242
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
describe 'save_as swf test' do
|
247
|
+
it "should work" do
|
248
|
+
folder =$storageTestFOLDER
|
249
|
+
is_overwrite = true
|
250
|
+
|
251
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
252
|
+
save_as_request.file_name="FileSaveAs.swf"
|
253
|
+
save_as_request.folder=folder
|
254
|
+
|
255
|
+
save_options=AsposeDiagramCloud::SWFSaveOptions.new
|
256
|
+
save_options.save_foreground_pages_only=true
|
257
|
+
|
258
|
+
save_as_request.save_options=save_options
|
259
|
+
|
260
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
261
|
+
expect(result.saved_file).not_to be_empty
|
262
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
describe 'save_as html test' do
|
267
|
+
it "should work" do
|
268
|
+
folder =$storageTestFOLDER
|
269
|
+
is_overwrite = true
|
270
|
+
|
271
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
272
|
+
save_as_request.file_name="FileSaveAs.html"
|
273
|
+
save_as_request.folder=folder
|
274
|
+
|
275
|
+
save_options=AsposeDiagramCloud::HTMLSaveOptions.new
|
276
|
+
save_options.title="Save as HTML Test"
|
277
|
+
|
278
|
+
save_as_request.save_options=save_options
|
279
|
+
|
280
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
281
|
+
|
282
|
+
expect(result.saved_file).not_to be_empty
|
283
|
+
expect(result.additionals).not_to be_empty
|
284
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
describe 'save_as xps test' do
|
289
|
+
it "should work" do
|
290
|
+
folder =$storageTestFOLDER
|
291
|
+
is_overwrite = true
|
292
|
+
|
293
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
294
|
+
save_as_request.file_name="FileSaveAs.xps"
|
295
|
+
save_as_request.folder=folder
|
296
|
+
|
297
|
+
save_options=AsposeDiagramCloud::XPSSaveOptions.new
|
298
|
+
save_options.save_foreground_pages_only=true
|
299
|
+
|
300
|
+
save_as_request.save_options=save_options
|
301
|
+
|
302
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
303
|
+
expect(result.saved_file).not_to be_empty
|
304
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
end
|
@@ -0,0 +1,308 @@
|
|
1
|
+
=begin
|
2
|
+
#Aspose.Diagram Cloud API Reference
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 3.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
#rspec spec/api/test_convert_spec.rb
|
13
|
+
|
14
|
+
require 'spec_helper'
|
15
|
+
require 'json'
|
16
|
+
|
17
|
+
# Unit tests for AsposeDiagramCloud::DiagramApi
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'DiagramApi' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
#@instance = AsposeDiagramCloud::DiagramApi.new($grant_type,$client_id,$client_secret)
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of DiagramApi' do
|
31
|
+
it 'should create an instance of DiagramApi' do
|
32
|
+
expect($diagramApi).to be_instance_of(AsposeDiagramCloud::DiagramApi)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'test upload file' do
|
37
|
+
it 'should upload file' do
|
38
|
+
file=::File.open(File.expand_path($localtestFile),"r") {|io| io.read(io.size) }
|
39
|
+
result=$storageApi.upload_file($storageTestFOLDER+"/FileUpload.vdx",file)
|
40
|
+
expect(result.uploaded).not_to be_empty
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# unit tests for convert_document
|
45
|
+
# Converts document from the request's content to the specified format.
|
46
|
+
#
|
47
|
+
# @param name Download document name.
|
48
|
+
# @param file File to upload
|
49
|
+
# @param [Hash] opts the optional parameters
|
50
|
+
# @option opts [String] :source_filename Source document name.
|
51
|
+
# @return [File]
|
52
|
+
describe 'convert_document test' do
|
53
|
+
it "should work" do
|
54
|
+
file=::File.open(File.expand_path($localtestFile),"r") {|io| io.read(io.size) }
|
55
|
+
result=$diagramApi.convert_document("Convert.pdf",file,{:source_filename=>"FileUpload.vdx"})
|
56
|
+
#print(result.size)
|
57
|
+
expect(result.size).to be > 0
|
58
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# unit tests for create_new
|
63
|
+
# Create Empty file into the specified format.
|
64
|
+
#
|
65
|
+
# @param name The document name.
|
66
|
+
# @param [Hash] opts the optional parameters
|
67
|
+
# @option opts [String] :folder The document folder.
|
68
|
+
# @option opts [BOOLEAN] :is_overwrite If true overwrite the same name file.The default value is false
|
69
|
+
# @return [CreateNewResponse]
|
70
|
+
describe 'create_new test' do
|
71
|
+
it "should work" do
|
72
|
+
name = 'file_create_ruby.vdx'
|
73
|
+
folder = $storageTestFOLDER
|
74
|
+
is_overwrite=true
|
75
|
+
result=$diagramApi.create_new(name, {:name=>name, :is_overwrite=>is_overwrite, :folder=>folder})
|
76
|
+
print(result)
|
77
|
+
expect(result.created).not_to be_empty
|
78
|
+
#assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# unit tests for download_file_with_format
|
83
|
+
# Exports the document into the specified format.
|
84
|
+
#
|
85
|
+
# @param name The document name.
|
86
|
+
# @param format The destination format.
|
87
|
+
# @param [Hash] opts the optional parameters
|
88
|
+
# @option opts [String] :folder Original document folder.
|
89
|
+
# @return [File]
|
90
|
+
describe 'download_file_with_format test' do
|
91
|
+
it "should work" do
|
92
|
+
folder = $storageTestFOLDER
|
93
|
+
result=$diagramApi.download_file_with_format("FileUpload.vdx","png", {:folder=>folder})
|
94
|
+
expect(result.size).to be > 0
|
95
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# unit tests for save_as
|
100
|
+
# Converts document to destination format with detailed settings and saves result to storage.
|
101
|
+
#
|
102
|
+
# @param name Original document name.
|
103
|
+
# @param save_options_request Save options.
|
104
|
+
# @param [Hash] opts the optional parameters
|
105
|
+
# @option opts [String] :folder Original document folder.
|
106
|
+
# @option opts [BOOLEAN] :is_overwrite If true overwrite the same name file.The default value is false
|
107
|
+
# @return [SaveAsResponse]
|
108
|
+
describe 'save_as test' do
|
109
|
+
it "should work" do
|
110
|
+
folder =$storageTestFOLDER
|
111
|
+
is_overwrite = true
|
112
|
+
|
113
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
114
|
+
save_as_request.file_name="FileSaveAs.pdf"
|
115
|
+
save_as_request.folder=folder
|
116
|
+
|
117
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
118
|
+
expect(result.saved_file).not_to be_empty
|
119
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe 'save_as pdf test' do
|
124
|
+
it "should work" do
|
125
|
+
folder =$storageTestFOLDER
|
126
|
+
is_overwrite = true
|
127
|
+
|
128
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
129
|
+
save_as_request.file_name="FileSaveAs.pdf"
|
130
|
+
save_as_request.folder=folder
|
131
|
+
|
132
|
+
save_options=AsposeDiagramCloud::PdfSaveOptions.new
|
133
|
+
save_options.is_export_comments=true
|
134
|
+
save_options.jpeg_quality=100
|
135
|
+
|
136
|
+
save_as_request.save_options=save_options
|
137
|
+
|
138
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
139
|
+
expect(result.saved_file).not_to be_empty
|
140
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe 'save_as png test' do
|
145
|
+
it "should work" do
|
146
|
+
folder =$storageTestFOLDER
|
147
|
+
is_overwrite = true
|
148
|
+
|
149
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
150
|
+
save_as_request.file_name="FileSaveAs.png"
|
151
|
+
save_as_request.folder=folder
|
152
|
+
|
153
|
+
save_options=AsposeDiagramCloud::ImageSaveOptions.new
|
154
|
+
save_options.is_export_comments=true
|
155
|
+
save_options.jpeg_quality=100
|
156
|
+
|
157
|
+
save_as_request.save_options=save_options
|
158
|
+
|
159
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
160
|
+
expect(result.saved_file).not_to be_empty
|
161
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe 'save_as bmp test' do
|
166
|
+
it "should work" do
|
167
|
+
folder =$storageTestFOLDER
|
168
|
+
is_overwrite = true
|
169
|
+
|
170
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
171
|
+
save_as_request.file_name="FileSaveAs.bmp"
|
172
|
+
save_as_request.folder=folder
|
173
|
+
|
174
|
+
save_options=AsposeDiagramCloud::ImageSaveOptions.new
|
175
|
+
save_options.is_export_comments=true
|
176
|
+
save_options.jpeg_quality=100
|
177
|
+
|
178
|
+
save_as_request.save_options=save_options
|
179
|
+
|
180
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
181
|
+
expect(result.saved_file).not_to be_empty
|
182
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
describe 'save_as vssx test' do
|
187
|
+
it "should work" do
|
188
|
+
folder =$storageTestFOLDER
|
189
|
+
is_overwrite = true
|
190
|
+
|
191
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
192
|
+
save_as_request.file_name="FileSaveAs.vssx"
|
193
|
+
save_as_request.folder=folder
|
194
|
+
|
195
|
+
save_options=AsposeDiagramCloud::DiagramSaveOptions.new
|
196
|
+
save_options.default_font="Times New Roman"
|
197
|
+
|
198
|
+
save_as_request.save_options=save_options
|
199
|
+
|
200
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
201
|
+
expect(result.saved_file).not_to be_empty
|
202
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
describe 'save_as vstm test' do
|
207
|
+
it "should work" do
|
208
|
+
folder =$storageTestFOLDER
|
209
|
+
is_overwrite = true
|
210
|
+
|
211
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
212
|
+
save_as_request.file_name="FileSaveAs.vstm"
|
213
|
+
save_as_request.folder=folder
|
214
|
+
|
215
|
+
save_options=AsposeDiagramCloud::DiagramSaveOptions.new
|
216
|
+
save_options.default_font="Times New Roman"
|
217
|
+
|
218
|
+
save_as_request.save_options=save_options
|
219
|
+
|
220
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
221
|
+
expect(result.saved_file).not_to be_empty
|
222
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
describe 'save_as svg test' do
|
227
|
+
it "should work" do
|
228
|
+
folder =$storageTestFOLDER
|
229
|
+
is_overwrite = true
|
230
|
+
|
231
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
232
|
+
save_as_request.file_name="FileSaveAs.svg"
|
233
|
+
save_as_request.folder=folder
|
234
|
+
|
235
|
+
save_options=AsposeDiagramCloud::SVGSaveOptions.new
|
236
|
+
save_options.quality=100
|
237
|
+
|
238
|
+
save_as_request.save_options=save_options
|
239
|
+
|
240
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
241
|
+
expect(result.saved_file).not_to be_empty
|
242
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
describe 'save_as swf test' do
|
247
|
+
it "should work" do
|
248
|
+
folder =$storageTestFOLDER
|
249
|
+
is_overwrite = true
|
250
|
+
|
251
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
252
|
+
save_as_request.file_name="FileSaveAs.swf"
|
253
|
+
save_as_request.folder=folder
|
254
|
+
|
255
|
+
save_options=AsposeDiagramCloud::SWFSaveOptions.new
|
256
|
+
save_options.save_foreground_pages_only=true
|
257
|
+
|
258
|
+
save_as_request.save_options=save_options
|
259
|
+
|
260
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
261
|
+
expect(result.saved_file).not_to be_empty
|
262
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
describe 'save_as html test' do
|
267
|
+
it "should work" do
|
268
|
+
folder =$storageTestFOLDER
|
269
|
+
is_overwrite = true
|
270
|
+
|
271
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
272
|
+
save_as_request.file_name="FileSaveAs.html"
|
273
|
+
save_as_request.folder=folder
|
274
|
+
|
275
|
+
save_options=AsposeDiagramCloud::HTMLSaveOptions.new
|
276
|
+
save_options.title="Save as HTML Test"
|
277
|
+
|
278
|
+
save_as_request.save_options=save_options
|
279
|
+
|
280
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
281
|
+
|
282
|
+
expect(result.saved_file).not_to be_empty
|
283
|
+
expect(result.additionals).not_to be_empty
|
284
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
describe 'save_as xps test' do
|
289
|
+
it "should work" do
|
290
|
+
folder =$storageTestFOLDER
|
291
|
+
is_overwrite = true
|
292
|
+
|
293
|
+
save_as_request=AsposeDiagramCloud::SaveOptionsRequest.new
|
294
|
+
save_as_request.file_name="FileSaveAs.xps"
|
295
|
+
save_as_request.folder=folder
|
296
|
+
|
297
|
+
save_options=AsposeDiagramCloud::XPSSaveOptions.new
|
298
|
+
save_options.save_foreground_pages_only=true
|
299
|
+
|
300
|
+
save_as_request.save_options=save_options
|
301
|
+
|
302
|
+
result=$diagramApi.save_as("FileUpload.vdx",save_as_request,{:is_overwrite=>is_overwrite, :folder=>folder})
|
303
|
+
expect(result.saved_file).not_to be_empty
|
304
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
end
|