panda_doc 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40c4774251d60005e024d1ae28a5568fd3a1e8c438d83abe3e08f4824e3e67aa
4
- data.tar.gz: dd09ac16cf4dc968537462e12fae7483c26d80d3623f388b52ba1c64cac2701b
3
+ metadata.gz: e189a237a7930954bc8a7b2550037a49f8d371411aee0abbebd6463eff3c1806
4
+ data.tar.gz: 589a8c3207e8eed78061afa341e052287b77f278985047b32b924648cd1f353d
5
5
  SHA512:
6
- metadata.gz: 7e8ec163353b05d1d73ffce4dd41114824b06f4ae4d233fa32fafa325e469bb01fca4710cf09aab027a1be9fef9e81ee68c7701a63293205891fee7dce0a452c
7
- data.tar.gz: b80b8d50cbbd703dc8ccd4ff2004b5e49307fff5ac1bb43041bbb16ab5f851ab3dfc1577c1df60363ae9945ed5835b11755884488f6bc1346791485bfb82b049
6
+ metadata.gz: 5e213cabf79b1661781d05a7038462022c7853328399dcf128bef59fdce266650f4e5a85db0850241287a8a3e105daadc31fbe185cc0d4d0e53a518f48735be0
7
+ data.tar.gz: 5b3aba148b0e22c1823bf8d8e6b9536090a1b9c96b9449c6f64316cbb40eea021915329d0686c5cc910beaa6471b04a6708d4268134696dd30b367b79d89cf1e
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.4
1
+ 3.3.5
data/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ 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
+
7
18
  ## [0.8.0][] (2024-07-12)
8
19
 
9
20
  New:
@@ -190,7 +201,6 @@ New:
190
201
  response.error.detail => {"fields"=>["Field 'foo' does not exist."]}
191
202
  ```
192
203
 
193
-
194
204
  ## [0.0.2][] (2016-02-13)
195
205
 
196
206
  New:
@@ -212,7 +222,8 @@ Fixes:
212
222
 
213
223
  - Initial release
214
224
 
215
- [Unreleased]: https://github.com/opti/panda_doc/compare/v0.8.0...HEAD
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
216
227
  [0.8.0]: https://github.com/opti/panda_doc/compare/v0.7.0...v0.8.0
217
228
  [0.7.0]: https://github.com/opti/panda_doc/compare/v0.6.0...v0.7.0
218
229
  [0.6.0]: https://github.com/opti/panda_doc/compare/v0.5.3...v0.6.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- panda_doc (0.8.0)
4
+ panda_doc (0.9.0)
5
5
  dry-configurable
6
6
  dry-struct
7
7
  faraday (>= 2.0.1, < 3.0)
@@ -12,14 +12,15 @@ GEM
12
12
  specs:
13
13
  bigdecimal (3.1.8)
14
14
  byebug (11.1.3)
15
- concurrent-ruby (1.3.3)
15
+ concurrent-ruby (1.3.4)
16
16
  diff-lcs (1.5.1)
17
- docile (1.4.0)
17
+ docile (1.4.1)
18
18
  dry-configurable (1.2.0)
19
19
  dry-core (~> 1.0, < 2)
20
20
  zeitwerk (~> 2.6)
21
- dry-core (1.0.1)
21
+ dry-core (1.0.2)
22
22
  concurrent-ruby (~> 1.0)
23
+ logger
23
24
  zeitwerk (~> 2.6)
24
25
  dry-inflector (1.1.0)
25
26
  dry-logic (1.5.0)
@@ -38,15 +39,17 @@ GEM
38
39
  dry-inflector (~> 1.0)
39
40
  dry-logic (~> 1.4)
40
41
  zeitwerk (~> 2.6)
41
- faraday (2.10.0)
42
- faraday-net_http (>= 2.0, < 3.2)
42
+ faraday (2.12.0)
43
+ faraday-net_http (>= 2.0, < 3.4)
44
+ json
43
45
  logger
44
46
  faraday-multipart (1.0.4)
45
47
  multipart-post (~> 2)
46
- faraday-net_http (3.1.0)
48
+ faraday-net_http (3.3.0)
47
49
  net-http
48
50
  ice_nine (0.11.2)
49
- logger (1.6.0)
51
+ json (2.7.5)
52
+ logger (1.6.1)
50
53
  multipart-post (2.4.1)
51
54
  net-http (0.4.1)
52
55
  uri
@@ -55,12 +58,12 @@ GEM
55
58
  rspec-core (~> 3.13.0)
56
59
  rspec-expectations (~> 3.13.0)
57
60
  rspec-mocks (~> 3.13.0)
58
- rspec-core (3.13.0)
61
+ rspec-core (3.13.2)
59
62
  rspec-support (~> 3.13.0)
60
- rspec-expectations (3.13.1)
63
+ rspec-expectations (3.13.3)
61
64
  diff-lcs (>= 1.2.0, < 2.0)
62
65
  rspec-support (~> 3.13.0)
63
- rspec-mocks (3.13.1)
66
+ rspec-mocks (3.13.2)
64
67
  diff-lcs (>= 1.2.0, < 2.0)
65
68
  rspec-support (~> 3.13.0)
66
69
  rspec-support (3.13.1)
@@ -68,10 +71,10 @@ GEM
68
71
  docile (~> 1.1)
69
72
  simplecov-html (~> 0.11)
70
73
  simplecov_json_formatter (~> 0.1)
71
- simplecov-html (0.12.3)
74
+ simplecov-html (0.13.1)
72
75
  simplecov_json_formatter (0.1.4)
73
- uri (0.13.0)
74
- zeitwerk (2.6.16)
76
+ uri (0.13.1)
77
+ zeitwerk (2.7.1)
75
78
 
76
79
  PLATFORMS
77
80
  ruby
@@ -85,4 +88,4 @@ DEPENDENCIES
85
88
  simplecov (~> 0.22.0)
86
89
 
87
90
  BUNDLED WITH
88
- 2.5.15
91
+ 2.5.22
@@ -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)
@@ -4,6 +4,14 @@ 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
@@ -59,7 +67,7 @@ module PandaDoc
59
67
  end
60
68
 
61
69
  def failure(response)
62
- fail FailureResult.new(response) unless response.success?
70
+ raise FailureResult.new(response) unless response.success?
63
71
  end
64
72
  end
65
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
@@ -10,7 +10,7 @@ module PandaDoc
10
10
  end
11
11
 
12
12
  def initialize(type)
13
- @type = type.capitalize
13
+ @type = type.to_s.split('_').map(&:capitalize).join
14
14
  end
15
15
 
16
16
  def build
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PandaDoc
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.0"
5
5
  end
data/lib/panda_doc.rb CHANGED
@@ -21,6 +21,7 @@ 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"
24
25
  require "panda_doc/objects/empty"
25
26
  require "panda_doc/objects/error"
26
27
  require "panda_doc/objects/session"
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.8.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: 2024-07-12 00:00:00.000000000 Z
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,7 @@ 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
112
113
  - lib/panda_doc/objects/empty.rb
113
114
  - lib/panda_doc/objects/error.rb
114
115
  - lib/panda_doc/objects/field.rb
@@ -139,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
140
  - !ruby/object:Gem::Version
140
141
  version: '0'
141
142
  requirements: []
142
- rubygems_version: 3.5.15
143
+ rubygems_version: 3.5.22
143
144
  signing_key:
144
145
  specification_version: 4
145
146
  summary: Ruby wrapper for PandaDoc.com API