aspose_pdf_cloud 24.2.0 → 24.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -17
- data/lib/aspose_pdf_cloud/api/pdf_api.rb +9 -1
- data/lib/aspose_pdf_cloud/api_client.rb +10 -4
- data/lib/aspose_pdf_cloud/configuration.rb +11 -1
- data/lib/aspose_pdf_cloud/version.rb +1 -1
- data/test/pdf_tests.rb +5 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72550435cc5247c3a9be9980953afe79c9844492616effa1f23c5ccb43ab8e2d
|
4
|
+
data.tar.gz: 5d33e3c6b50170668dcf8e8e650e632dbd3e32de63c1a7e530a58e4702277cca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9790d12976b80d8dbb7d50288a0b202eb0e1faa1655ccc46b6ddbeaf3859a6f31c5416542958bf4337191f9048934709e1c8f8ee1d2fefdac658240cdaa5c8ee
|
7
|
+
data.tar.gz: 7fe1cf52b771e8954d5840704ad1ff3abfc059f9e6590bab2e8dd2d16a8db3e88afb4c2da89aa376600d04ea6bc0fab000bc3b8b103607fa84f8334adb4e4b23
|
data/README.md
CHANGED
@@ -29,8 +29,7 @@ XLS, XLSX, PPTX, DOC, DOCX, MobiXML, JPEG, EMF, PNG, BMP, GIF, TIFF, Text
|
|
29
29
|
## Read PDF Formats
|
30
30
|
MHT, PCL, PS, XSLFO, MD
|
31
31
|
|
32
|
-
## Enhancements in Version 24.
|
33
|
-
- Memory leak when converting PDF to DOCX.
|
32
|
+
## Enhancements in Version 24.3
|
34
33
|
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .NET.
|
35
34
|
|
36
35
|
## Installation
|
@@ -46,15 +45,15 @@ gem build aspose_pdf_cloud.gemspec
|
|
46
45
|
Then either install the gem locally:
|
47
46
|
|
48
47
|
```shell
|
49
|
-
gem install ./aspose_pdf_cloud-24.
|
48
|
+
gem install ./aspose_pdf_cloud-24.3.0.gem
|
50
49
|
```
|
51
|
-
(for development, run `gem install --dev ./aspose_pdf_cloud-24.
|
50
|
+
(for development, run `gem install --dev ./aspose_pdf_cloud-24.3.0.gem` to install the development dependencies)
|
52
51
|
|
53
52
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
54
53
|
|
55
54
|
Finally add this to the Gemfile:
|
56
55
|
|
57
|
-
gem 'aspose_pdf_cloud', '~> 24.
|
56
|
+
gem 'aspose_pdf_cloud', '~> 24.3.0'
|
58
57
|
|
59
58
|
### Install from Git
|
60
59
|
|
@@ -67,19 +66,19 @@ Add the following in the Gemfile:
|
|
67
66
|
|
68
67
|
```ruby
|
69
68
|
# Get your ClientId and ClientSecret from https://dashboard.aspose.cloud (free registration required).
|
69
|
+
@pdf_api = PdfApi.new('MY_CLIENT_ID', 'MY_CLIENT_SECRET')
|
70
|
+
file_name = 'PdfWithAnnotations.pdf'
|
71
|
+
page_number = 2
|
72
|
+
opts = {
|
73
|
+
:folder => 'tempFolder'
|
74
|
+
}
|
75
|
+
response = @pdf_api.get_page_annotations(file_name, page_number, opts)
|
76
|
+
```
|
70
77
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
file_name = 'PdfWithAnnotations.pdf'
|
77
|
-
page_number = 2
|
78
|
-
opts = {
|
79
|
-
:folder => 'tempFolder'
|
80
|
-
}
|
81
|
-
|
82
|
-
response = @pdf_api.get_page_annotations(file_name, page_number, opts)
|
78
|
+
## SelfHost Aspose.PDF Cloud
|
79
|
+
Create **PdfApi** object without **app_key** and **app_sid** parameters, but with **host** parameter set to *url of SelfHost Aspose.PDF Cloud* and **self_host** parameter set to *true*:
|
80
|
+
```ruby
|
81
|
+
@pdf_api = PdfApi.new('', '', 'MY_SELFHOST_URL', true)
|
83
82
|
```
|
84
83
|
|
85
84
|
## Unit Tests
|
@@ -25,10 +25,18 @@ module AsposePdfCloud
|
|
25
25
|
class PdfApi
|
26
26
|
attr_accessor :api_client
|
27
27
|
|
28
|
-
def initialize(app_key, app_sid, api_client = ApiClient.default)
|
28
|
+
def initialize(app_key, app_sid, host = "", self_host = false, api_client = ApiClient.default)
|
29
29
|
@api_client = api_client
|
30
|
+
@api_client.config.self_host = self_host
|
30
31
|
@api_client.config.app_key = app_key
|
31
32
|
@api_client.config.app_sid = app_sid
|
33
|
+
if host != ""
|
34
|
+
if @api_client.config.self_host
|
35
|
+
@api_client.config.self_host_url = host
|
36
|
+
else
|
37
|
+
@api_client.config.host = host
|
38
|
+
end
|
39
|
+
end
|
32
40
|
end
|
33
41
|
|
34
42
|
|
@@ -107,7 +107,9 @@ module AsposePdfCloud
|
|
107
107
|
form_params = opts[:form_params] || {}
|
108
108
|
body = opts[:body] || {}
|
109
109
|
|
110
|
-
|
110
|
+
if !@config.self_host
|
111
|
+
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
112
|
+
end
|
111
113
|
|
112
114
|
req_opts = {
|
113
115
|
:method => http_method,
|
@@ -124,11 +126,12 @@ module AsposePdfCloud
|
|
124
126
|
end
|
125
127
|
end
|
126
128
|
|
127
|
-
# OAuth 2.0
|
128
129
|
req_opts[:params] = opts[:query_params]
|
129
130
|
|
130
|
-
|
131
|
-
|
131
|
+
if !@config.self_host
|
132
|
+
# OAuth 2.0
|
133
|
+
add_o_auth_token(req_opts)
|
134
|
+
end
|
132
135
|
|
133
136
|
conn = Faraday.new url, {:params => query_params, :headers => header_params} do |f|
|
134
137
|
f.request :multipart
|
@@ -411,6 +414,9 @@ module AsposePdfCloud
|
|
411
414
|
|
412
415
|
# Request access and refresh tokens if needed
|
413
416
|
def request_token_if_needed
|
417
|
+
if @config.self_host
|
418
|
+
return
|
419
|
+
end
|
414
420
|
# check token exists
|
415
421
|
if @config.access_token
|
416
422
|
return
|
@@ -24,6 +24,12 @@ require 'uri'
|
|
24
24
|
module AsposePdfCloud
|
25
25
|
class Configuration
|
26
26
|
|
27
|
+
# SelfHost
|
28
|
+
attr_accessor :self_host
|
29
|
+
|
30
|
+
# SelfHost URL
|
31
|
+
attr_accessor :self_host_url
|
32
|
+
|
27
33
|
# App Key
|
28
34
|
attr_accessor :app_key
|
29
35
|
|
@@ -152,7 +158,11 @@ module AsposePdfCloud
|
|
152
158
|
end
|
153
159
|
|
154
160
|
def base_url
|
155
|
-
|
161
|
+
if @self_host
|
162
|
+
url = self_host_url
|
163
|
+
else
|
164
|
+
url = "#{scheme}://#{[host, '/v3.0'].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
165
|
+
end
|
156
166
|
URI.encode(url)
|
157
167
|
end
|
158
168
|
|
data/test/pdf_tests.rb
CHANGED
@@ -32,10 +32,13 @@ class PdfTests < Minitest::Test
|
|
32
32
|
def setup
|
33
33
|
servercreds_json = File.read('../../../Settings/servercreds.json')
|
34
34
|
creds = JSON.parse(servercreds_json)
|
35
|
-
|
35
|
+
self_host = creds.has_key?("SelfHost") ? creds["SelfHost"] : false
|
36
|
+
app_key = creds.has_key?("AppKey") ? creds["AppKey"] : ""
|
37
|
+
app_sid = creds.has_key?("AppSID") ? creds["AppSID"] : ""
|
38
|
+
product_uri = creds.has_key?("ProductUri") ? creds["ProductUri"] : ""
|
39
|
+
@pdf_api = PdfApi.new(app_key, app_sid, product_uri, self_host)
|
36
40
|
@temp_folder = 'TempPdfCloud'
|
37
41
|
@test_data_folder = '../test_data/'
|
38
|
-
|
39
42
|
config = @pdf_api.api_client.config
|
40
43
|
config.scheme = 'https'
|
41
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aspose_pdf_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 24.
|
4
|
+
version: 24.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aspose PDF Cloud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|