panda_doc 0.4.0 → 0.5.1

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
- SHA1:
3
- metadata.gz: 5de18dd847aacd923cd904d156707fc38c75fc46
4
- data.tar.gz: 7484054a9220ccbf5b2aff13d8205e2212f78d4b
2
+ SHA256:
3
+ metadata.gz: 9178f289db10d3bf60e5a5ae645ff003d03826d05a6f5fe70d015beb68e6ecc5
4
+ data.tar.gz: bac876ff0320cf75eac8fe8ec1c9c37992d9aa30961b257313d307fc5ab0314d
5
5
  SHA512:
6
- metadata.gz: f6c816f0ff6a3ab76b697777d47b0366ae328896ae0314c0d34c70fc00ce98e42128a7f86af819d0e893679cdceb4b15df7caf0f6dce204089af13f22c4529da
7
- data.tar.gz: fb01545fd5dfba46f80c15f7614ad9d4024254762b020b5fe20fb25deb1074117fafbe98b0e4641c0202441f1df9fc6d2a41bebb11c1b4d212bb71496fd409d6
6
+ metadata.gz: d024634cfcb55517bae71a144d8107d9a9d2cb03fa63d022b00c511d5a2f730b86592a0d14a6417db52b895ebea612ec57131e0327268c0167d024f76895a650
7
+ data.tar.gz: 04144545c90646efe63f32f4c7c02a15b6ed7e00736e5d19b91a01810e886fedffb8036897a2d89f16395c2f3364df38ccb515f306e8a5536594985a6e5ff221
@@ -1,12 +1,32 @@
1
1
  language: ruby
2
+ os: linux
3
+ dist: xenial
2
4
 
3
5
  cache:
4
6
  - bundler
5
7
 
6
8
  rvm:
7
- - 2.2.4
8
- - 2.3.0
9
+ - 2.5
10
+ - 2.6
11
+ - 2.7
12
+ - 3.0
9
13
 
10
- addons:
11
- code_climate:
12
- repo_token: d1d9c0636042863489880dbdf1c8865721b9b70f4199d612d77ee2dcfc803704
14
+ env:
15
+ global:
16
+ - CC_TEST_REPORTER_ID=d1d9c0636042863489880dbdf1c8865721b9b70f4199d612d77ee2dcfc803704
17
+
18
+ before_install:
19
+ - gem update --system
20
+ - gem install bundler
21
+
22
+ before_script:
23
+ - bundle update
24
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
25
+ - chmod +x ./cc-test-reporter
26
+ - ./cc-test-reporter before-build
27
+
28
+ script:
29
+ - bin/rake
30
+
31
+ after_script:
32
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
@@ -4,6 +4,66 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.5.1][] (2021-01-08)
8
+
9
+ New:
10
+
11
+ - Add `fields` to the document details response:
12
+ ```ruby
13
+ document = PandaDoc::Document.details("uuid")
14
+ document.fields.first.name
15
+ => "Field Name"
16
+
17
+ docuemnt.fields.first.value
18
+ => "Field Value"
19
+ ```
20
+
21
+ ## [0.5.0][] (2021-01-06)
22
+
23
+ New:
24
+
25
+ - Replace virtus with dry-struct.
26
+ - Drop support for ruby < 2.5.
27
+ - Add support for API-Key authentication.
28
+ ```ruby
29
+ PandaDoc.configure do |config|
30
+ config.api_key = "API Key"
31
+ end
32
+ ```
33
+
34
+ - Add `id`, `expiration_date` and `version` to the response Document Object.
35
+ - Add [Document details](https://developers.pandadoc.com/reference#document-details) endpoint
36
+ ```ruby
37
+ document = PandaDoc::Document.details("uuid")
38
+ document.tokens.first.name
39
+ => "Token.Name"
40
+
41
+ docuemnt.tokens.first.value
42
+ => "Token Value"
43
+ ```
44
+
45
+ - Add ruby 3.0 to test coverage.
46
+
47
+ ## [0.4.3][] (2019-03-06)
48
+
49
+ Fixes:
50
+
51
+ - Relax bundler dependency
52
+
53
+ ## [0.4.2][] (2019-03-06)
54
+
55
+ Fixes:
56
+
57
+ - Relax faraday dependency
58
+
59
+ ## [0.4.1][] (2018-04-24)
60
+
61
+ Fixes:
62
+
63
+ - Remove deprecated `codeclimate-test-reporter`. (by @nicolasleger)
64
+ - Add ruby 2.4, 2.5 to test coverage. (by @nicolasleger)
65
+ - Update README with logger examples. (by @nicolasleger)
66
+
7
67
  ## [0.4.0][] (2016-05-19)
8
68
 
9
69
  New:
@@ -89,6 +149,7 @@ New:
89
149
  - Introduce `logger` configuration's option to debug requests/responses.
90
150
 
91
151
  ```ruby
152
+ require 'logger'
92
153
  PandaDoc.configure do |config|
93
154
  config.logger = Logger.new(STDOUT)
94
155
  end
@@ -102,7 +163,12 @@ Fixes:
102
163
 
103
164
  - Initial release
104
165
 
105
- [Unreleased]: https://github.com/opti/panda_doc/compare/v0.4.0...HEAD
166
+ [Unreleased]: https://github.com/opti/panda_doc/compare/v0.5.1...HEAD
167
+ [0.5.1]: https://github.com/opti/panda_doc/compare/v0.5.0...v0.5.1
168
+ [0.5.0]: https://github.com/opti/panda_doc/compare/v0.4.3...v0.5.0
169
+ [0.4.3]: https://github.com/opti/panda_doc/compare/v0.4.2...v0.4.3
170
+ [0.4.2]: https://github.com/opti/panda_doc/compare/v0.4.1...v0.4.2
171
+ [0.4.1]: https://github.com/opti/panda_doc/compare/v0.4.0...v0.4.1
106
172
  [0.4.0]: https://github.com/opti/panda_doc/compare/v0.3.2...v0.4.0
107
173
  [0.3.2]: https://github.com/opti/panda_doc/compare/v0.3.1...v0.3.2
108
174
  [0.3.1]: https://github.com/opti/panda_doc/compare/v0.3.0...v0.3.1
data/Gemfile CHANGED
@@ -3,11 +3,11 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in panda_doc.gemspec
4
4
  gemspec
5
5
 
6
- gem "bundler", "~> 1.11"
6
+ gem "bundler"
7
7
  gem "rake", ">= 10.0"
8
8
  gem "rspec", "~> 3.4"
9
9
  gem "byebug"
10
10
 
11
11
  group :test do
12
- gem "codeclimate-test-reporter", require: false
12
+ gem 'simplecov', require: false
13
13
  end
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
@@ -161,6 +193,7 @@ end
161
193
  You can configure a logger if you need to debug your requests/responses
162
194
 
163
195
  ```ruby
196
+ require 'logger'
164
197
  PandaDoc.configure do |config|
165
198
  config.logger = Logger.new(STDOUT)
166
199
  end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rake", "rake")
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
@@ -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
@@ -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.authorization "API-Key", PandaDoc.configuration.api_key
26
+ else
27
+ conn.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, "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
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.0"
4
+ VERSION = "0.5.1"
3
5
  end
@@ -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.2"
25
- spec.add_dependency "faraday_middleware", "~> 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", "~> 0.11"
26
+ spec.add_dependency "dry-struct", "~> 1.3"
28
27
  end
metadata CHANGED
@@ -1,77 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panda_doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
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: 2016-05-19 00:00:00.000000000 Z
11
+ date: 2021-01-09 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
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.9.2
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: 0.9.2
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: faraday_middleware
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - "~>"
37
+ - - ">="
32
38
  - !ruby/object:Gem::Version
33
39
  version: 0.10.0
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '2.0'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - "~>"
47
+ - - ">="
39
48
  - !ruby/object:Gem::Version
40
49
  version: 0.10.0
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '2.0'
41
53
  - !ruby/object:Gem::Dependency
42
- name: virtus
54
+ name: dry-configurable
43
55
  requirement: !ruby/object:Gem::Requirement
44
56
  requirements:
45
57
  - - "~>"
46
58
  - !ruby/object:Gem::Version
47
- version: '1.0'
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: 1.0.5
59
+ version: '0.11'
51
60
  type: :runtime
52
61
  prerelease: false
53
62
  version_requirements: !ruby/object:Gem::Requirement
54
63
  requirements:
55
64
  - - "~>"
56
65
  - !ruby/object:Gem::Version
57
- version: '1.0'
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: 1.0.5
66
+ version: '0.11'
61
67
  - !ruby/object:Gem::Dependency
62
- name: representable
68
+ name: dry-struct
63
69
  requirement: !ruby/object:Gem::Requirement
64
70
  requirements:
65
- - - ">="
71
+ - - "~>"
66
72
  - !ruby/object:Gem::Version
67
- version: 3.0.0
73
+ version: '1.3'
68
74
  type: :runtime
69
75
  prerelease: false
70
76
  version_requirements: !ruby/object:Gem::Requirement
71
77
  requirements:
72
- - - ">="
78
+ - - "~>"
73
79
  - !ruby/object:Gem::Version
74
- version: 3.0.0
80
+ version: '1.3'
75
81
  description: Ruby wrapper for PandaDoc.com API
76
82
  email:
77
83
  - igor.pstyga@gmail.com
@@ -88,46 +94,48 @@ files:
88
94
  - README.md
89
95
  - Rakefile
90
96
  - bin/console
97
+ - bin/rake
98
+ - bin/rspec
91
99
  - bin/setup
92
100
  - lib/panda_doc.rb
93
101
  - lib/panda_doc/api_client.rb
102
+ - lib/panda_doc/coercions.rb
94
103
  - lib/panda_doc/configuration.rb
95
104
  - lib/panda_doc/document.rb
96
105
  - lib/panda_doc/failure_result.rb
106
+ - lib/panda_doc/objects/base.rb
97
107
  - lib/panda_doc/objects/document.rb
98
108
  - lib/panda_doc/objects/error.rb
109
+ - lib/panda_doc/objects/field.rb
99
110
  - lib/panda_doc/objects/recipient.rb
100
111
  - lib/panda_doc/objects/session.rb
101
- - lib/panda_doc/objects/status.rb
112
+ - lib/panda_doc/objects/token.rb
102
113
  - lib/panda_doc/response_factory.rb
103
- - lib/panda_doc/responses/document.rb
104
- - lib/panda_doc/responses/error.rb
105
- - lib/panda_doc/responses/session.rb
106
114
  - lib/panda_doc/success_result.rb
115
+ - lib/panda_doc/types.rb
107
116
  - lib/panda_doc/version.rb
108
117
  - panda_doc.gemspec
109
118
  homepage: https://github.com/opti/panda_doc
110
119
  licenses:
111
120
  - MIT
112
121
  metadata: {}
113
- post_install_message:
122
+ post_install_message:
114
123
  rdoc_options: []
115
124
  require_paths:
116
125
  - lib
117
126
  required_ruby_version: !ruby/object:Gem::Requirement
118
127
  requirements:
119
- - - "~>"
128
+ - - ">="
120
129
  - !ruby/object:Gem::Version
121
- version: '2.2'
130
+ version: '2.5'
122
131
  required_rubygems_version: !ruby/object:Gem::Requirement
123
132
  requirements:
124
133
  - - ">="
125
134
  - !ruby/object:Gem::Version
126
135
  version: '0'
127
136
  requirements: []
128
- rubyforge_project:
129
- rubygems_version: 2.5.1
130
- signing_key:
137
+ rubygems_version: 3.2.3
138
+ signing_key:
131
139
  specification_version: 4
132
140
  summary: Ruby wrapper for PandaDoc.com API
133
141
  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