panda_doc 0.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de6d8cc1931b7740e723e533b971ebb962c9b3914b6bdd0a259f91d9d9cf13e6
4
- data.tar.gz: 66938632918f5cbdcaecc60d0e493e32466374211e12a63b323b185453e3c71c
3
+ metadata.gz: 5112e058fffb7e215f11d5f45779140776f3a1fc8a71bdf3f8982786540684c2
4
+ data.tar.gz: 192bbe2e32c98464054b50c922f522366a7b000d17784cc1f7e55e5db299eff4
5
5
  SHA512:
6
- metadata.gz: 7f610544867b299d098e3adbce4371a127af29b5f9117220ed16fad5ddd0c21f21237ea0d98c002d232dc13d8aa8941184de100354488aefdd48fa7c7722d15e
7
- data.tar.gz: e49d4bbd18f4a554f9f3cb43c78e27a077a15f734eb966d30f8b5664c8d6f9db9abd498831d8b3721e529e2375a367eef824061fb81dc7fffe759faf4c636533
6
+ metadata.gz: d93d73114d02127e6371da588265d0b97509a56abd7399d965ba0a4dd267c54f3f2706d2b4be4ea7f1213f34546698872bb8a0a6e01e94c2df5cbbc4f0655150
7
+ data.tar.gz: 7d6b8d7c177cf544378ae302e232fb32a1cc80a57e3e7b5d6dbd3273b0a9aec511dcc58e266028e2150d60afaeada1465d37b59536e04c26be0d2a4f689da75d
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
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
+
6
12
 
7
13
  ## [0.12.0][] (2025-06-20)
8
14
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- panda_doc (0.12.0)
4
+ panda_doc (0.13.0)
5
5
  dry-configurable
6
6
  dry-struct
7
7
  faraday (>= 2.0.1, < 3.0)
@@ -41,16 +41,16 @@ GEM
41
41
  dry-inflector (~> 1.0)
42
42
  dry-logic (~> 1.4)
43
43
  zeitwerk (~> 2.6)
44
- faraday (2.13.1)
44
+ faraday (2.13.2)
45
45
  faraday-net_http (>= 2.0, < 3.5)
46
46
  json
47
47
  logger
48
48
  faraday-multipart (1.1.1)
49
49
  multipart-post (~> 2.0)
50
- faraday-net_http (3.4.0)
50
+ faraday-net_http (3.4.1)
51
51
  net-http (>= 0.5.0)
52
52
  ice_nine (0.11.2)
53
- json (2.11.3)
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)
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
@@ -54,6 +54,10 @@ module PandaDoc
54
54
  connection.patch(normalized_path(path), **data)
55
55
  end
56
56
 
57
+ def delete(path, data = {})
58
+ connection.delete(normalized_path(path), **data)
59
+ end
60
+
57
61
  private
58
62
 
59
63
  def normalized_path(path)
@@ -4,6 +4,13 @@ module PandaDoc
4
4
  module DocumentSection
5
5
  extend self
6
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
+
7
14
  def create(document_uuid, **data)
8
15
  respond(
9
16
  ApiClient.request(:post, "/documents/#{document_uuid}/sections/uploads", **data),
@@ -11,6 +18,13 @@ module PandaDoc
11
18
  )
12
19
  end
13
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
+
14
28
  private
15
29
 
16
30
  def respond(response, type: :document)
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PandaDoc
4
- VERSION = "0.12.0"
4
+ VERSION = "0.13.0"
5
5
  end
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.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Pstyga
@@ -124,6 +124,7 @@ files:
124
124
  - lib/panda_doc/objects/base.rb
125
125
  - lib/panda_doc/objects/document.rb
126
126
  - lib/panda_doc/objects/document_section.rb
127
+ - lib/panda_doc/objects/document_sections_list.rb
127
128
  - lib/panda_doc/objects/documents_list.rb
128
129
  - lib/panda_doc/objects/editing_session.rb
129
130
  - lib/panda_doc/objects/empty.rb
@@ -155,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
156
  - !ruby/object:Gem::Version
156
157
  version: '0'
157
158
  requirements: []
158
- rubygems_version: 3.6.9
159
+ rubygems_version: 3.6.7
159
160
  specification_version: 4
160
161
  summary: Ruby wrapper for PandaDoc.com API
161
162
  test_files: []