panda_doc 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +6 -6
- data/.ruby-version +1 -1
- data/CHANGELOG.md +22 -2
- data/Gemfile +1 -1
- data/Gemfile.lock +39 -30
- data/lib/panda_doc/api_client.rb +6 -3
- data/lib/panda_doc/document.rb +20 -1
- data/lib/panda_doc/objects/document.rb +1 -0
- data/lib/panda_doc/objects/documents_list.rb +12 -0
- data/lib/panda_doc/objects/empty.rb +10 -0
- data/lib/panda_doc/response_factory.rb +1 -1
- data/lib/panda_doc/version.rb +1 -1
- data/lib/panda_doc.rb +2 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e189a237a7930954bc8a7b2550037a49f8d371411aee0abbebd6463eff3c1806
|
4
|
+
data.tar.gz: 589a8c3207e8eed78061afa341e052287b77f278985047b32b924648cd1f353d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e213cabf79b1661781d05a7038462022c7853328399dcf128bef59fdce266650f4e5a85db0850241287a8a3e105daadc31fbe185cc0d4d0e53a518f48735be0
|
7
|
+
data.tar.gz: 5b3aba148b0e22c1823bf8d8e6b9536090a1b9c96b9449c6f64316cbb40eea021915329d0686c5cc910beaa6471b04a6708d4268134696dd30b367b79d89cf1e
|
data/.github/workflows/ci.yml
CHANGED
@@ -13,15 +13,15 @@ jobs:
|
|
13
13
|
fail-fast: false
|
14
14
|
matrix:
|
15
15
|
ruby:
|
16
|
+
- '3.3'
|
16
17
|
- '3.2'
|
17
18
|
- '3.1'
|
18
19
|
- '3.0'
|
19
|
-
- '2.7'
|
20
20
|
include:
|
21
|
-
- ruby: '3.
|
21
|
+
- ruby: '3.3'
|
22
22
|
coverage: '1'
|
23
23
|
steps:
|
24
|
-
- uses: actions/checkout@
|
24
|
+
- uses: actions/checkout@v4
|
25
25
|
with:
|
26
26
|
submodules: true
|
27
27
|
- name: Setup Ruby
|
@@ -31,7 +31,7 @@ jobs:
|
|
31
31
|
- name: Update rubygems
|
32
32
|
run: |
|
33
33
|
gem update --system
|
34
|
-
- uses: actions/cache@
|
34
|
+
- uses: actions/cache@v4
|
35
35
|
with:
|
36
36
|
path: vendor/bundle
|
37
37
|
key: bundle-use-ruby-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
|
@@ -47,7 +47,7 @@ jobs:
|
|
47
47
|
run: |
|
48
48
|
bundle exec rake spec
|
49
49
|
- name: Publish code coverage
|
50
|
-
if: ${{ matrix.coverage == '1' && github.actor != 'dependabot[bot]' }}
|
51
|
-
uses: paambaati/codeclimate-action@
|
50
|
+
if: ${{ matrix.coverage == '1' && github.actor != 'dependabot[bot]' && github.ref_name == 'main' }}
|
51
|
+
uses: paambaati/codeclimate-action@v8
|
52
52
|
env:
|
53
53
|
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.5
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
+
## [0.9.0][] (2024-07-12)
|
8
|
+
|
9
|
+
New:
|
10
|
+
|
11
|
+
- Add `Document.list` for [List Documents](https://developers.pandadoc.com/reference/list-documents) endpoint.
|
12
|
+
```ruby
|
13
|
+
list = PandaDoc::Document.list
|
14
|
+
list.documents.first.name
|
15
|
+
=> "Sample Name"
|
16
|
+
```
|
17
|
+
|
18
|
+
## [0.8.0][] (2024-07-12)
|
19
|
+
|
20
|
+
New:
|
21
|
+
|
22
|
+
- Optional `metadata` field which can be used to store arbitrary data (by @andrewvy)
|
23
|
+
- `Document.move_to_draft` -> POST /documents/{id}/draft/ (by @andrewvy)
|
24
|
+
- `Document.update` -> PATCH /documents/{id}/ (by @andrewvy)
|
25
|
+
|
7
26
|
## [0.7.0][] (2023-06-07)
|
8
27
|
|
9
28
|
New:
|
@@ -182,7 +201,6 @@ New:
|
|
182
201
|
response.error.detail => {"fields"=>["Field 'foo' does not exist."]}
|
183
202
|
```
|
184
203
|
|
185
|
-
|
186
204
|
## [0.0.2][] (2016-02-13)
|
187
205
|
|
188
206
|
New:
|
@@ -204,7 +222,9 @@ Fixes:
|
|
204
222
|
|
205
223
|
- Initial release
|
206
224
|
|
207
|
-
[Unreleased]: https://github.com/opti/panda_doc/compare/v0.
|
225
|
+
[Unreleased]: https://github.com/opti/panda_doc/compare/v0.9.0...HEAD
|
226
|
+
[0.9.0]: https://github.com/opti/panda_doc/compare/v0.8.0...v0.9.0
|
227
|
+
[0.8.0]: https://github.com/opti/panda_doc/compare/v0.7.0...v0.8.0
|
208
228
|
[0.7.0]: https://github.com/opti/panda_doc/compare/v0.6.0...v0.7.0
|
209
229
|
[0.6.0]: https://github.com/opti/panda_doc/compare/v0.5.3...v0.6.0
|
210
230
|
[0.5.3]: https://github.com/opti/panda_doc/compare/v0.5.2...v0.5.3
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
panda_doc (0.
|
4
|
+
panda_doc (0.9.0)
|
5
5
|
dry-configurable
|
6
6
|
dry-struct
|
7
7
|
faraday (>= 2.0.1, < 3.0)
|
@@ -10,17 +10,19 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
+
bigdecimal (3.1.8)
|
13
14
|
byebug (11.1.3)
|
14
|
-
concurrent-ruby (1.
|
15
|
-
diff-lcs (1.5.
|
16
|
-
docile (1.4.
|
17
|
-
dry-configurable (1.0
|
15
|
+
concurrent-ruby (1.3.4)
|
16
|
+
diff-lcs (1.5.1)
|
17
|
+
docile (1.4.1)
|
18
|
+
dry-configurable (1.2.0)
|
18
19
|
dry-core (~> 1.0, < 2)
|
19
20
|
zeitwerk (~> 2.6)
|
20
|
-
dry-core (1.0.
|
21
|
+
dry-core (1.0.2)
|
21
22
|
concurrent-ruby (~> 1.0)
|
23
|
+
logger
|
22
24
|
zeitwerk (~> 2.6)
|
23
|
-
dry-inflector (1.
|
25
|
+
dry-inflector (1.1.0)
|
24
26
|
dry-logic (1.5.0)
|
25
27
|
concurrent-ruby (~> 1.0)
|
26
28
|
dry-core (~> 1.0, < 2)
|
@@ -30,42 +32,49 @@ GEM
|
|
30
32
|
dry-types (>= 1.7, < 2)
|
31
33
|
ice_nine (~> 0.11)
|
32
34
|
zeitwerk (~> 2.6)
|
33
|
-
dry-types (1.7.
|
35
|
+
dry-types (1.7.2)
|
36
|
+
bigdecimal (~> 3.0)
|
34
37
|
concurrent-ruby (~> 1.0)
|
35
38
|
dry-core (~> 1.0)
|
36
39
|
dry-inflector (~> 1.0)
|
37
40
|
dry-logic (~> 1.4)
|
38
41
|
zeitwerk (~> 2.6)
|
39
|
-
faraday (2.
|
40
|
-
faraday-net_http (>= 2.0, < 3.
|
41
|
-
|
42
|
+
faraday (2.12.0)
|
43
|
+
faraday-net_http (>= 2.0, < 3.4)
|
44
|
+
json
|
45
|
+
logger
|
42
46
|
faraday-multipart (1.0.4)
|
43
47
|
multipart-post (~> 2)
|
44
|
-
faraday-net_http (3.0
|
48
|
+
faraday-net_http (3.3.0)
|
49
|
+
net-http
|
45
50
|
ice_nine (0.11.2)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
rspec
|
53
|
-
rspec-
|
54
|
-
|
51
|
+
json (2.7.5)
|
52
|
+
logger (1.6.1)
|
53
|
+
multipart-post (2.4.1)
|
54
|
+
net-http (0.4.1)
|
55
|
+
uri
|
56
|
+
rake (13.2.1)
|
57
|
+
rspec (3.13.0)
|
58
|
+
rspec-core (~> 3.13.0)
|
59
|
+
rspec-expectations (~> 3.13.0)
|
60
|
+
rspec-mocks (~> 3.13.0)
|
61
|
+
rspec-core (3.13.2)
|
62
|
+
rspec-support (~> 3.13.0)
|
63
|
+
rspec-expectations (3.13.3)
|
55
64
|
diff-lcs (>= 1.2.0, < 2.0)
|
56
|
-
rspec-support (~> 3.
|
57
|
-
rspec-mocks (3.
|
65
|
+
rspec-support (~> 3.13.0)
|
66
|
+
rspec-mocks (3.13.2)
|
58
67
|
diff-lcs (>= 1.2.0, < 2.0)
|
59
|
-
rspec-support (~> 3.
|
60
|
-
rspec-support (3.
|
61
|
-
ruby2_keywords (0.0.5)
|
68
|
+
rspec-support (~> 3.13.0)
|
69
|
+
rspec-support (3.13.1)
|
62
70
|
simplecov (0.22.0)
|
63
71
|
docile (~> 1.1)
|
64
72
|
simplecov-html (~> 0.11)
|
65
73
|
simplecov_json_formatter (~> 0.1)
|
66
|
-
simplecov-html (0.
|
74
|
+
simplecov-html (0.13.1)
|
67
75
|
simplecov_json_formatter (0.1.4)
|
68
|
-
|
76
|
+
uri (0.13.1)
|
77
|
+
zeitwerk (2.7.1)
|
69
78
|
|
70
79
|
PLATFORMS
|
71
80
|
ruby
|
@@ -75,8 +84,8 @@ DEPENDENCIES
|
|
75
84
|
byebug
|
76
85
|
panda_doc!
|
77
86
|
rake (>= 10.0)
|
78
|
-
rspec (~> 3.
|
87
|
+
rspec (~> 3.13)
|
79
88
|
simplecov (~> 0.22.0)
|
80
89
|
|
81
90
|
BUNDLED WITH
|
82
|
-
2.
|
91
|
+
2.5.22
|
data/lib/panda_doc/api_client.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module PandaDoc
|
4
|
+
# This class is responsible for making HTTP requests to the PandaDoc API.
|
4
5
|
class ApiClient
|
5
|
-
|
6
6
|
class << self
|
7
7
|
def request(verb, path, data = {})
|
8
8
|
if file = data.delete(:file)
|
@@ -13,9 +13,8 @@ module PandaDoc
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
attr_reader :connection
|
16
|
+
attr_reader :connection, :url_prefix
|
17
17
|
|
18
|
-
attr_reader :url_prefix
|
19
18
|
private :url_prefix
|
20
19
|
|
21
20
|
def initialize(multipart: false)
|
@@ -51,6 +50,10 @@ module PandaDoc
|
|
51
50
|
connection.get(normalized_path(path), **data)
|
52
51
|
end
|
53
52
|
|
53
|
+
def patch(path, data = {})
|
54
|
+
connection.patch(normalized_path(path), **data)
|
55
|
+
end
|
56
|
+
|
54
57
|
private
|
55
58
|
|
56
59
|
def normalized_path(path)
|
data/lib/panda_doc/document.rb
CHANGED
@@ -4,10 +4,25 @@ module PandaDoc
|
|
4
4
|
module Document
|
5
5
|
extend self
|
6
6
|
|
7
|
+
# @param options [Hash]
|
8
|
+
def list(**options)
|
9
|
+
respond(
|
10
|
+
ApiClient.request(:get, "/documents", **options),
|
11
|
+
type: :documents_list
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
7
15
|
def create(data)
|
8
16
|
respond(ApiClient.request(:post, "/documents", **data))
|
9
17
|
end
|
10
18
|
|
19
|
+
def update(uuid, **data)
|
20
|
+
respond(
|
21
|
+
ApiClient.request(:patch, "/documents/#{uuid}", **data),
|
22
|
+
type: :empty
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
11
26
|
def send(uuid, **data)
|
12
27
|
respond(ApiClient.request(:post, "/documents/#{uuid}/send", **data))
|
13
28
|
end
|
@@ -20,6 +35,10 @@ module PandaDoc
|
|
20
35
|
respond(ApiClient.request(:get, "/documents/#{uuid}/details"))
|
21
36
|
end
|
22
37
|
|
38
|
+
def move_to_draft(uuid)
|
39
|
+
respond(ApiClient.request(:post, "/documents/#{uuid}/draft"))
|
40
|
+
end
|
41
|
+
|
23
42
|
def session(uuid, **data)
|
24
43
|
respond(
|
25
44
|
ApiClient.request(:post, "/documents/#{uuid}/session", **data),
|
@@ -48,7 +67,7 @@ module PandaDoc
|
|
48
67
|
end
|
49
68
|
|
50
69
|
def failure(response)
|
51
|
-
|
70
|
+
raise FailureResult.new(response) unless response.success?
|
52
71
|
end
|
53
72
|
end
|
54
73
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PandaDoc
|
4
|
+
module Objects
|
5
|
+
# Represents a list of documents
|
6
|
+
class DocumentsList < Base
|
7
|
+
attribute :results, Types::Array.of(Objects::Document).default([].freeze)
|
8
|
+
|
9
|
+
alias_method :documents, :results
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/panda_doc/version.rb
CHANGED
data/lib/panda_doc.rb
CHANGED
@@ -21,6 +21,8 @@ require "panda_doc/objects/recipient"
|
|
21
21
|
require "panda_doc/objects/token"
|
22
22
|
require "panda_doc/objects/field"
|
23
23
|
require "panda_doc/objects/document"
|
24
|
+
require "panda_doc/objects/documents_list"
|
25
|
+
require "panda_doc/objects/empty"
|
24
26
|
require "panda_doc/objects/error"
|
25
27
|
require "panda_doc/objects/session"
|
26
28
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: panda_doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Pstyga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -109,6 +109,8 @@ files:
|
|
109
109
|
- lib/panda_doc/failure_result.rb
|
110
110
|
- lib/panda_doc/objects/base.rb
|
111
111
|
- lib/panda_doc/objects/document.rb
|
112
|
+
- lib/panda_doc/objects/documents_list.rb
|
113
|
+
- lib/panda_doc/objects/empty.rb
|
112
114
|
- lib/panda_doc/objects/error.rb
|
113
115
|
- lib/panda_doc/objects/field.rb
|
114
116
|
- lib/panda_doc/objects/recipient.rb
|
@@ -138,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
140
|
- !ruby/object:Gem::Version
|
139
141
|
version: '0'
|
140
142
|
requirements: []
|
141
|
-
rubygems_version: 3.
|
143
|
+
rubygems_version: 3.5.22
|
142
144
|
signing_key:
|
143
145
|
specification_version: 4
|
144
146
|
summary: Ruby wrapper for PandaDoc.com API
|