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 +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +4 -4
- data/README.md +32 -0
- data/lib/panda_doc/api_client.rb +4 -0
- data/lib/panda_doc/document_section.rb +14 -0
- data/lib/panda_doc/objects/document_sections_list.rb +12 -0
- data/lib/panda_doc/version.rb +1 -1
- metadata +3 -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/CHANGELOG.md
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.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.
|
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.
|
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)
|
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
@@ -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
|
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
|
@@ -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.
|
159
|
+
rubygems_version: 3.6.7
|
159
160
|
specification_version: 4
|
160
161
|
summary: Ruby wrapper for PandaDoc.com API
|
161
162
|
test_files: []
|