panda_doc 0.5.0 → 0.5.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 +4 -4
- data/CHANGELOG.md +16 -1
- data/README.md +31 -4
- data/lib/panda_doc.rb +1 -0
- data/lib/panda_doc/objects/document.rb +1 -0
- data/lib/panda_doc/objects/field.rb +14 -0
- data/lib/panda_doc/objects/recipient.rb +3 -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: 9178f289db10d3bf60e5a5ae645ff003d03826d05a6f5fe70d015beb68e6ecc5
|
4
|
+
data.tar.gz: bac876ff0320cf75eac8fe8ec1c9c37992d9aa30961b257313d307fc5ab0314d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d024634cfcb55517bae71a144d8107d9a9d2cb03fa63d022b00c511d5a2f730b86592a0d14a6417db52b895ebea612ec57131e0327268c0167d024f76895a650
|
7
|
+
data.tar.gz: 04144545c90646efe63f32f4c7c02a15b6ed7e00736e5d19b91a01810e886fedffb8036897a2d89f16395c2f3364df38ccb515f306e8a5536594985a6e5ff221
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,20 @@ 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
|
+
|
7
21
|
## [0.5.0][] (2021-01-06)
|
8
22
|
|
9
23
|
New:
|
@@ -149,7 +163,8 @@ Fixes:
|
|
149
163
|
|
150
164
|
- Initial release
|
151
165
|
|
152
|
-
[Unreleased]: https://github.com/opti/panda_doc/compare/v0.5.
|
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
|
153
168
|
[0.5.0]: https://github.com/opti/panda_doc/compare/v0.4.3...v0.5.0
|
154
169
|
[0.4.3]: https://github.com/opti/panda_doc/compare/v0.4.2...v0.4.3
|
155
170
|
[0.4.2]: https://github.com/opti/panda_doc/compare/v0.4.1...v0.4.2
|
data/README.md
CHANGED
@@ -72,7 +72,7 @@ document.created_at # => #<DateTime: 2016-02-03T14:56:21-08:00>
|
|
72
72
|
document.updated_at # => #<DateTime: 2016-02-03T14:56:21-08:00>
|
73
73
|
```
|
74
74
|
|
75
|
-
#### Creating a document from attached file
|
75
|
+
#### Creating a document from attached file ([API](https://developers.pandadoc.com/reference#create-document-from-pdf))
|
76
76
|
|
77
77
|
```ruby
|
78
78
|
file = UploadIO.new("/path/to/file.pdf", "application/pdf")
|
@@ -97,7 +97,7 @@ document = PandaDoc::Document.create(
|
|
97
97
|
)
|
98
98
|
```
|
99
99
|
|
100
|
-
#### Creating a document from a template
|
100
|
+
#### Creating a document from a template ([API](https://developers.pandadoc.com/reference#create-document-from-pandadoc-template))
|
101
101
|
|
102
102
|
```ruby
|
103
103
|
document = PandaDoc::Document.create(
|
@@ -112,6 +112,10 @@ document = PandaDoc::Document.create(
|
|
112
112
|
default: false
|
113
113
|
}
|
114
114
|
],
|
115
|
+
tokens: [
|
116
|
+
{ name: "Token.Name", value: "Token Value" },
|
117
|
+
{ name: "Token.AnotherName", value: "2021" }
|
118
|
+
],
|
115
119
|
fields: {
|
116
120
|
field_id: {
|
117
121
|
value: "Field 1"
|
@@ -120,7 +124,7 @@ document = PandaDoc::Document.create(
|
|
120
124
|
)
|
121
125
|
```
|
122
126
|
|
123
|
-
#### Getting a document status
|
127
|
+
#### Getting a document status ([API](https://developers.pandadoc.com/reference#document-status))
|
124
128
|
|
125
129
|
```ruby
|
126
130
|
document = PandaDoc::Document.find("UUID")
|
@@ -129,7 +133,21 @@ document.status # => "draft"
|
|
129
133
|
document.updated_at # => <DateTime: 2016-02-03T17:41:00-08:00>
|
130
134
|
```
|
131
135
|
|
132
|
-
####
|
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))
|
133
151
|
|
134
152
|
```ruby
|
135
153
|
PandaDoc::Document.send("UUID", message: "A message to include into the email")
|
@@ -147,6 +165,15 @@ session.id # => "adssdAvyDXBS"
|
|
147
165
|
session.expires_at # => #<DateTime: 2016-02-03T14:56:21-08:00>
|
148
166
|
```
|
149
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
|
+
|
150
177
|
#### Error handling
|
151
178
|
|
152
179
|
If an error occurs during an API request it will be wrapped into a plain ruby
|
data/lib/panda_doc.rb
CHANGED
@@ -19,6 +19,7 @@ require "panda_doc/response_factory"
|
|
19
19
|
require "panda_doc/objects/base"
|
20
20
|
require "panda_doc/objects/recipient"
|
21
21
|
require "panda_doc/objects/token"
|
22
|
+
require "panda_doc/objects/field"
|
22
23
|
require "panda_doc/objects/document"
|
23
24
|
require "panda_doc/objects/error"
|
24
25
|
require "panda_doc/objects/session"
|
@@ -14,6 +14,7 @@ module PandaDoc
|
|
14
14
|
attribute :version, Types::String.optional
|
15
15
|
|
16
16
|
attribute? :tokens, Types::Array.of(Objects::Token)
|
17
|
+
attribute? :fields, Types::Array.of(Objects::Field)
|
17
18
|
|
18
19
|
alias_method :created_at, :date_created
|
19
20
|
alias_method :updated_at, :date_modified
|
@@ -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
|
@@ -3,11 +3,14 @@
|
|
3
3
|
module PandaDoc
|
4
4
|
module Objects
|
5
5
|
class Recipient < Base
|
6
|
+
attribute? :id, Types::Coercible::String.optional
|
6
7
|
attribute :email, Types::Coercible::String
|
7
8
|
attribute :first_name, Types::Coercible::String.optional
|
8
9
|
attribute :last_name, Types::Coercible::String.optional
|
9
10
|
attribute :recipient_type, Types::Coercible::String
|
10
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
|
data/lib/panda_doc/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Pstyga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/panda_doc/objects/base.rb
|
107
107
|
- lib/panda_doc/objects/document.rb
|
108
108
|
- lib/panda_doc/objects/error.rb
|
109
|
+
- lib/panda_doc/objects/field.rb
|
109
110
|
- lib/panda_doc/objects/recipient.rb
|
110
111
|
- lib/panda_doc/objects/session.rb
|
111
112
|
- lib/panda_doc/objects/token.rb
|