aspose_html_cloud 22.10.1 → 22.10.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b84dff5e029232e46970d82ad5f3802ec49e338808ce8ba822668cc6a00fbacf
4
- data.tar.gz: 475b5eaa882a5b97c44053f9d98853c6d49af395acedeee9dd96976499bfe81c
3
+ metadata.gz: 7135c0c7df6333484c04dea4f15aa948f4a4988015eee7cbac931941ffe8fb6a
4
+ data.tar.gz: 96dfb00ce014ab9b3ac72f170f4b8f6629cef2314fe78a811b7e56e8eb3022b7
5
5
  SHA512:
6
- metadata.gz: 2ab8fe2f13529a99780fb5f144f469232e6088019a1001f1f3b207a541091abbc82222b3ed1fc91ee28915349baef88568f4560a295d63af4ff8e63b26872024
7
- data.tar.gz: fb4ba274dff2bc84934e3f6c9680e94fe94f2c71f3e6cdb9dc0e5ed7dbebf377c01cc442e544b5e92df76039ea6a2bd6002a633dca5cb78cf502e744d1d329a7
6
+ metadata.gz: 7d1a073130cb87d6b26b1e72646adc7f2d012f080df138235f95cbb01cfcbce254c5312844f622780542caab750c7e1df591dc235ac539b342b6574bb132e994
7
+ data.tar.gz: aa892430a7b25fa79b7d0f6de6aa44adc8c50b4e6c9cff499d4d0682816b341c0097440813c66e01c735ebbd2ecd5c3d63314251cca9953bff72ad1bcfb2f4f6
@@ -43,7 +43,7 @@ module AsposeHtml
43
43
  #
44
44
  # @param src Full path to source file.
45
45
  # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
46
- # @param [Hash] options the optional parameters
46
+ # @param [Hash, nil] options the optional parameters
47
47
  # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
48
48
  # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
49
49
  # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
@@ -52,7 +52,7 @@ module AsposeHtml
52
52
  # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
53
53
  # @return [ConversionResult] Result of conversion. See ConversionResult object.
54
54
  def convert_local_to_local(src, dst, options = nil)
55
- return convert(src, dst, true, true, false, options)
55
+ convert(src, dst, true, true, false, options)
56
56
  end
57
57
 
58
58
  # Converting the HTML, EPUB document from the local file and putting the result in the storage
@@ -60,7 +60,7 @@ module AsposeHtml
60
60
  # @param src Full path to source file.
61
61
  # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
62
62
  # @param storage Storage name. Default storage is nil.
63
- # @param [Hash] options the optional parameters
63
+ # @param [Hash, nil] options the optional parameters
64
64
  # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
65
65
  # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
66
66
  # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
@@ -69,7 +69,7 @@ module AsposeHtml
69
69
  # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
70
70
  # @return [ConversionResult] Result of conversion. See ConversionResult object.
71
71
  def convert_local_to_storage(src, dst, storage, options=nil)
72
- return convert(src, dst, true, false, false, options, storage)
72
+ convert(src, dst, true, false, false, options, storage)
73
73
  end
74
74
 
75
75
  # Converting the HTML, EPUB document from the storage and putting the result in the local file
@@ -77,7 +77,7 @@ module AsposeHtml
77
77
  # @param src Full path to source file.
78
78
  # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
79
79
  # @param storage Storage name. Default storage is nil.
80
- # @param [Hash] options the optional parameters
80
+ # @param [Hash, nil] options the optional parameters
81
81
  # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
82
82
  # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
83
83
  # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
@@ -86,7 +86,7 @@ module AsposeHtml
86
86
  # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
87
87
  # @return [ConversionResult] Result of conversion. See ConversionResult object.
88
88
  def convert_storage_to_local(src, dst, storage, options=nil)
89
- return convert(src, dst, false, true, false, options, storage)
89
+ convert(src, dst, false, true, false, options, storage)
90
90
  end
91
91
 
92
92
  # Converting the HTML, EPUB document from the storage and putting the result in the storage
@@ -94,7 +94,7 @@ module AsposeHtml
94
94
  # @param src Full path to source file.
95
95
  # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
96
96
  # @param storage Storage name. Default storage is nil.
97
- # @param [Hash] options the optional parameters
97
+ # @param [Hash, nil] options the optional parameters
98
98
  # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
99
99
  # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
100
100
  # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
@@ -103,14 +103,14 @@ module AsposeHtml
103
103
  # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
104
104
  # @return [ConversionResult] Result of conversion. See ConversionResult object.
105
105
  def convert_storage_to_storage(src, dst, storage, options=nil)
106
- return convert(src, dst, false, false, false, options, storage)
106
+ convert(src, dst, false, false, false, options, storage)
107
107
  end
108
108
 
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
112
  # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
113
- # @param [Hash] options the optional parameters
113
+ # @param [Hash, nil] options the optional parameters
114
114
  # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
115
115
  # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
116
116
  # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
@@ -119,7 +119,7 @@ module AsposeHtml
119
119
  # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
120
120
  # @return [ConversionResult] Result of conversion. See ConversionResult object.
121
121
  def convert_url_to_local(src, dst, options=nil)
122
- return convert(src, dst, false, true, true, options)
122
+ convert(src, dst, false, true, true, options)
123
123
  end
124
124
 
125
125
  # Converting the HTML page from URL and putting the result in the storage
@@ -127,7 +127,7 @@ module AsposeHtml
127
127
  # @param src URI of the website.
128
128
  # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
129
129
  # @param storage Storage name. Default storage is nil.
130
- # @param [Hash] options the optional parameters
130
+ # @param [Hash, nil] options the optional parameters
131
131
  # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
132
132
  # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
133
133
  # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
@@ -136,7 +136,7 @@ module AsposeHtml
136
136
  # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
137
137
  # @return [ConversionResult] Result of conversion. See ConversionResult object.
138
138
  def convert_url_to_storage(src, dst, storage, options=nil)
139
- return convert(src, dst, false, false, true, options, storage)
139
+ convert(src, dst, false, false, true, options, storage)
140
140
  end
141
141
 
142
142
  # Converting the HTML document to various formats
@@ -146,7 +146,7 @@ module AsposeHtml
146
146
  # @param src_in_local Flag, true if source in the local file.
147
147
  # @param dst_in_local Flag, true if result in the local file.
148
148
  # @param is_url Flag, true if source is website.
149
- # @param [Hash] options the optional parameters
149
+ # @param [Hash, nil] options the optional parameters
150
150
  # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
151
151
  # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
152
152
  # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
@@ -189,15 +189,15 @@ module AsposeHtml
189
189
  post_body[:'outputFile'] = out_file.to_s
190
190
  post_body[:'storageName'] = storage_name.to_s
191
191
 
192
- if !options.nil?
192
+ unless options.nil?
193
193
  post_body[:'options'] = {}
194
- post_body[:'options'][:'width'] = options[:'width'] if !options[:'width'].nil?
195
- post_body[:'options'][:'height'] = options[:'height'] if !options[:'height'].nil?
196
- post_body[:'options'][:'leftMargin'] = options[:'left_margin'] if !options[:'left_margin'].nil?
197
- post_body[:'options'][:'rightMargin'] = options[:'right_margin'] if !options[:'right_margin'].nil?
198
- post_body[:'options'][:'topMargin'] = options[:'top_margin'] if !options[:'top_margin'].nil?
199
- post_body[:'options'][:'bottomMargin'] = options[:'bottom_margin'] if !options[:'bottom_margin'].nil?
200
- post_body[:'options'][:'resolution'] = options[:'resolution'] if !options[:'resolution'].nil?
194
+ post_body[:'options'][:'width'] = options[:'width'] unless options[:'width'].nil?
195
+ post_body[:'options'][:'height'] = options[:'height'] unless options[:'height'].nil?
196
+ post_body[:'options'][:'leftMargin'] = options[:'left_margin'] unless options[:'left_margin'].nil?
197
+ post_body[:'options'][:'rightMargin'] = options[:'right_margin'] unless options[:'right_margin'].nil?
198
+ post_body[:'options'][:'topMargin'] = options[:'top_margin'] unless options[:'top_margin'].nil?
199
+ post_body[:'options'][:'bottomMargin'] = options[:'bottom_margin'] unless options[:'bottom_margin'].nil?
200
+ post_body[:'options'][:'resolution'] = options[:'resolution'] unless options[:'resolution'].nil?
201
201
  end
202
202
 
203
203
  query_params = {}
@@ -273,7 +273,7 @@ module AsposeHtml
273
273
  when '.HTML', '.HTM'
274
274
  return 'html'
275
275
  when '.MHT', '.MHTML'
276
- return 'mht'
276
+ return 'mhtml'
277
277
  when '.XHTML', '.XML'
278
278
  return 'xhtml'
279
279
  when '.EPUB'
@@ -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' => "20.8.0"
60
+ 'x-aspose-client-version' => "22.10.2"
61
61
  }
62
62
  end
63
63
 
@@ -411,4 +411,172 @@ describe 'Test html_api_V4' do
411
411
  }
412
412
  end
413
413
  end
414
+
415
+ describe 'convert markdown local to local' do
416
+
417
+ src = File.realpath(__dir__ + '/../../testdata') + '/README.md'
418
+ dst_dir = File.realpath(__dir__ + '/../../testresult') + '/'
419
+
420
+ describe 'convert local to local markdown to doc' do
421
+
422
+ %w[pdf xps docx html mhtml mht].each { |ext|
423
+ it "Convert markdown to " + ext do
424
+
425
+ dst = dst_dir + 'locToLocDocMD.' + ext
426
+ answer = @html_api.convert_local_to_local(src, dst)
427
+
428
+ expect(answer.code).to eql(200)
429
+ expect(answer.status).to eql('completed')
430
+ expect(File.exist?(answer.file)).to be_truthy
431
+ end
432
+ }
433
+ end
434
+
435
+ describe 'convert local to local markdown to doc with options' do
436
+
437
+ %w[pdf xps docx].each { |ext|
438
+ it "Convert markdown to " + ext do
439
+
440
+ options_A4 = {
441
+ width: 8.3,
442
+ height: 11.7,
443
+ top_margin: 0.5,
444
+ bottom_margin: 0.5,
445
+ left_margin: 0.5,
446
+ right_margin: 0.5
447
+ }
448
+
449
+ dst = dst_dir + 'locToLocDocMDWithOpts.' + ext
450
+ answer = @html_api.convert_local_to_local(src, dst, options_A4)
451
+
452
+ expect(answer.code).to eql(200)
453
+ expect(answer.status).to eql('completed')
454
+ expect(File.exist?(answer.file)).to be_truthy
455
+ end
456
+ }
457
+ end
458
+
459
+ describe 'convert local to local markdown to image' do
460
+
461
+ %w[jpeg jpg bmp png tiff tif gif].each { |ext|
462
+ it "Convert markdown to " + ext do
463
+
464
+ dst = dst_dir + 'locToLocMDImg.' + ext
465
+ answer = @html_api.convert_local_to_local(src, dst)
466
+
467
+ expect(answer.code).to eql(200)
468
+ expect(answer.status).to eql('completed')
469
+ expect(File.exist?(answer.file)).to be_truthy
470
+ end
471
+ }
472
+ end
473
+
474
+ describe 'convert local to local markdown to image with options' do
475
+
476
+ opts = {
477
+ width: 800,
478
+ height: 1000,
479
+ left_margin: 30,
480
+ right_margin: 30,
481
+ top_margin: 50,
482
+ bottom_margin: 50
483
+ }
484
+
485
+ %w[jpeg jpg bmp png tiff tif gif].each { |ext|
486
+ it "Convert markdown to " + ext do
487
+
488
+ dst = dst_dir + 'locToLocMDImgOpt.' + ext
489
+ answer = @html_api.convert_local_to_local(src, dst, opts)
490
+
491
+ expect(answer.code).to eql(200)
492
+ expect(answer.status).to eql('completed')
493
+ expect(File.exist?(answer.file)).to be_truthy
494
+ end
495
+ }
496
+ end
497
+ end
498
+
499
+ describe 'convert MHTML local to local' do
500
+
501
+ src = File.realpath(__dir__ + '/../../testdata') + '/fileformatinfo.mht'
502
+ dst_dir = File.realpath(__dir__ + '/../../testresult') + '/'
503
+
504
+ describe 'convert local to local MHTML to doc' do
505
+
506
+ %w[pdf xps docx].each { |ext|
507
+ it "Convert MHTML to " + ext do
508
+
509
+ dst = dst_dir + 'locToLocDocMHTML.' + ext
510
+ answer = @html_api.convert_local_to_local(src, dst)
511
+
512
+ expect(answer.code).to eql(200)
513
+ expect(answer.status).to eql('completed')
514
+ expect(File.exist?(answer.file)).to be_truthy
515
+ end
516
+ }
517
+ end
518
+
519
+ describe 'convert local to local MHTML to doc with options' do
520
+
521
+ %w[pdf xps docx].each { |ext|
522
+ it "Convert MHTML to " + ext do
523
+
524
+ options_A4 = {
525
+ width: 8.3,
526
+ height: 11.7,
527
+ top_margin: 0.5,
528
+ bottom_margin: 0.5,
529
+ left_margin: 0.5,
530
+ right_margin: 0.5
531
+ }
532
+
533
+ dst = dst_dir + 'locToLocDocMHTMLWithOpts.' + ext
534
+ answer = @html_api.convert_local_to_local(src, dst, options_A4)
535
+
536
+ expect(answer.code).to eql(200)
537
+ expect(answer.status).to eql('completed')
538
+ expect(File.exist?(answer.file)).to be_truthy
539
+ end
540
+ }
541
+ end
542
+
543
+ describe 'convert local to local MHTML to image' do
544
+
545
+ %w[jpeg jpg bmp png tiff tif gif].each { |ext|
546
+ it "Convert MHTML to " + ext do
547
+
548
+ dst = dst_dir + 'locToLocMHTMLImg.' + ext
549
+ answer = @html_api.convert_local_to_local(src, dst)
550
+
551
+ expect(answer.code).to eql(200)
552
+ expect(answer.status).to eql('completed')
553
+ expect(File.exist?(answer.file)).to be_truthy
554
+ end
555
+ }
556
+ end
557
+
558
+ describe 'convert local to local MHTML to image with options' do
559
+
560
+ opts = {
561
+ width: 800,
562
+ height: 1000,
563
+ left_margin: 30,
564
+ right_margin: 30,
565
+ top_margin: 50,
566
+ bottom_margin: 50
567
+ }
568
+
569
+ %w[jpeg jpg bmp png tiff tif gif].each { |ext|
570
+ it "Convert MHTML to " + ext do
571
+
572
+ dst = dst_dir + 'locToLocMHTMLImgOpt.' + ext
573
+ answer = @html_api.convert_local_to_local(src, dst, opts)
574
+
575
+ expect(answer.code).to eql(200)
576
+ expect(answer.status).to eql('completed')
577
+ expect(File.exist?(answer.file)).to be_truthy
578
+ end
579
+ }
580
+ end
581
+ end
414
582
  end
data/spec/spec_helper.rb CHANGED
@@ -30,10 +30,14 @@
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",
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",
37
41
  "debug": true
38
42
  }
39
43
  # 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.10.1
4
+ version: 22.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Makogon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-11 00:00:00.000000000 Z
11
+ date: 2022-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus