gotenberg-client 0.1.1.3 → 0.1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +0 -2
- data/Gemfile.lock +4 -4
- data/README.md +9 -4
- data/gotenberg.gemspec +2 -1
- data/lib/gotenberg/version.rb +1 -1
- data/lib/gotenberg.rb +16 -4
- metadata +31 -6
- data/gotenberg-0.1.0.gem +0 -0
- data/gotenberg-0.1.1.1.gem +0 -0
- data/gotenberg-0.1.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7635c8ce9db27c8f016e8ca28339297a9b6bd712ea64c4b1248fa6238110115e
|
4
|
+
data.tar.gz: e1b99349e9a8f301d10a4217e66ccbac5e61e1339e8e6d35f5dd70ec6691863a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5bf6145bf1afd519b22a87963301a118771ddaa4ceff0607fcbdcc64021f6446205a3cf349a67d053550d239e750793aa961a2da79c1e60b0585b9405927277
|
7
|
+
data.tar.gz: ee10527bbd316e83539a3cbb0014216bac678d25fffd6f36cce66c391ff8da6bab960dedeb0d2541ca1b1fcd0e236b80a9398f63b048203c2a49f004814e0eee
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gotenberg (0.1.
|
4
|
+
gotenberg-client (0.1.1.4)
|
5
|
+
faraday (~> 2.5.2)
|
6
|
+
faraday-multipart (~> 1.0.4)
|
5
7
|
|
6
8
|
GEM
|
7
9
|
remote: https://rubygems.org/
|
@@ -34,9 +36,7 @@ PLATFORMS
|
|
34
36
|
x86_64-linux
|
35
37
|
|
36
38
|
DEPENDENCIES
|
37
|
-
|
38
|
-
faraday-multipart
|
39
|
-
gotenberg!
|
39
|
+
gotenberg-client!
|
40
40
|
rake (~> 13.0)
|
41
41
|
rspec (~> 3.0)
|
42
42
|
|
data/README.md
CHANGED
@@ -8,10 +8,15 @@ this gem is young and needs a lot of updates and improvements. (work in progress
|
|
8
8
|
## install
|
9
9
|
First download and run gotenberg
|
10
10
|
|
11
|
-
|
11
|
+
```
|
12
|
+
docker run --rm -p 3000:3000 gotenberg/gotenberg:7
|
13
|
+
```
|
12
14
|
|
13
15
|
install gotenberg-client gem
|
14
|
-
|
16
|
+
|
17
|
+
```
|
18
|
+
gem install gotenberg-client
|
19
|
+
```
|
15
20
|
|
16
21
|
or add gotenberg-client to your gemfile
|
17
22
|
|
@@ -19,7 +24,7 @@ or add gotenberg-client to your gemfile
|
|
19
24
|
you will probably use this gem in order to generate pdf in a ruby on rails background task / ruby file. Therefore, this gem do not (yet) integrate any Ruby on Rails tools.
|
20
25
|
|
21
26
|
```ruby
|
22
|
-
require "gotenberg
|
27
|
+
require "gotenberg"
|
23
28
|
|
24
29
|
api_endpoint = "http://localhost:3000" # change it with your specific port and address.
|
25
30
|
gb = Gotenberg::Client.new(api_endpoint)
|
@@ -38,7 +43,7 @@ output_pdf.unlink
|
|
38
43
|
```
|
39
44
|
|
40
45
|
if you want to use rails views, the easiest way is to user "render_to_string" from `ActionController::Base`.
|
41
|
-
Let's
|
46
|
+
Let's imagine that you have a /app/views/test.html.erb in your project that use @customer variable.
|
42
47
|
|
43
48
|
```ruby
|
44
49
|
gb = Gotenberg::Client.new(api_endpoint)
|
data/gotenberg.gemspec
CHANGED
@@ -30,7 +30,8 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
32
|
# Uncomment to register a new dependency of your gem
|
33
|
-
|
33
|
+
spec.add_dependency "faraday"
|
34
|
+
spec.add_dependency "faraday-multipart"
|
34
35
|
|
35
36
|
# For more information and examples about making a new gem, checkout our
|
36
37
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/lib/gotenberg/version.rb
CHANGED
data/lib/gotenberg.rb
CHANGED
@@ -12,6 +12,14 @@ require_relative "gotenberg/version"
|
|
12
12
|
module Gotenberg
|
13
13
|
class Error < StandardError; end
|
14
14
|
# Your code goes here...
|
15
|
+
|
16
|
+
class Assets
|
17
|
+
def self.include_css(file)
|
18
|
+
raise "Not in Rails project" unless !Rails.nil?
|
19
|
+
abs_path = Rails.root.join('public', 'stylesheets',file)
|
20
|
+
return "<style type='text/css'>#{File.read(abs_path)}</style>".html_safe
|
21
|
+
end
|
22
|
+
end
|
15
23
|
class Client
|
16
24
|
def initialize(api_url)
|
17
25
|
@api_url = api_url
|
@@ -42,13 +50,17 @@ module Gotenberg
|
|
42
50
|
)
|
43
51
|
}
|
44
52
|
url= "#{@api_url}/forms/chromium/convert/html"
|
53
|
+
begin
|
54
|
+
conn = Faraday.new(url) do |f|
|
55
|
+
f.request :multipart, flat_encode: true
|
56
|
+
f.adapter :net_http
|
57
|
+
end
|
58
|
+
response = conn.post(url, payload)
|
45
59
|
|
46
|
-
|
47
|
-
|
48
|
-
f.adapter :net_http
|
60
|
+
rescue StandardError => e
|
61
|
+
response=""
|
49
62
|
end
|
50
63
|
|
51
|
-
response = conn.post(url, payload)
|
52
64
|
ind_html.close
|
53
65
|
ind_html.unlink
|
54
66
|
output.write(response.body.force_encoding("utf-8"))
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gotenberg-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.1.
|
4
|
+
version: 0.1.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jean-christophe bauduin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
12
|
-
dependencies:
|
11
|
+
date: 2022-08-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday-multipart
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
description: make the creation of pdf easy in ruby
|
14
42
|
email:
|
15
43
|
- maildejc@hotmail.be
|
@@ -27,9 +55,6 @@ files:
|
|
27
55
|
- Rakefile
|
28
56
|
- bin/console
|
29
57
|
- bin/setup
|
30
|
-
- gotenberg-0.1.0.gem
|
31
|
-
- gotenberg-0.1.1.1.gem
|
32
|
-
- gotenberg-0.1.1.gem
|
33
58
|
- gotenberg.gemspec
|
34
59
|
- lib/gotenberg.rb
|
35
60
|
- lib/gotenberg/version.rb
|
data/gotenberg-0.1.0.gem
DELETED
Binary file
|
data/gotenberg-0.1.1.1.gem
DELETED
Binary file
|
data/gotenberg-0.1.1.gem
DELETED
Binary file
|