pdfmonkey 0.6.0 → 0.8.1

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: 981628ac067f138aaf0a098ddf561f7537b3838df84d1c7b3410583b5e66fa35
4
- data.tar.gz: 168ab9c7819b220d2e26eac8910993d7e62db504ecdae8806d0081962f60754b
3
+ metadata.gz: 843327045d2dbf9a6b334691b4bfe2f7829aa762742e43ff300da4489fe31cd4
4
+ data.tar.gz: 0474d3b3aa3ab6211412530fae2cce07bea0a3c1efcf2160c49385cfe5abd422
5
5
  SHA512:
6
- metadata.gz: 3df5b9ac944318e0e47ba81cbd6aafe865e6eb00117e8646a5ea0f0068808fb24d8f3f6145beb2f7f87d9a3223b3d760f3c7d63dc42c04a5ca7498e24777b358
7
- data.tar.gz: 0aee89379452faa4b588c258d54d7b44fb702c14d2ed6fe2efdb478fbe8dd58b6ce5a167bb93de1704fa49c51fff656e9e68a8f3b87184106c88f207425d9259
6
+ metadata.gz: f1be649b5126163a455569c0790344ff9b35fecfb45689af0591fa0f6de890b662240ae546bd3c5e1d43c44c081b43285ce634bd78b7ea7a02ee01520116ed49
7
+ data.tar.gz: e80f9186f53f1144676084f3c8b88d4e2200f98cb9fb3c8f9d18e7d0a9c00e9aa2f2fd8dc4cd0bbd2df19f213e2ebe96d035f6b524aceeef960067571e45860f
@@ -0,0 +1,23 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ specs:
7
+ name: Run specs with Ruby ${{matrix.ruby}}
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ ruby: ['2.6', '2.7', '3.0', '3.1']
13
+ include:
14
+ - ruby: head
15
+ experimental: true
16
+ steps:
17
+ - uses: actions/checkout@v3
18
+ - uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: ${{matrix.ruby}}
21
+ bundler-cache: true
22
+ - name: Run specs
23
+ run: bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -1,8 +1,17 @@
1
1
  # Changelog
2
2
 
3
- ## HEAD
3
+ ## 0.8.1
4
+
5
+ * Fixing the handling of validation errors to expose errors correctly
6
+
7
+ ## 0.8.0
8
+
9
+ * Adding support for single error responses
10
+
11
+ ## 0.7.0
4
12
 
5
13
  * Updating bundler to v2.2
14
+ * Adding `failure_cause`, `generation_logs` and `public_share_link` to the `Document` class
6
15
 
7
16
  ## 0.6.0
8
17
 
data/Gemfile.lock CHANGED
@@ -1,71 +1,56 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pdfmonkey (0.6.0)
4
+ pdfmonkey (0.8.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.4.0)
10
- coveralls (0.8.22)
11
- json (>= 1.8, < 3)
12
- simplecov (~> 0.16.1)
13
- term-ansicolor (~> 1.3)
14
- thor (~> 0.19.4)
15
- tins (~> 1.6)
16
- diff-lcs (1.3)
17
- docile (1.3.1)
18
- jaro_winkler (1.5.2)
19
- json (2.3.1)
20
- parallel (1.12.1)
21
- parser (2.5.3.0)
22
- ast (~> 2.4.0)
23
- powerpack (0.1.2)
24
- rainbow (3.0.0)
25
- rake (13.0.1)
26
- rspec (3.8.0)
27
- rspec-core (~> 3.8.0)
28
- rspec-expectations (~> 3.8.0)
29
- rspec-mocks (~> 3.8.0)
30
- rspec-core (3.8.0)
31
- rspec-support (~> 3.8.0)
32
- rspec-expectations (3.8.2)
9
+ ast (2.4.2)
10
+ diff-lcs (1.5.0)
11
+ parallel (1.22.0)
12
+ parser (3.1.1.0)
13
+ ast (~> 2.4.1)
14
+ rainbow (3.1.1)
15
+ rake (13.0.6)
16
+ regexp_parser (2.2.1)
17
+ rexml (3.2.5)
18
+ rspec (3.11.0)
19
+ rspec-core (~> 3.11.0)
20
+ rspec-expectations (~> 3.11.0)
21
+ rspec-mocks (~> 3.11.0)
22
+ rspec-core (3.11.0)
23
+ rspec-support (~> 3.11.0)
24
+ rspec-expectations (3.11.0)
33
25
  diff-lcs (>= 1.2.0, < 2.0)
34
- rspec-support (~> 3.8.0)
35
- rspec-mocks (3.8.0)
26
+ rspec-support (~> 3.11.0)
27
+ rspec-mocks (3.11.0)
36
28
  diff-lcs (>= 1.2.0, < 2.0)
37
- rspec-support (~> 3.8.0)
38
- rspec-support (3.8.0)
39
- rubocop (0.60.0)
40
- jaro_winkler (~> 1.5.1)
29
+ rspec-support (~> 3.11.0)
30
+ rspec-support (3.11.0)
31
+ rubocop (1.26.0)
41
32
  parallel (~> 1.10)
42
- parser (>= 2.5, != 2.5.1.1)
43
- powerpack (~> 0.1)
33
+ parser (>= 3.1.0.0)
44
34
  rainbow (>= 2.2.2, < 4.0)
35
+ regexp_parser (>= 1.8, < 3.0)
36
+ rexml
37
+ rubocop-ast (>= 1.16.0, < 2.0)
45
38
  ruby-progressbar (~> 1.7)
46
- unicode-display_width (~> 1.4.0)
47
- ruby-progressbar (1.10.0)
48
- simplecov (0.16.1)
49
- docile (~> 1.1)
50
- json (>= 1.8, < 3)
51
- simplecov-html (~> 0.10.0)
52
- simplecov-html (0.10.2)
53
- term-ansicolor (1.7.0)
54
- tins (~> 1.0)
55
- thor (0.19.4)
56
- tins (1.20.2)
57
- unicode-display_width (1.4.1)
39
+ unicode-display_width (>= 1.4.0, < 3.0)
40
+ rubocop-ast (1.16.0)
41
+ parser (>= 3.1.1.0)
42
+ ruby-progressbar (1.11.0)
43
+ unicode-display_width (2.1.0)
58
44
 
59
45
  PLATFORMS
60
46
  ruby
61
47
 
62
48
  DEPENDENCIES
63
49
  bundler (~> 2.2)
64
- coveralls (~> 0.8)
65
50
  pdfmonkey!
66
51
  rake (~> 13.0)
67
52
  rspec (~> 3.8)
68
- rubocop (~> 0.60.0)
53
+ rubocop (~> 1.26)
69
54
 
70
55
  BUNDLED WITH
71
56
  2.2.30
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # PDFMonkey
2
2
 
3
- [![Build Status](https://travis-ci.com/pdfmonkey/pdfmonkey-ruby.svg?branch=master)](https://travis-ci.com/pdfmonkey/pdfmonkey-ruby)
4
- [![Coverage Status](https://coveralls.io/repos/github/pdfmonkey/pdfmonkey-ruby/badge.svg?branch=master)](https://coveralls.io/github/pdfmonkey/pdfmonkey-ruby?branch=master)
3
+ [![CI](https://github.com/pdfmonkey/pdfmonkey-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/pdfmonkey/pdfmonkey-ruby/actions/workflows/ci.yml)
5
4
 
6
5
  This gem is the quickest way to use the [PDFMonkey](https://www.pdfmonkey.io) API.
7
6
 
@@ -59,7 +58,7 @@ document.status # => 'success'
59
58
  document.download_url # => 'https://…'
60
59
  ```
61
60
 
62
- :warning: The download URL of a document is only valid **for 30 seconds**. Passed this delay, reload the document to obtain a new one:
61
+ :warning: The download URL of a document is only valid **for 1 hour**. Passed this delay, reload the document to obtain a new one:
63
62
 
64
63
  ```ruby
65
64
  document.reload!
@@ -141,6 +140,12 @@ document = Pdfmonkey::Document.generate(template_id, data)
141
140
  document.status # => 'error'
142
141
  document.errors # => ["Document template must exist"]
143
142
 
143
+ # If your quota is depleted
144
+ document = Pdfmonkey::Document.generate(template_id, data)
145
+
146
+ document.status # => 'error'
147
+ document.errors # => { "status" => ["You’ve reached your quota for th..."] }
148
+
144
149
  # If the network is down
145
150
  document = Pdfmonkey::Document.generate(template_id, data)
146
151
 
@@ -41,7 +41,14 @@ module Pdfmonkey
41
41
 
42
42
  private def extract_errors(response)
43
43
  payload = JSON.parse(response.body)
44
- errors = payload['errors'].to_a.map { |error| error['detail'] }
44
+ errors =
45
+ if payload['error']
46
+ [payload['error']]
47
+ elsif payload['errors'].is_a?(Array)
48
+ payload['errors'].map { |error| error['detail'] }
49
+ elsif payload['errors'].is_a?(Hash)
50
+ payload['errors']
51
+ end
45
52
 
46
53
  { errors: errors, status: 'error' }
47
54
  end
@@ -15,11 +15,14 @@ module Pdfmonkey
15
15
  document_template_id
16
16
  download_url
17
17
  errors
18
+ failure_cause
18
19
  filename
20
+ generation_logs
19
21
  id
20
22
  meta
21
23
  payload
22
24
  preview_url
25
+ public_share_link
23
26
  status
24
27
  updated_at
25
28
  ].freeze
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pdfmonkey
4
- VERSION = '0.6.0'
4
+ VERSION = '0.8.1'
5
5
  end
data/pdfmonkey.gemspec CHANGED
@@ -23,8 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ['lib']
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 2.2'
26
- spec.add_development_dependency 'coveralls', '~> 0.8'
27
26
  spec.add_development_dependency 'rake', '~> 13.0'
28
27
  spec.add_development_dependency 'rspec', '~> 3.8'
29
- spec.add_development_dependency 'rubocop', '~> 0.60.0'
28
+ spec.add_development_dependency 'rubocop', '~> 1.26'
30
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdfmonkey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Courtois
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-30 00:00:00.000000000 Z
11
+ date: 2022-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.2'
27
- - !ruby/object:Gem::Dependency
28
- name: coveralls
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '0.8'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '0.8'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rake
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +58,14 @@ dependencies:
72
58
  requirements:
73
59
  - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: 0.60.0
61
+ version: '1.26'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: 0.60.0
68
+ version: '1.26'
83
69
  description: Generate awesome PDF with web technologies at pdfmonkey.io
84
70
  email:
85
71
  - scourtois_github@cubyx.fr
@@ -87,10 +73,10 @@ executables: []
87
73
  extensions: []
88
74
  extra_rdoc_files: []
89
75
  files:
76
+ - ".github/workflows/ci.yml"
90
77
  - ".gitignore"
91
78
  - ".rspec"
92
79
  - ".rubocop.yml"
93
- - ".travis.yml"
94
80
  - CHANGELOG.md
95
81
  - CODE_OF_CONDUCT.md
96
82
  - Gemfile
@@ -125,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
111
  - !ruby/object:Gem::Version
126
112
  version: '0'
127
113
  requirements: []
128
- rubygems_version: 3.0.3
114
+ rubygems_version: 3.2.22
129
115
  signing_key:
130
116
  specification_version: 4
131
117
  summary: Connect to the PDFMonkey API
data/.travis.yml DELETED
@@ -1,23 +0,0 @@
1
- language: ruby
2
-
3
- before_install: gem install bundler --version '~> 1.17'
4
- cache: bundler
5
- dist: bionic
6
-
7
- matrix:
8
- allow_failures:
9
- - rvm: ruby-head
10
- - rvm: jruby-head
11
- fast_finish: true
12
-
13
- notifications:
14
- email: false
15
- slack:
16
- secure: YimzUcOW2fIo+CyYB5sBgUydS49JNtTIEowyinPAfDifAYgRNx/8c5kPk0aLk8klbnNBd8pMene/i4MIfApRuUmzAkGLe/1CCbotGn7zN7R6S46tpkGaHyMya5leiQemT6gIeL5+J4mQwDcTppXYh9kNTSYKh6RNLJxS7XUZZrNqOK6R2e/hX71aqUJTA5laSQ5mR5Hvyl9kUaJW5b77myXiU6VdrHmCl3sZ9hMqe6mroyBbVOAf1eFQMo7QX9HuLTUHJA2KIpnA7cLEXLINtnKjkhRVR0hcuGMETJhrJI/Ylqi1kf3PRPqkD/Q9msBo01OcRSoGwTjQ2IS1gOcYDowgvpJhkvx2v17fk4j1w3zR5KHSYJlrYOnr+ayU9K3LTs62X8ppVHff6pkKjOEF+p1Mayk/DqbaaH0PnCxqBqJOqZ5kFSkz6y4DDQzVuYILi6qUfgZFQJ01LNR7zbJAI6v9xDqREPG/Bfh7QI5z4eETlZWF9CVX6OARYm43to/wLLg2AEEduoMjexMoIxXRgzsTyBnxKYW3P+0oXWtiH68PXEKF9qAEl8lK4tTjbPBiEgXgUMDWQIiG0y6M567Rg8s8CUiw5ZsQTGJE+9zn4OkM/3VTce1mNLoZPyF66S5sXTPFXjieHCnMS3vegc3OJzLI/Xpx/lPDEU+8CYBaA1I=
17
-
18
- rvm:
19
- - ruby-head
20
- - 2.6
21
- - 2.5
22
- - 2.4
23
- - jruby-head