Skip to content

Commit 18b5c05

Browse files
cumulative: add Downloader, convert to Markdown, MHTML
1 parent 1ce148f commit 18b5c05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+12125
-849
lines changed

.rspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--color
2+
--require spec_helper

Gemfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
source 'https://rubygems.org'
2+
3+
gemspec
4+
5+
group :development, :test do
6+
gem 'rake', '~> 12.0.0'
7+
8+
# Checks ruby code grammar
9+
gem 'rubocop', require: false
10+
# With rspec
11+
gem 'rubocop-rspec'
12+
end

Gemfile.lock

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
PATH
2+
remote: .
3+
specs:
4+
aspose_html (1.0.0)
5+
json (~> 2.1, >= 2.1.0)
6+
typhoeus (~> 1.0, >= 1.0.1)
7+
8+
GEM
9+
remote: https://rubygems.org/
10+
specs:
11+
ZenTest (4.11.1)
12+
addressable (2.5.2)
13+
public_suffix (>= 2.0.2, < 4.0)
14+
ast (2.4.0)
15+
autotest (4.4.6)
16+
ZenTest (>= 4.4.1)
17+
autotest-fsevent (0.2.13)
18+
sys-uname
19+
autotest-growl (0.2.16)
20+
autotest-rails-pure (4.1.2)
21+
crack (0.4.3)
22+
safe_yaml (~> 1.0.0)
23+
diff-lcs (1.3)
24+
ethon (0.11.0)
25+
ffi (>= 1.3.0)
26+
faraday (0.14.0)
27+
multipart-post (>= 1.2, < 3)
28+
ffi (1.9.23-x64-mingw32)
29+
hashdiff (0.3.7)
30+
json (2.1.0)
31+
mimemagic (0.3.2)
32+
multipart-post (2.0.0)
33+
parallel (1.12.1)
34+
parser (2.5.1.0)
35+
ast (~> 2.4.0)
36+
powerpack (0.1.1)
37+
public_suffix (3.0.2)
38+
rainbow (3.0.0)
39+
rake (12.0.0)
40+
rspec (3.7.0)
41+
rspec-core (~> 3.7.0)
42+
rspec-expectations (~> 3.7.0)
43+
rspec-mocks (~> 3.7.0)
44+
rspec-core (3.7.1)
45+
rspec-support (~> 3.7.0)
46+
rspec-expectations (3.7.0)
47+
diff-lcs (>= 1.2.0, < 2.0)
48+
rspec-support (~> 3.7.0)
49+
rspec-mocks (3.7.0)
50+
diff-lcs (>= 1.2.0, < 2.0)
51+
rspec-support (~> 3.7.0)
52+
rspec-support (3.7.1)
53+
rubocop (0.56.0)
54+
parallel (~> 1.10)
55+
parser (>= 2.5)
56+
powerpack (~> 0.1)
57+
rainbow (>= 2.2.2, < 4.0)
58+
ruby-progressbar (~> 1.7)
59+
unicode-display_width (~> 1.0, >= 1.0.1)
60+
rubocop-rspec (1.25.1)
61+
rubocop (>= 0.53.0)
62+
ruby-progressbar (1.9.0)
63+
safe_yaml (1.0.4)
64+
sys-uname (1.0.3)
65+
ffi (>= 1.0.0)
66+
typhoeus (1.3.0)
67+
ethon (>= 0.9.0)
68+
unicode-display_width (1.3.2)
69+
vcr (3.0.3)
70+
webmock (1.24.6)
71+
addressable (>= 2.3.6)
72+
crack (>= 0.3.2)
73+
hashdiff
74+
75+
PLATFORMS
76+
x64-mingw32
77+
78+
DEPENDENCIES
79+
aspose_html!
80+
autotest (~> 4.4, >= 4.4.6)
81+
autotest-fsevent (~> 0.2, >= 0.2.12)
82+
autotest-growl (~> 0.2, >= 0.2.16)
83+
autotest-rails-pure (~> 4.1, >= 4.1.2)
84+
rake (~> 12.0.0)
85+
rspec (~> 3.6, >= 3.6.0)
86+
rubocop
87+
rubocop-rspec
88+
vcr (~> 3.0, >= 3.0.1)
89+
webmock (~> 1.24, >= 1.24.3)
90+
91+
BUNDLED WITH
92+
1.16.1

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@ Class | Method | HTTP request | Description
218218
*Asposehtmlcloud.ConversionApi* | [**PutConvertDocumentToImage**](docs/ConversionApi.md#PutConvertDocumentToImage) | **PUT** /html/{name}/convert/image/{outFormat} | Converts the HTML document (located on storage) to the specified image format and uploads resulting file to storage.
219219
*Asposehtmlcloud.ConversionApi* | [**PutConvertDocumentToPdf**](docs/ConversionApi.md#PutConvertDocumentToPdf) | **PUT** /html/{name}/convert/pdf | Converts the HTML document (located on storage) to PDF and uploads resulting file to storage.
220220
*Asposehtmlcloud.ConversionApi* | [**PutConvertDocumentToXps**](docs/ConversionApi.md#PutConvertDocumentToXps) | **PUT** /html/{name}/convert/xps | Converts the HTML document (located on storage) to XPS and uploads resulting file to storage.
221+
*Asposehtmlcloud.ConversionApi* | [**GetConvertDocumentToMHTMLByUrl**](docs/ConversionApi.md#GetConvertDocumentToMHTMLByUrl) | **GET** /html/convert/mhtml | Converts the HTML page from Web by its URL to MHTML returns resulting file in response content.
222+
*Asposehtmlcloud.ConversionApi* | [**GetConvertDocumentToMarkdown**](docs/ConversionApi.md#GetConvertDocumentToMarkdown) | **GET** /html/{name}/convert/md | Converts the HTML document (located on storage) to Markdown and returns resulting file in response content.
223+
*Asposehtmlcloud.ConversionApi* | [**PutConvertDocumentInRequestToMarkdown**](docs/ConversionApi.md#PutConvertDocumentInRequestToMarkdown) | **PUT** /html/convert/md | Converts the HTML document (in request content) to Markdown and uploads resulting file to storage by specified path.
224+
*Asposehtmlcloud.ConversionApi* | [**PutConvertDocumentToMarkdown**](docs/ConversionApi.md#PutConvertDocumentToMarkdown) | **PUT** /html/{name}/convert/md | Converts the HTML document (located on storage) to Markdown and uploads resulting file to storage by specified path.
225+
*Asposehtmlcloud.DocumentApi* | [**GetDocumentByUrl**](docs/DocumentApi.md#GetDocumentByUrl) | **GET** /html/download | Return all HTML page with linked resources packaged as a ZIP archive by the source page URL.
221226
*Asposehtmlcloud.DocumentApi* | [**GetDocumentFragmentByXPath**](docs/DocumentApi.md#GetDocumentFragmentByXPath) | **GET** /html/{name}/fragments/{outFormat} | Return list of HTML fragments matching the specified XPath query.
222227
*Asposehtmlcloud.DocumentApi* | [**GetDocumentFragmentByXPathByUrl**](docs/DocumentApi.md#GetDocumentFragmentByXPathByUrl) | **GET** /html/fragments/{outFormat} | Return list of HTML fragments matching the specified XPath query by the source page URL.
223228
*Asposehtmlcloud.DocumentApi* | [**GetDocumentFragmentsByCSSSelector**](docs/DocumentApi.md#GetDocumentFragmentsByCSSSelector) | **GET** /html/{name}/fragments/css/{outFormat} | Return list of HTML fragments matching the specified CSS selector.

Rakefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
begin
2+
require 'rspec/core/rake_task'
3+
4+
RSpec::Core::RakeTask.new(:spec)
5+
task default: :spec
6+
rescue LoadError
7+
# no rspec available
8+
end

aspose_html.gemspec

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
=begin
3+
--------------------------------------------------------------------------------------------------------------------
4+
<copyright company="Aspose" file="aspose_html.gemspec">
5+
</copyright>
6+
Copyright (c) 2018 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+
$:.push File.expand_path("../lib", __FILE__)
30+
require "aspose_html/version"
31+
32+
Gem::Specification.new do |s|
33+
s.name = "aspose_html"
34+
s.version = AsposeHtml::VERSION
35+
s.platform = Gem::Platform::RUBY
36+
s.authors = "Aspose"
37+
s.homepage = "https://www.aspose.com"
38+
s.summary = "A ruby wrapper for the Aspose.HTML Cloud SDK API."
39+
s.description = "This repository contains Aspose.HTML Cloud SDK for ruby source code."
40+
s.license = "MIT"
41+
s.required_ruby_version = ">= 1.9"
42+
43+
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
44+
s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
45+
46+
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
47+
s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
48+
s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
49+
s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
50+
s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
51+
s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
52+
s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
53+
54+
s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? }
55+
s.test_files = `find spec/*`.split("\n")
56+
s.executables = []
57+
s.require_paths = ["lib"]
58+
end

docs/ConversionApi.md

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Method | HTTP request | Description
1616
[**PutConvertDocumentToImage**](ConversionApi.md#PutConvertDocumentToImage) | **PUT** /html/{name}/convert/image/{outFormat} | Converts the HTML document (located on storage) to the specified image format and uploads resulting file to storage.
1717
[**PutConvertDocumentToPdf**](ConversionApi.md#PutConvertDocumentToPdf) | **PUT** /html/{name}/convert/pdf | Converts the HTML document (located on storage) to PDF and uploads resulting file to storage.
1818
[**PutConvertDocumentToXps**](ConversionApi.md#PutConvertDocumentToXps) | **PUT** /html/{name}/convert/xps | Converts the HTML document (located on storage) to XPS and uploads resulting file to storage.
19+
[**GetConvertDocumentToMHTMLByUrl**](ConversionApi.md#GetConvertDocumentToMHTMLByUrl) | **GET** /html/convert/mhtml | Converts the HTML page from Web by its URL to MHTML returns resulting file in response content.
20+
[**GetConvertDocumentToMarkdown**](ConversionApi.md#GetConvertDocumentToMarkdown) | **GET** /html/{name}/convert/md | Converts the HTML document (located on storage) to Markdown and returns resulting file in response content.
21+
[**PutConvertDocumentInRequestToMarkdown**](ConversionApi.md#PutConvertDocumentInRequestToMarkdown) | **PUT** /html/convert/md | Converts the HTML document (in request content) to Markdown and uploads resulting file to storage by specified path.
22+
[**PutConvertDocumentToMarkdown**](ConversionApi.md#PutConvertDocumentToMarkdown) | **PUT** /html/{name}/convert/md | Converts the HTML document (located on storage) to Markdown and uploads resulting file to storage by specified path.
1923

2024

2125
<a name="GetConvertDocumentToImage"></a>
@@ -745,3 +749,193 @@ Name | Type | Description | Notes
745749
- **Content-Type**: application/json
746750
- **Accept**: application/json
747751

752+
753+
754+
<a name="GetConvertDocumentToMHTMLByUrl"></a>
755+
# **GetConvertDocumentToMHTMLByUrl**
756+
> File GetConvertDocumentToMHTMLByUrl(sourceUrl)
757+
758+
Converts the HTML page from Web by its URL to MHTML returns resulting file in response content.
759+
760+
### Example
761+
```javascript
762+
var Asposehtmlcloud = require('asposehtmlcloud');
763+
764+
var apiInstance = new Asposehtmlcloud.ConversionApi();
765+
766+
var sourceUrl = "sourceUrl_example"; // String | Source page URL.
767+
768+
769+
var callback = function(error, data, response) {
770+
if (error) {
771+
console.error(error);
772+
} else {
773+
console.log('API called successfully. Returned data: ' + data);
774+
}
775+
};
776+
apiInstance.GetConvertDocumentToMHTMLByUrl(sourceUrl, callback);
777+
```
778+
779+
### Parameters
780+
781+
Name | Type | Description | Notes
782+
------------- | ------------- | ------------- | -------------
783+
**sourceUrl** | **String**| Source page URL. |
784+
785+
### Return type
786+
787+
**File**
788+
789+
790+
### HTTP request headers
791+
792+
- **Content-Type**: application/json
793+
- **Accept**: multipart/form-data
794+
795+
<a name="GetConvertDocumentToMarkdown"></a>
796+
# **GetConvertDocumentToMarkdown**
797+
> File GetConvertDocumentToMarkdown(name, opts)
798+
799+
Converts the HTML document (located on storage) to Markdown and returns resulting file in response content.
800+
801+
### Example
802+
```javascript
803+
var Asposehtmlcloud = require('asposehtmlcloud');
804+
805+
var apiInstance = new Asposehtmlcloud.ConversionApi();
806+
807+
var name = "name_example"; // String | Document name.
808+
809+
810+
var opts = {
811+
'useGit': false, // Boolean | Use Git Markdown flavor to save.
812+
'folder': "folder_example", // String | Source document folder.
813+
'storage': "storage_example" // String | Source document storage.
814+
};
815+
816+
var callback = function(error, data, response) {
817+
if (error) {
818+
console.error(error);
819+
} else {
820+
console.log('API called successfully. Returned data: ' + data);
821+
}
822+
};
823+
apiInstance.GetConvertDocumentToMarkdown(name, opts, callback);
824+
```
825+
826+
### Parameters
827+
828+
Name | Type | Description | Notes
829+
------------- | ------------- | ------------- | -------------
830+
**name** | **String**| Document name. |
831+
**useGit** | **Boolean**| Use Git Markdown flavor to save. | [optional] [default to false]
832+
**folder** | **String**| Source document folder. | [optional]
833+
**storage** | **String**| Source document storage. | [optional]
834+
835+
### Return type
836+
837+
**Blob**
838+
839+
### HTTP request headers
840+
841+
- **Content-Type**: application/json
842+
- **Accept**: multipart/form-data
843+
844+
845+
<a name="PutConvertDocumentInRequestToMarkdown"></a>
846+
# **PutConvertDocumentInRequestToMarkdown**
847+
> File PutConvertDocumentInRequestToMarkdown(outPath, file, opts)
848+
849+
Converts the HTML document (in request content) to Markdown and uploads resulting file to storage by specified path.
850+
851+
### Example
852+
```javascript
853+
var Asposehtmlcloud = require('asposehtmlcloud');
854+
855+
var apiInstance = new Asposehtmlcloud.ConversionApi();
856+
857+
var outPath = "outPath_example"; // String | Full resulting file path in the storage (ex. /folder1/folder2/result.md)
858+
859+
var file = "/path/to/file.txt"; // File | A file to be converted.
860+
861+
var opts = {
862+
'useGit': false // Boolean | Use Git Markdown flavor to save.
863+
};
864+
865+
var callback = function(error, data, response) {
866+
if (error) {
867+
console.error(error);
868+
} else {
869+
console.log('API called successfully. Returned data: ' + data);
870+
}
871+
};
872+
apiInstance.PutConvertDocumentInRequestToMarkdown(outPath, file, opts, callback);
873+
```
874+
875+
### Parameters
876+
877+
Name | Type | Description | Notes
878+
------------- | ------------- | ------------- | -------------
879+
**outPath** | **String**| Full resulting file path in the storage (ex. /folder1/folder2/result.md) |
880+
**file** | **File**| A file to be converted. |
881+
**useGit** | **Boolean**| Use Git Markdown flavor to save. | [optional] [default to false]
882+
883+
### Return type
884+
885+
**Blob**
886+
887+
### HTTP request headers
888+
889+
- **Content-Type**: multipart/form-data
890+
- **Accept**: application/json
891+
892+
<a name="PutConvertDocumentToMarkdown"></a>
893+
# **PutConvertDocumentToMarkdown**
894+
> File PutConvertDocumentToMarkdown(name, outPath, opts)
895+
896+
Converts the HTML document (located on storage) to Markdown and uploads resulting file to storage by specified path.
897+
898+
### Example
899+
```javascript
900+
var Asposehtmlcloud = require('asposehtmlcloud');
901+
902+
var apiInstance = new Asposehtmlcloud.ConversionApi();
903+
904+
var name = "name_example"; // String | Document name.
905+
906+
var outPath = "outPath_example"; // String | Full resulting file path in the storage (ex. /folder1/folder2/result.md)
907+
908+
var opts = {
909+
'useGit': false, // Boolean | Use Git Markdown flavor to save.
910+
'folder': "folder_example", // String | The source document folder.
911+
'storage': "storage_example" // String | The source and resulting document storage.
912+
};
913+
914+
var callback = function(error, data, response) {
915+
if (error) {
916+
console.error(error);
917+
} else {
918+
console.log('API called successfully. Returned data: ' + data);
919+
}
920+
};
921+
apiInstance.PutConvertDocumentToMarkdown(name, outPath, opts, callback);
922+
```
923+
924+
### Parameters
925+
926+
Name | Type | Description | Notes
927+
------------- | ------------- | ------------- | -------------
928+
**name** | **String**| Document name. |
929+
**outPath** | **String**| Full resulting file path in the storage (ex. /folder1/folder2/result.md) |
930+
**useGit** | **Boolean**| Use Git Markdown flavor to save. | [optional] [default to false]
931+
**folder** | **String**| The source document folder. | [optional]
932+
**storage** | **String**| The source and resulting document storage. | [optional]
933+
934+
### Return type
935+
936+
**Blob**
937+
938+
### HTTP request headers
939+
940+
- **Content-Type**: application/json
941+
- **Accept**: application/json

0 commit comments

Comments
 (0)