panda_doc 0.12.0 → 0.13.1

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: ea092eb81ffea5fd05fc07db1e23e5d1df5b67270a357936fa08f8f4d8cb7a36
4
+ data.tar.gz: 95dc6c4ba632984f35a73ed3f4bcb8e2f0d4ace085b067cbc3fba66f57b19d34
5
5
  SHA512:
6
- metadata.gz: 7f610544867b299d098e3adbce4371a127af29b5f9117220ed16fad5ddd0c21f21237ea0d98c002d232dc13d8aa8941184de100354488aefdd48fa7c7722d15e
7
- data.tar.gz: e49d4bbd18f4a554f9f3cb43c78e27a077a15f734eb966d30f8b5664c8d6f9db9abd498831d8b3721e529e2375a367eef824061fb81dc7fffe759faf4c636533
6
+ metadata.gz: 03d387404d1915da96e892f244bf3af54984cf2ca0817ddfb69983efae07521977f4012a4e41876efbc419b3c78fc08973f99ab6de95200e5fbb518d595b76a4
7
+ data.tar.gz: bdbaf844557b895f1b1966aeabd6821ac9c14d53bf729825e935ea3c7dd81068f4a55f4df58eb1ed3f15569ec6624f7f10326a891afb855e8ee167454a3a3432
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.1][]
7
+
8
+ Fixes:
9
+
10
+ - Fixes #62 - make Document Sections attribute optional (@lannon)
11
+
12
+ ## [0.13.0][]
13
+
14
+ New:
15
+
16
+ - Add Document Sections list and delete actions (by @lannon)
17
+
6
18
 
7
19
  ## [0.12.0][] (2025-06-20)
8
20
 
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.1)
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)
@@ -2,12 +2,12 @@ module PandaDoc
2
2
  module Objects
3
3
  class DocumentSection < Base
4
4
  attribute :uuid, Types::String
5
- attribute :document_uuid, Types::String
6
- attribute :status, Types::Custom::DocumentStatus
5
+ attribute? :document_uuid, Types::String
6
+ attribute? :status, Types::Custom::DocumentStatus
7
7
  attribute :name, Types::String
8
8
 
9
- attribute :date_created, Types::Params::DateTime
10
- attribute :date_modified, Types::Params::DateTime
9
+ attribute? :date_created, Types::Params::DateTime
10
+ attribute? :date_modified, Types::Params::DateTime
11
11
 
12
12
  alias_method :created_at, :date_created
13
13
  alias_method :updated_at, :date_modified
@@ -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.1"
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.1
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: []