panda_doc 0.11.0 → 0.13.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/.ruby-version +1 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +13 -13
- data/README.md +32 -0
- data/lib/panda_doc/api_client.rb +4 -0
- data/lib/panda_doc/document_section.rb +48 -0
- data/lib/panda_doc/objects/document_section.rb +16 -0
- data/lib/panda_doc/objects/document_sections_list.rb +12 -0
- data/lib/panda_doc/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5112e058fffb7e215f11d5f45779140776f3a1fc8a71bdf3f8982786540684c2
|
4
|
+
data.tar.gz: 192bbe2e32c98464054b50c922f522366a7b000d17784cc1f7e55e5db299eff4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d93d73114d02127e6371da588265d0b97509a56abd7399d965ba0a4dd267c54f3f2706d2b4be4ea7f1213f34546698872bb8a0a6e01e94c2df5cbbc4f0655150
|
7
|
+
data.tar.gz: 7d6b8d7c177cf544378ae302e232fb32a1cc80a57e3e7b5d6dbd3273b0a9aec511dcc58e266028e2150d60afaeada1465d37b59536e04c26be0d2a4f689da75d
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.4.
|
1
|
+
3.4.3
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
|
+
## [0.13.0][] (2025-07-21)
|
7
|
+
|
8
|
+
New:
|
9
|
+
|
10
|
+
- Add Document Sections list and delete actions (by @lannon)
|
11
|
+
|
12
|
+
|
13
|
+
## [0.12.0][] (2025-06-20)
|
14
|
+
|
15
|
+
New:
|
16
|
+
|
17
|
+
- Add Document Sections support (by @andrewvy)
|
6
18
|
|
7
19
|
## [0.11.0][] (2025-04-19)
|
8
20
|
|
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.13.0)
|
5
5
|
dry-configurable
|
6
6
|
dry-struct
|
7
7
|
faraday (>= 2.0.1, < 3.0)
|
@@ -14,7 +14,7 @@ GEM
|
|
14
14
|
bigdecimal (3.1.9)
|
15
15
|
byebug (12.0.0)
|
16
16
|
concurrent-ruby (1.3.5)
|
17
|
-
diff-lcs (1.6.
|
17
|
+
diff-lcs (1.6.2)
|
18
18
|
docile (1.4.1)
|
19
19
|
dry-configurable (1.3.0)
|
20
20
|
dry-core (~> 1.1)
|
@@ -41,34 +41,34 @@ GEM
|
|
41
41
|
dry-inflector (~> 1.0)
|
42
42
|
dry-logic (~> 1.4)
|
43
43
|
zeitwerk (~> 2.6)
|
44
|
-
faraday (2.13.
|
44
|
+
faraday (2.13.2)
|
45
45
|
faraday-net_http (>= 2.0, < 3.5)
|
46
46
|
json
|
47
47
|
logger
|
48
|
-
faraday-multipart (1.1.
|
48
|
+
faraday-multipart (1.1.1)
|
49
49
|
multipart-post (~> 2.0)
|
50
|
-
faraday-net_http (3.4.
|
50
|
+
faraday-net_http (3.4.1)
|
51
51
|
net-http (>= 0.5.0)
|
52
52
|
ice_nine (0.11.2)
|
53
|
-
json (2.
|
53
|
+
json (2.12.2)
|
54
54
|
logger (1.7.0)
|
55
55
|
multipart-post (2.4.1)
|
56
56
|
net-http (0.6.0)
|
57
57
|
uri
|
58
|
-
rake (13.
|
59
|
-
rspec (3.13.
|
58
|
+
rake (13.3.0)
|
59
|
+
rspec (3.13.1)
|
60
60
|
rspec-core (~> 3.13.0)
|
61
61
|
rspec-expectations (~> 3.13.0)
|
62
62
|
rspec-mocks (~> 3.13.0)
|
63
|
-
rspec-core (3.13.
|
63
|
+
rspec-core (3.13.4)
|
64
64
|
rspec-support (~> 3.13.0)
|
65
|
-
rspec-expectations (3.13.
|
65
|
+
rspec-expectations (3.13.5)
|
66
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
67
67
|
rspec-support (~> 3.13.0)
|
68
|
-
rspec-mocks (3.13.
|
68
|
+
rspec-mocks (3.13.5)
|
69
69
|
diff-lcs (>= 1.2.0, < 2.0)
|
70
70
|
rspec-support (~> 3.13.0)
|
71
|
-
rspec-support (3.13.
|
71
|
+
rspec-support (3.13.4)
|
72
72
|
simplecov (0.22.0)
|
73
73
|
docile (~> 1.1)
|
74
74
|
simplecov-html (~> 0.11)
|
@@ -90,4 +90,4 @@ DEPENDENCIES
|
|
90
90
|
simplecov (~> 0.22.0)
|
91
91
|
|
92
92
|
BUNDLED WITH
|
93
|
-
2.6.
|
93
|
+
2.6.9
|
data/README.md
CHANGED
@@ -174,6 +174,38 @@ file = File.open("document.pdf", "w") do |f|
|
|
174
174
|
end
|
175
175
|
```
|
176
176
|
|
177
|
+
#### Listing document sections ([API](https://developers.pandadoc.com/reference/document-sections-info))
|
178
|
+
|
179
|
+
```ruby
|
180
|
+
sections = PandaDoc::DocumentSection.list("document_uuid")
|
181
|
+
|
182
|
+
sections.results.each do |section|
|
183
|
+
puts section.uuid
|
184
|
+
puts section.name
|
185
|
+
puts section.status
|
186
|
+
end
|
187
|
+
```
|
188
|
+
|
189
|
+
#### Creating a document section ([API](https://developers.pandadoc.com/reference/create-document-section))
|
190
|
+
|
191
|
+
```ruby
|
192
|
+
section = PandaDoc::DocumentSection.create(
|
193
|
+
"document_uuid",
|
194
|
+
name: "Section Name",
|
195
|
+
file: file
|
196
|
+
)
|
197
|
+
|
198
|
+
section.uuid # => "section_uuid"
|
199
|
+
section.name # => "Section Name"
|
200
|
+
section.status # => "uploaded"
|
201
|
+
```
|
202
|
+
|
203
|
+
#### Deleting a document section ([API](https://developers.pandadoc.com/reference/delete-section))
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
PandaDoc::DocumentSection.delete("document_uuid", "section_uuid")
|
207
|
+
```
|
208
|
+
|
177
209
|
#### Error handling
|
178
210
|
|
179
211
|
If an error occurs during an API request it will be wrapped into a plain ruby
|
data/lib/panda_doc/api_client.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PandaDoc
|
4
|
+
module DocumentSection
|
5
|
+
extend self
|
6
|
+
|
7
|
+
def list(document_uuid, **options)
|
8
|
+
respond(
|
9
|
+
ApiClient.request(:get, "/documents/#{document_uuid}/sections", **options),
|
10
|
+
type: :document_sections_list
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
def create(document_uuid, **data)
|
15
|
+
respond(
|
16
|
+
ApiClient.request(:post, "/documents/#{document_uuid}/sections/uploads", **data),
|
17
|
+
type: :document_section
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def delete(document_uuid, section_uuid)
|
22
|
+
respond(
|
23
|
+
ApiClient.request(:delete, "/documents/#{document_uuid}/sections/#{section_uuid}"),
|
24
|
+
type: :empty
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def respond(response, type: :document)
|
31
|
+
failure(response)
|
32
|
+
|
33
|
+
SuccessResult.new(
|
34
|
+
ResponseFactory.build(type).new(response.body)
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
def stream(response)
|
39
|
+
failure(response)
|
40
|
+
|
41
|
+
SuccessResult.new(response)
|
42
|
+
end
|
43
|
+
|
44
|
+
def failure(response)
|
45
|
+
raise FailureResult.new(response) unless response.success?
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module PandaDoc
|
2
|
+
module Objects
|
3
|
+
class DocumentSection < Base
|
4
|
+
attribute :uuid, Types::String
|
5
|
+
attribute :document_uuid, Types::String
|
6
|
+
attribute :status, Types::Custom::DocumentStatus
|
7
|
+
attribute :name, Types::String
|
8
|
+
|
9
|
+
attribute :date_created, Types::Params::DateTime
|
10
|
+
attribute :date_modified, Types::Params::DateTime
|
11
|
+
|
12
|
+
alias_method :created_at, :date_created
|
13
|
+
alias_method :updated_at, :date_modified
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PandaDoc
|
4
|
+
module Objects
|
5
|
+
# Represents a list of document sections
|
6
|
+
class DocumentSectionsList < Base
|
7
|
+
attribute :results, Types::Array.of(Objects::DocumentSection).default([].freeze)
|
8
|
+
|
9
|
+
alias_method :document_sections, :results
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/panda_doc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: panda_doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Pstyga
|
@@ -119,9 +119,12 @@ files:
|
|
119
119
|
- lib/panda_doc/coercions.rb
|
120
120
|
- lib/panda_doc/configuration.rb
|
121
121
|
- lib/panda_doc/document.rb
|
122
|
+
- lib/panda_doc/document_section.rb
|
122
123
|
- lib/panda_doc/failure_result.rb
|
123
124
|
- lib/panda_doc/objects/base.rb
|
124
125
|
- lib/panda_doc/objects/document.rb
|
126
|
+
- lib/panda_doc/objects/document_section.rb
|
127
|
+
- lib/panda_doc/objects/document_sections_list.rb
|
125
128
|
- lib/panda_doc/objects/documents_list.rb
|
126
129
|
- lib/panda_doc/objects/editing_session.rb
|
127
130
|
- lib/panda_doc/objects/empty.rb
|
@@ -153,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
156
|
- !ruby/object:Gem::Version
|
154
157
|
version: '0'
|
155
158
|
requirements: []
|
156
|
-
rubygems_version: 3.6.
|
159
|
+
rubygems_version: 3.6.7
|
157
160
|
specification_version: 4
|
158
161
|
summary: Ruby wrapper for PandaDoc.com API
|
159
162
|
test_files: []
|