panda_doc 0.4.3 → 0.5.3

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: 002d94c7fb8aeb4356526f31c51616103804cbc5204c6cbd5a9c0139de80e69e
4
- data.tar.gz: f256f702257465cb6ab027a0cc327a44bf3c0413565413c44d826845f649dbe1
3
+ metadata.gz: 3e8b044f3c9707cdd0ecf3221f1384a07d4922b38fdc2090305461c28ae9d11e
4
+ data.tar.gz: fa8015cd7e818ec99f2b0f384d85aaf2b7ebf52e2efa736e1ecf991337ad16a4
5
5
  SHA512:
6
- metadata.gz: e233f412fce3a98634a6a01dc7c410813b63b390e7b51ccfc4ac4c49bbcbafdee637671dbfb64e6f5777add1e68c8e0f102cfdc40200b6654bf04602f3c7cad1
7
- data.tar.gz: 58877fbc856fb7c153a12a12300aae02633d12d0e9201bd6eae00daca89628b65421e711b6cc779ef9493187c44636b24bd6ec037e650ea713087055f466175a
6
+ metadata.gz: 26e731f8d0000c15aca640832505f34b3c636176550508028cd397201d8aa38d58fdf30f04a85e56fca5d94b6154528155fbd376d07bdfab09b0880ce17498b2
7
+ data.tar.gz: 976f8dde2e6abdf86e574140bd6f5178aa20ca5373e29e531d09bd1015a1317a8ebff10948e5d7d0fd78590b7b653ec8cf557d5c7300e92a1f8b50832a74b70b
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
data/.travis.yml CHANGED
@@ -1,14 +1,15 @@
1
- sudo: false
2
1
  language: ruby
2
+ os: linux
3
+ dist: xenial
3
4
 
4
5
  cache:
5
6
  - bundler
6
7
 
7
8
  rvm:
8
- - 2.3
9
- - 2.4
10
9
  - 2.5
11
10
  - 2.6
11
+ - 2.7
12
+ - 3.0
12
13
 
13
14
  env:
14
15
  global:
data/CHANGELOG.md CHANGED
@@ -4,6 +4,58 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.5.3][] (2021-11-03)
8
+
9
+ Fixes:
10
+
11
+ - Fixes #5 - make `placeholder` attribute optional (@acuster77)
12
+
13
+ ## [0.5.2][] (2021-03-08)
14
+
15
+ Fixes:
16
+
17
+ - Fixes #3 - `Dry::Struct::Error` when token.value is not provided.
18
+
19
+ ## [0.5.1][] (2021-01-08)
20
+
21
+ New:
22
+
23
+ - Add `fields` to the document details response:
24
+ ```ruby
25
+ document = PandaDoc::Document.details("uuid")
26
+ document.fields.first.name
27
+ => "Field Name"
28
+
29
+ docuemnt.fields.first.value
30
+ => "Field Value"
31
+ ```
32
+
33
+ ## [0.5.0][] (2021-01-06)
34
+
35
+ New:
36
+
37
+ - Replace virtus with dry-struct.
38
+ - Drop support for ruby < 2.5.
39
+ - Add support for API-Key authentication.
40
+ ```ruby
41
+ PandaDoc.configure do |config|
42
+ config.api_key = "API Key"
43
+ end
44
+ ```
45
+
46
+ - Add `id`, `expiration_date` and `version` to the response Document Object.
47
+ - Add [Document details](https://developers.pandadoc.com/reference#document-details) endpoint
48
+ ```ruby
49
+ document = PandaDoc::Document.details("uuid")
50
+ document.tokens.first.name
51
+ => "Token.Name"
52
+
53
+ docuemnt.tokens.first.value
54
+ => "Token Value"
55
+ ```
56
+
57
+ - Add ruby 3.0 to test coverage.
58
+
7
59
  ## [0.4.3][] (2019-03-06)
8
60
 
9
61
  Fixes:
@@ -123,7 +175,11 @@ Fixes:
123
175
 
124
176
  - Initial release
125
177
 
126
- [Unreleased]: https://github.com/opti/panda_doc/compare/v0.4.3...HEAD
178
+ [Unreleased]: https://github.com/opti/panda_doc/compare/v0.5.3...HEAD
179
+ [0.5.3]: https://github.com/opti/panda_doc/compare/v0.5.2...v0.5.3
180
+ [0.5.2]: https://github.com/opti/panda_doc/compare/v0.5.1...v0.5.2
181
+ [0.5.1]: https://github.com/opti/panda_doc/compare/v0.5.0...v0.5.1
182
+ [0.5.0]: https://github.com/opti/panda_doc/compare/v0.4.3...v0.5.0
127
183
  [0.4.3]: https://github.com/opti/panda_doc/compare/v0.4.2...v0.4.3
128
184
  [0.4.2]: https://github.com/opti/panda_doc/compare/v0.4.1...v0.4.2
129
185
  [0.4.1]: https://github.com/opti/panda_doc/compare/v0.4.0...v0.4.1
data/Gemfile CHANGED
@@ -9,5 +9,5 @@ gem "rspec", "~> 3.4"
9
9
  gem "byebug"
10
10
 
11
11
  group :test do
12
- gem 'simplecov', require: false
12
+ gem "simplecov", require: false
13
13
  end
data/Gemfile.lock ADDED
@@ -0,0 +1,96 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ panda_doc (0.5.3)
5
+ dry-configurable
6
+ dry-struct
7
+ faraday (>= 0.9.2, < 2.0)
8
+ faraday_middleware (>= 0.10.0, < 2.0)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ byebug (11.1.3)
14
+ concurrent-ruby (1.1.9)
15
+ diff-lcs (1.4.4)
16
+ docile (1.4.0)
17
+ dry-configurable (0.13.0)
18
+ concurrent-ruby (~> 1.0)
19
+ dry-core (~> 0.6)
20
+ dry-container (0.9.0)
21
+ concurrent-ruby (~> 1.0)
22
+ dry-configurable (~> 0.13, >= 0.13.0)
23
+ dry-core (0.7.1)
24
+ concurrent-ruby (~> 1.0)
25
+ dry-inflector (0.2.1)
26
+ dry-logic (1.2.0)
27
+ concurrent-ruby (~> 1.0)
28
+ dry-core (~> 0.5, >= 0.5)
29
+ dry-struct (1.4.0)
30
+ dry-core (~> 0.5, >= 0.5)
31
+ dry-types (~> 1.5)
32
+ ice_nine (~> 0.11)
33
+ dry-types (1.5.1)
34
+ concurrent-ruby (~> 1.0)
35
+ dry-container (~> 0.3)
36
+ dry-core (~> 0.5, >= 0.5)
37
+ dry-inflector (~> 0.1, >= 0.1.2)
38
+ dry-logic (~> 1.0, >= 1.0.2)
39
+ faraday (1.8.0)
40
+ faraday-em_http (~> 1.0)
41
+ faraday-em_synchrony (~> 1.0)
42
+ faraday-excon (~> 1.1)
43
+ faraday-httpclient (~> 1.0.1)
44
+ faraday-net_http (~> 1.0)
45
+ faraday-net_http_persistent (~> 1.1)
46
+ faraday-patron (~> 1.0)
47
+ faraday-rack (~> 1.0)
48
+ multipart-post (>= 1.2, < 3)
49
+ ruby2_keywords (>= 0.0.4)
50
+ faraday-em_http (1.0.0)
51
+ faraday-em_synchrony (1.0.0)
52
+ faraday-excon (1.1.0)
53
+ faraday-httpclient (1.0.1)
54
+ faraday-net_http (1.0.1)
55
+ faraday-net_http_persistent (1.2.0)
56
+ faraday-patron (1.0.0)
57
+ faraday-rack (1.0.0)
58
+ faraday_middleware (1.2.0)
59
+ faraday (~> 1.0)
60
+ ice_nine (0.11.2)
61
+ multipart-post (2.1.1)
62
+ rake (13.0.6)
63
+ rspec (3.10.0)
64
+ rspec-core (~> 3.10.0)
65
+ rspec-expectations (~> 3.10.0)
66
+ rspec-mocks (~> 3.10.0)
67
+ rspec-core (3.10.1)
68
+ rspec-support (~> 3.10.0)
69
+ rspec-expectations (3.10.1)
70
+ diff-lcs (>= 1.2.0, < 2.0)
71
+ rspec-support (~> 3.10.0)
72
+ rspec-mocks (3.10.2)
73
+ diff-lcs (>= 1.2.0, < 2.0)
74
+ rspec-support (~> 3.10.0)
75
+ rspec-support (3.10.3)
76
+ ruby2_keywords (0.0.5)
77
+ simplecov (0.21.2)
78
+ docile (~> 1.1)
79
+ simplecov-html (~> 0.11)
80
+ simplecov_json_formatter (~> 0.1)
81
+ simplecov-html (0.12.3)
82
+ simplecov_json_formatter (0.1.3)
83
+
84
+ PLATFORMS
85
+ ruby
86
+
87
+ DEPENDENCIES
88
+ bundler
89
+ byebug
90
+ panda_doc!
91
+ rake (>= 10.0)
92
+ rspec (~> 3.4)
93
+ simplecov
94
+
95
+ BUNDLED WITH
96
+ 2.2.30
data/README.md CHANGED
@@ -25,8 +25,13 @@ Or install it yourself as:
25
25
 
26
26
  ## Configuration
27
27
 
28
- Please refer to the [Authentication](https://developers.pandadoc.com/#authentication)
29
- documentation to get the idea how to get an access token.
28
+ Both [API-Key](https://developers.pandadoc.com/reference#api-key-authentication-process) and [oAuth2.0 access token](https://developers.pandadoc.com/reference#authentication-process) authentications are supported.
29
+
30
+ ```ruby
31
+ PandaDoc.configure do |config|
32
+ config.api_key = "api key"
33
+ end
34
+ ```
30
35
 
31
36
  ```ruby
32
37
  PandaDoc.configure do |config|
@@ -67,7 +72,7 @@ document.created_at # => #<DateTime: 2016-02-03T14:56:21-08:00>
67
72
  document.updated_at # => #<DateTime: 2016-02-03T14:56:21-08:00>
68
73
  ```
69
74
 
70
- #### Creating a document from attached file
75
+ #### Creating a document from attached file ([API](https://developers.pandadoc.com/reference#create-document-from-pdf))
71
76
 
72
77
  ```ruby
73
78
  file = UploadIO.new("/path/to/file.pdf", "application/pdf")
@@ -92,7 +97,7 @@ document = PandaDoc::Document.create(
92
97
  )
93
98
  ```
94
99
 
95
- #### Creating a document from a template
100
+ #### Creating a document from a template ([API](https://developers.pandadoc.com/reference#create-document-from-pandadoc-template))
96
101
 
97
102
  ```ruby
98
103
  document = PandaDoc::Document.create(
@@ -107,6 +112,10 @@ document = PandaDoc::Document.create(
107
112
  default: false
108
113
  }
109
114
  ],
115
+ tokens: [
116
+ { name: "Token.Name", value: "Token Value" },
117
+ { name: "Token.AnotherName", value: "2021" }
118
+ ],
110
119
  fields: {
111
120
  field_id: {
112
121
  value: "Field 1"
@@ -115,7 +124,7 @@ document = PandaDoc::Document.create(
115
124
  )
116
125
  ```
117
126
 
118
- #### Getting a document status
127
+ #### Getting a document status ([API](https://developers.pandadoc.com/reference#document-status))
119
128
 
120
129
  ```ruby
121
130
  document = PandaDoc::Document.find("UUID")
@@ -124,7 +133,21 @@ document.status # => "draft"
124
133
  document.updated_at # => <DateTime: 2016-02-03T17:41:00-08:00>
125
134
  ```
126
135
 
127
- #### Sending a document
136
+ #### Getting a document details ([API](https://developers.pandadoc.com/reference#document-details))
137
+
138
+ ```ruby
139
+ document = PandaDoc::Document.details("UUID")
140
+
141
+ document.tokens
142
+ => [#<PandaDoc::Objects::Token name="Token.Name" value="Token Value">,
143
+ #<PandaDoc::Objects::Token name="token.another_name" value="2021">]
144
+
145
+ document.fields
146
+ => [#<PandaDoc::Objects::Field uuid="...>,
147
+ #<PandaDoc::Objects::Field uuid="...>]
148
+ ```
149
+
150
+ #### Sending a document ([API](https://developers.pandadoc.com/reference#send-document))
128
151
 
129
152
  ```ruby
130
153
  PandaDoc::Document.send("UUID", message: "A message to include into the email")
@@ -142,6 +165,15 @@ session.id # => "adssdAvyDXBS"
142
165
  session.expires_at # => #<DateTime: 2016-02-03T14:56:21-08:00>
143
166
  ```
144
167
 
168
+ #### Downloading a document ([API](https://developers.pandadoc.com/reference#download-document))
169
+
170
+ ```ruby
171
+ response = PandaDoc::Document.download("uuid")
172
+ file = File.open("document.pdf", "w") do |f|
173
+ response.body
174
+ end
175
+ ```
176
+
145
177
  #### Error handling
146
178
 
147
179
  If an error occurs during an API request it will be wrapped into a plain ruby
@@ -1,15 +1,15 @@
1
- require "json"
1
+ # frozen_string_literal: true
2
2
 
3
3
  module PandaDoc
4
4
  class ApiClient
5
5
 
6
6
  class << self
7
- def request(verb, path, **data)
7
+ def request(verb, path, data = {})
8
8
  if file = data.delete(:file)
9
9
  data = { file: file, data: JSON.generate(data) }
10
10
  end
11
11
 
12
- new(multipart: !!file).public_send(verb, path, data)
12
+ new(multipart: !!file).public_send(verb, path, **data)
13
13
  end
14
14
  end
15
15
 
@@ -21,7 +21,11 @@ module PandaDoc
21
21
  def initialize(multipart: false)
22
22
  @url_prefix = "/public/v1"
23
23
  @connection = Faraday.new(PandaDoc.configuration.endpoint) do |conn|
24
- conn.authorization :Bearer, PandaDoc.configuration.access_token
24
+ if PandaDoc.configuration.api_key
25
+ conn.request :authorization, "API-Key", PandaDoc.configuration.api_key
26
+ else
27
+ conn.request :authorization, :Bearer, PandaDoc.configuration.access_token
28
+ end
25
29
 
26
30
  if multipart
27
31
  conn.request :multipart
@@ -39,12 +43,12 @@ module PandaDoc
39
43
  end
40
44
  end
41
45
 
42
- def post(path, **data)
43
- connection.post(normalized_path(path), data)
46
+ def post(path, data = {})
47
+ connection.post(normalized_path(path), **data)
44
48
  end
45
49
 
46
- def get(path, **data)
47
- connection.get(normalized_path(path), data)
50
+ def get(path, data = {})
51
+ connection.get(normalized_path(path), **data)
48
52
  end
49
53
 
50
54
  private
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PandaDoc
4
+ module Coercions
5
+ def self.to_splitted_string(value)
6
+ value.to_s.split(".").last
7
+ end
8
+ end
9
+ end
@@ -1,24 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PandaDoc
2
4
  class Configuration
3
- attr_accessor :access_token
4
- attr_accessor :logger
5
-
6
- def endpoint
7
- "https://api.pandadoc.com"
8
- end
9
- end
10
-
11
- class << self
12
- def configuration
13
- @configuration ||= Configuration.new
14
- end
5
+ extend Dry::Configurable
15
6
 
16
- def configuration=(config)
17
- @configuration = config
18
- end
7
+ setting :access_token
8
+ setting :api_key
9
+ setting :logger
19
10
 
20
- def configure
21
- yield configuration
22
- end
11
+ setting :endpoint, default: "https://api.pandadoc.com"
23
12
  end
24
13
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PandaDoc
2
4
  module Document
3
5
  extend self
@@ -14,6 +16,10 @@ module PandaDoc
14
16
  respond(ApiClient.request(:get, "/documents/#{uuid}"))
15
17
  end
16
18
 
19
+ def details(uuid)
20
+ respond(ApiClient.request(:get, "/documents/#{uuid}/details"))
21
+ end
22
+
17
23
  def session(uuid, **data)
18
24
  respond(
19
25
  ApiClient.request(:post, "/documents/#{uuid}/session", data),
@@ -31,7 +37,7 @@ module PandaDoc
31
37
  failure(response)
32
38
 
33
39
  SuccessResult.new(
34
- ResponseFactory.new(type).build.from_hash(response.body)
40
+ ResponseFactory.build(type).new(response.body)
35
41
  )
36
42
  end
37
43
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PandaDoc
2
4
  class FailureResult < StandardError
3
5
  extend Forwardable
@@ -11,7 +13,7 @@ module PandaDoc
11
13
 
12
14
  def initialize(response)
13
15
  @response = response
14
- @error = Responses::Error.new(Objects::Error.new).from_hash(response.body)
16
+ @error = Objects::Error.new(response.body)
15
17
  end
16
18
 
17
19
  def to_s
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PandaDoc
4
+ module Objects
5
+ class Base < Dry::Struct
6
+ transform_keys(&:to_sym)
7
+ end
8
+ end
9
+ end
@@ -1,14 +1,24 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PandaDoc
2
4
  module Objects
3
- class Document
4
- include Virtus.model
5
+ class Document < Base
6
+ attribute :id, Types::String
7
+ attribute? :uuid, Types::String
8
+ attribute :status, Types::Custom::DocumentStatus
9
+ attribute :name, Types::String
10
+ attribute? :recipients, Types::Array.of(Objects::Recipient)
11
+ attribute :date_created, Types::Params::DateTime
12
+ attribute :date_modified, Types::Params::DateTime
13
+ attribute? :expiration_date, Types::Params::DateTime.optional
14
+ attribute :version, Types::String.optional
15
+
16
+ attribute? :tokens, Types::Array.of(Objects::Token)
17
+ attribute? :fields, Types::Array.of(Objects::Field)
5
18
 
6
- attribute :uuid, String
7
- attribute :status, Objects::Status
8
- attribute :name, String
9
- attribute :recipients, Array[Objects::Recipient]
10
- attribute :created_at, DateTime
11
- attribute :updated_at, DateTime
19
+ alias_method :created_at, :date_created
20
+ alias_method :updated_at, :date_modified
21
+ alias_method :expires_at, :expiration_date
12
22
  end
13
23
  end
14
24
  end
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PandaDoc
2
4
  module Objects
3
- class Error
4
- include Virtus.model
5
-
6
- attribute :type, String
7
- attribute :detail, String
5
+ class Error < Base
6
+ attribute? :type, Types::Coercible::String.optional
7
+ attribute? :detail, Types::Params::Hash.optional | Types::Coercible::String.optional
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PandaDoc
4
+ module Objects
5
+ class Field < Base
6
+ attribute :uuid, Types::Coercible::String
7
+ attribute :name, Types::Coercible::String.optional
8
+ attribute :title, Types::Coercible::String.optional
9
+ attribute? :placeholder, Types::Coercible::String.optional
10
+ attribute :value, Types::Nil | Types::Hash | Types::Coercible::String
11
+ attribute? :assigned_to, PandaDoc::Objects::Recipient
12
+ end
13
+ end
14
+ end
@@ -1,13 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PandaDoc
2
4
  module Objects
3
- class Recipient
4
- include Virtus.model
5
-
6
- attribute :email, String
7
- attribute :first_name, String
8
- attribute :last_name, String
9
- attribute :recipient_type, String
10
- attribute :has_completed, Axiom::Types::Boolean
5
+ class Recipient < Base
6
+ attribute? :id, Types::Coercible::String.optional
7
+ attribute :email, Types::Coercible::String
8
+ attribute :first_name, Types::Coercible::String.optional
9
+ attribute :last_name, Types::Coercible::String.optional
10
+ attribute :recipient_type, Types::Coercible::String
11
+ attribute :has_completed, Types::Params::Bool
12
+ attribute? :role, Types::Coercible::String.optional
13
+ attribute? :type, Types::Coercible::String.optional
11
14
  end
12
15
  end
13
16
  end
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PandaDoc
2
4
  module Objects
3
- class Session
4
- include Virtus.model
5
-
6
- attribute :id, String
7
- attribute :expires_at, DateTime
5
+ class Session < Base
6
+ attribute :id, Types::Coercible::String
7
+ attribute :expires_at, Types::Params::DateTime
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PandaDoc
4
+ module Objects
5
+ class Token < Base
6
+ attribute :name, Types::Coercible::String.optional
7
+ attribute? :value, Types::Coercible::String.optional
8
+ end
9
+ end
10
+ end
@@ -1,28 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PandaDoc
2
4
  class ResponseFactory
3
5
  attr_reader :type
4
6
  private :type
5
7
 
8
+ def self.build(type)
9
+ new(type).build
10
+ end
11
+
6
12
  def initialize(type)
7
13
  @type = type.capitalize
8
14
  end
9
15
 
10
16
  def build
11
- response_class.new(object_class.new)
12
- end
13
-
14
- private
15
-
16
- def response_class
17
- class_for("Responses")
18
- end
19
-
20
- def object_class
21
- class_for("Objects")
22
- end
23
-
24
- def class_for(namespace)
25
- Object.const_get("PandaDoc::#{namespace}::#{type}")
17
+ PandaDoc::Objects.const_get(type)
26
18
  end
27
19
  end
28
20
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PandaDoc
2
4
  class SuccessResult
3
5
  attr_reader :object
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PandaDoc
4
+ module Types
5
+ include Dry.Types()
6
+
7
+ module Custom
8
+ DocumentStatus = Dry::Types["nominal.string"].constructor(
9
+ Coercions.method(:to_splitted_string)
10
+ )
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PandaDoc
2
- VERSION = "0.4.3"
4
+ VERSION = "0.5.3"
3
5
  end
data/lib/panda_doc.rb CHANGED
@@ -1,27 +1,39 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "forwardable"
4
+ require "json"
2
5
 
3
6
  require "faraday"
4
7
  require "faraday_middleware"
5
- require "virtus"
6
- require "representable/hash"
8
+ require "dry-struct"
9
+ require "dry-configurable"
7
10
 
8
11
  require "panda_doc/api_client"
9
12
  require "panda_doc/configuration"
13
+ require "panda_doc/coercions"
14
+ require "panda_doc/types"
10
15
  require "panda_doc/failure_result"
11
16
  require "panda_doc/success_result"
12
17
  require "panda_doc/document"
13
18
  require "panda_doc/response_factory"
14
- require "panda_doc/objects/status"
19
+ require "panda_doc/objects/base"
15
20
  require "panda_doc/objects/recipient"
21
+ require "panda_doc/objects/token"
22
+ require "panda_doc/objects/field"
16
23
  require "panda_doc/objects/document"
17
24
  require "panda_doc/objects/error"
18
25
  require "panda_doc/objects/session"
19
- require "panda_doc/responses/document"
20
- require "panda_doc/responses/error"
21
- require "panda_doc/responses/session"
22
26
 
23
27
  require "panda_doc/version"
24
28
 
25
29
  module PandaDoc
26
- # Your code goes here...
30
+ class << self
31
+ def configure(&block)
32
+ Configuration.configure(&block)
33
+ end
34
+
35
+ def configuration
36
+ Configuration.config
37
+ end
38
+ end
27
39
  end
data/panda_doc.gemspec CHANGED
@@ -1,7 +1,6 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'panda_doc/version'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/panda_doc/version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = "panda_doc"
@@ -16,13 +15,13 @@ Gem::Specification.new do |spec|
16
15
  spec.license = "MIT"
17
16
 
18
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
- spec.bindir = "exe"
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.bindir = "bin"
19
+ spec.executables = []
21
20
  spec.require_paths = ["lib"]
22
21
 
23
- spec.required_ruby_version = "~> 2.2"
24
- spec.add_dependency "faraday", "~> 0.9", ">= 0.9.2"
25
- spec.add_dependency "faraday_middleware", "~> 0.10", ">= 0.10.0"
26
- spec.add_dependency "virtus", "~> 1.0", ">= 1.0.5"
27
- spec.add_dependency "representable", ">= 3.0.0"
22
+ spec.required_ruby_version = ">= 2.5"
23
+ spec.add_dependency "faraday", ">= 0.9.2", "< 2.0"
24
+ spec.add_dependency "faraday_middleware", ">= 0.10.0", "< 2.0"
25
+ spec.add_dependency "dry-configurable"
26
+ spec.add_dependency "dry-struct"
28
27
  end
metadata CHANGED
@@ -1,89 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panda_doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Pstyga
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-06 00:00:00.000000000 Z
11
+ date: 2021-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0.9'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: 0.9.2
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '0.9'
30
27
  - - ">="
31
28
  - !ruby/object:Gem::Version
32
29
  version: 0.9.2
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: faraday_middleware
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '0.10'
40
37
  - - ">="
41
38
  - !ruby/object:Gem::Version
42
39
  version: 0.10.0
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '2.0'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '0.10'
50
47
  - - ">="
51
48
  - !ruby/object:Gem::Version
52
49
  version: 0.10.0
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '2.0'
53
53
  - !ruby/object:Gem::Dependency
54
- name: virtus
54
+ name: dry-configurable
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '1.0'
60
57
  - - ">="
61
58
  - !ruby/object:Gem::Version
62
- version: 1.0.5
59
+ version: '0'
63
60
  type: :runtime
64
61
  prerelease: false
65
62
  version_requirements: !ruby/object:Gem::Requirement
66
63
  requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '1.0'
70
64
  - - ">="
71
65
  - !ruby/object:Gem::Version
72
- version: 1.0.5
66
+ version: '0'
73
67
  - !ruby/object:Gem::Dependency
74
- name: representable
68
+ name: dry-struct
75
69
  requirement: !ruby/object:Gem::Requirement
76
70
  requirements:
77
71
  - - ">="
78
72
  - !ruby/object:Gem::Version
79
- version: 3.0.0
73
+ version: '0'
80
74
  type: :runtime
81
75
  prerelease: false
82
76
  version_requirements: !ruby/object:Gem::Requirement
83
77
  requirements:
84
78
  - - ">="
85
79
  - !ruby/object:Gem::Version
86
- version: 3.0.0
80
+ version: '0'
87
81
  description: Ruby wrapper for PandaDoc.com API
88
82
  email:
89
83
  - igor.pstyga@gmail.com
@@ -96,6 +90,7 @@ files:
96
90
  - ".travis.yml"
97
91
  - CHANGELOG.md
98
92
  - Gemfile
93
+ - Gemfile.lock
99
94
  - LICENSE.txt
100
95
  - README.md
101
96
  - Rakefile
@@ -105,43 +100,43 @@ files:
105
100
  - bin/setup
106
101
  - lib/panda_doc.rb
107
102
  - lib/panda_doc/api_client.rb
103
+ - lib/panda_doc/coercions.rb
108
104
  - lib/panda_doc/configuration.rb
109
105
  - lib/panda_doc/document.rb
110
106
  - lib/panda_doc/failure_result.rb
107
+ - lib/panda_doc/objects/base.rb
111
108
  - lib/panda_doc/objects/document.rb
112
109
  - lib/panda_doc/objects/error.rb
110
+ - lib/panda_doc/objects/field.rb
113
111
  - lib/panda_doc/objects/recipient.rb
114
112
  - lib/panda_doc/objects/session.rb
115
- - lib/panda_doc/objects/status.rb
113
+ - lib/panda_doc/objects/token.rb
116
114
  - lib/panda_doc/response_factory.rb
117
- - lib/panda_doc/responses/document.rb
118
- - lib/panda_doc/responses/error.rb
119
- - lib/panda_doc/responses/session.rb
120
115
  - lib/panda_doc/success_result.rb
116
+ - lib/panda_doc/types.rb
121
117
  - lib/panda_doc/version.rb
122
118
  - panda_doc.gemspec
123
119
  homepage: https://github.com/opti/panda_doc
124
120
  licenses:
125
121
  - MIT
126
122
  metadata: {}
127
- post_install_message:
123
+ post_install_message:
128
124
  rdoc_options: []
129
125
  require_paths:
130
126
  - lib
131
127
  required_ruby_version: !ruby/object:Gem::Requirement
132
128
  requirements:
133
- - - "~>"
129
+ - - ">="
134
130
  - !ruby/object:Gem::Version
135
- version: '2.2'
131
+ version: '2.5'
136
132
  required_rubygems_version: !ruby/object:Gem::Requirement
137
133
  requirements:
138
134
  - - ">="
139
135
  - !ruby/object:Gem::Version
140
136
  version: '0'
141
137
  requirements: []
142
- rubyforge_project:
143
- rubygems_version: 2.7.6
144
- signing_key:
138
+ rubygems_version: 3.2.30
139
+ signing_key:
145
140
  specification_version: 4
146
141
  summary: Ruby wrapper for PandaDoc.com API
147
142
  test_files: []
@@ -1,9 +0,0 @@
1
- module PandaDoc
2
- module Objects
3
- class Status < Virtus::Attribute
4
- def coerce(value)
5
- value.to_s.split(".").last
6
- end
7
- end
8
- end
9
- end
@@ -1,21 +0,0 @@
1
- module PandaDoc
2
- module Responses
3
- class Document < Representable::Decorator
4
- include Representable::Hash
5
-
6
- property :uuid
7
- property :status
8
- property :name
9
- property :created_at, as: :date_created
10
- property :updated_at, as: :date_modified
11
-
12
- collection :recipients, class: PandaDoc::Objects::Recipient do
13
- property :email
14
- property :first_name
15
- property :last_name
16
- property :recipient_type
17
- property :has_completed
18
- end
19
- end
20
- end
21
- end
@@ -1,10 +0,0 @@
1
- module PandaDoc
2
- module Responses
3
- class Error < Representable::Decorator
4
- include Representable::Hash
5
-
6
- property :type
7
- property :detail
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- module PandaDoc
2
- module Responses
3
- class Session < Representable::Decorator
4
- include Representable::Hash
5
-
6
- property :id
7
- property :expires_at
8
- end
9
- end
10
- end