pandadoc-api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +15 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +69 -0
- data/LICENSE.txt +21 -0
- data/README.md +87 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/pandadoc/api.rb +10 -0
- data/lib/pandadoc/api/document.rb +142 -0
- data/lib/pandadoc/api/template.rb +47 -0
- data/lib/pandadoc/api/version.rb +5 -0
- data/pandadoc-api.gemspec +32 -0
- metadata +145 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '09c26de2431e6568dcca9e67a03a0f0e77e0becf1986ad531d2ba71c16e09b1a'
|
4
|
+
data.tar.gz: 1f7004e861a5144cdb26fba85afa42dda7b7832b62e951a98ce63a735d050225
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 074c2db53cb39ae39a83c4f549e06e65d10a54abbf3188ebe1737951bef6c7d45799d07318186000a705519f42a77ea70e0e92040b6d14b31c847aab9cf6eb86
|
7
|
+
data.tar.gz: 76a5af5b0083a48caf8d09b48201e86f8009d016d6737fec25fe0809fcfe708425eb0004c284cf5c86ddfd92280c4c03df04802149dbc15416adec1ff51b3c6a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at mikecx@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pandadoc-api (0.1.0)
|
5
|
+
httparty (~> 0.16)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.5.2)
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
12
|
+
ast (2.4.0)
|
13
|
+
crack (0.4.3)
|
14
|
+
safe_yaml (~> 1.0.0)
|
15
|
+
diff-lcs (1.3)
|
16
|
+
hashdiff (0.3.7)
|
17
|
+
httparty (0.16.2)
|
18
|
+
multi_xml (>= 0.5.2)
|
19
|
+
jaro_winkler (1.5.1)
|
20
|
+
multi_xml (0.6.0)
|
21
|
+
parallel (1.12.1)
|
22
|
+
parser (2.5.1.2)
|
23
|
+
ast (~> 2.4.0)
|
24
|
+
powerpack (0.1.2)
|
25
|
+
public_suffix (3.0.2)
|
26
|
+
rainbow (3.0.0)
|
27
|
+
rake (10.5.0)
|
28
|
+
rspec (3.7.0)
|
29
|
+
rspec-core (~> 3.7.0)
|
30
|
+
rspec-expectations (~> 3.7.0)
|
31
|
+
rspec-mocks (~> 3.7.0)
|
32
|
+
rspec-core (3.7.1)
|
33
|
+
rspec-support (~> 3.7.0)
|
34
|
+
rspec-expectations (3.7.0)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.7.0)
|
37
|
+
rspec-mocks (3.7.0)
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
+
rspec-support (~> 3.7.0)
|
40
|
+
rspec-support (3.7.1)
|
41
|
+
rubocop (0.58.1)
|
42
|
+
jaro_winkler (~> 1.5.1)
|
43
|
+
parallel (~> 1.10)
|
44
|
+
parser (>= 2.5, != 2.5.1.1)
|
45
|
+
powerpack (~> 0.1)
|
46
|
+
rainbow (>= 2.2.2, < 4.0)
|
47
|
+
ruby-progressbar (~> 1.7)
|
48
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
49
|
+
ruby-progressbar (1.9.0)
|
50
|
+
safe_yaml (1.0.4)
|
51
|
+
unicode-display_width (1.4.0)
|
52
|
+
webmock (3.4.2)
|
53
|
+
addressable (>= 2.3.6)
|
54
|
+
crack (>= 0.3.2)
|
55
|
+
hashdiff
|
56
|
+
|
57
|
+
PLATFORMS
|
58
|
+
ruby
|
59
|
+
|
60
|
+
DEPENDENCIES
|
61
|
+
bundler (~> 1.16)
|
62
|
+
pandadoc-api!
|
63
|
+
rake (~> 10.0)
|
64
|
+
rspec (~> 3.0)
|
65
|
+
rubocop (~> 0.58)
|
66
|
+
webmock (~> 3.4)
|
67
|
+
|
68
|
+
BUNDLED WITH
|
69
|
+
1.16.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Michael Carey
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# Pandadoc::Api [![Build Status](https://secure.travis-ci.org/CatchRelease/pandadoc-api.svg?branch=master)](https://travis-ci.org/CatchRelease/pandadoc-api) [![Gem Version](https://img.shields.io/gem/v/pandadoc-api.svg)](https://rubygems.org/gems/pandadoc-api)
|
2
|
+
|
3
|
+
PandaDoc API is meant to be a simplistic ruby wrapper around the PandaDoc API. It assumes that token management is handled
|
4
|
+
elsewhere and that parsing of the response is up to the user.
|
5
|
+
|
6
|
+
All options to the API Methods are available via the [PandaDoc API Documentation](https://developers.pandadoc.com/v1/reference).
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'pandadoc-api'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install pandadoc-api
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
#### Documents
|
27
|
+
Create a new instance
|
28
|
+
```ruby
|
29
|
+
document_api = Pandadoc::Api::Document.new
|
30
|
+
```
|
31
|
+
|
32
|
+
Call the API
|
33
|
+
```ruby
|
34
|
+
# List Documents
|
35
|
+
document_api.list(token, params = {}) # returns JSON
|
36
|
+
|
37
|
+
# Create Document from PandaDoc Template
|
38
|
+
document_api.create(token, params = {}) # returns JSON
|
39
|
+
|
40
|
+
# Document Status
|
41
|
+
document_api.status(token, document_id) # returns JSON
|
42
|
+
|
43
|
+
# Document Details
|
44
|
+
document_api.details(token, document_id) # returns JSON
|
45
|
+
|
46
|
+
# Send Document
|
47
|
+
document_api.send_doc(token, document_id, params = {}) # returns JSON
|
48
|
+
|
49
|
+
# Create a Document Link
|
50
|
+
document_api.link(token, document_id, params = {}) # returns String
|
51
|
+
|
52
|
+
# Download Document
|
53
|
+
document_api.download(token, document_id) # returns PDF File
|
54
|
+
```
|
55
|
+
|
56
|
+
#### Templates
|
57
|
+
Create a new instance
|
58
|
+
```ruby
|
59
|
+
template_api = Pandadoc::Api::Template.new
|
60
|
+
```
|
61
|
+
|
62
|
+
Call the API
|
63
|
+
```ruby
|
64
|
+
# List Templates
|
65
|
+
template_api.list(token, params = {}) # returns JSON
|
66
|
+
|
67
|
+
# Template Details
|
68
|
+
tempolate_api.details(token, template_id) # returns JSON
|
69
|
+
```
|
70
|
+
|
71
|
+
## Development
|
72
|
+
|
73
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
74
|
+
|
75
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
76
|
+
|
77
|
+
## Contributing
|
78
|
+
|
79
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pandadoc-api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
80
|
+
|
81
|
+
## License
|
82
|
+
|
83
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
84
|
+
|
85
|
+
## Code of Conduct
|
86
|
+
|
87
|
+
Everyone interacting in the Pandadoc::Api project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/pandadoc-api/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'pandadoc/api'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/pandadoc/api.rb
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
class RequiredParameterError < StandardError
|
4
|
+
attr_reader :parameter
|
5
|
+
|
6
|
+
def initialize(message, parameter)
|
7
|
+
# Call the parent's constructor to set the message
|
8
|
+
super(message)
|
9
|
+
|
10
|
+
# Store the action in an instance variable
|
11
|
+
@parameter = parameter
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class ParameterTypeError < StandardError
|
16
|
+
attr_reader :received
|
17
|
+
attr_reader :requested
|
18
|
+
|
19
|
+
def initialize(message, received, requested)
|
20
|
+
# Call the parent's constructor to set the message
|
21
|
+
super(message)
|
22
|
+
|
23
|
+
# Store the action in an instance variable
|
24
|
+
@received = received
|
25
|
+
@requested = requested
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
module Pandadoc
|
30
|
+
module Api
|
31
|
+
class Document
|
32
|
+
DOCUMENT_STATUS_MAP = {
|
33
|
+
'document.draft': 0,
|
34
|
+
'document.sent': 1,
|
35
|
+
'document.completed': 2,
|
36
|
+
'document.viewed': 5,
|
37
|
+
'document.waiting_approval': 6,
|
38
|
+
'document.approved': 7,
|
39
|
+
'document.rejected': 8,
|
40
|
+
'document.waiting_pay': 9,
|
41
|
+
'document.paid': 10,
|
42
|
+
'document.voided': 11
|
43
|
+
}.freeze
|
44
|
+
|
45
|
+
def list(token, params = {})
|
46
|
+
validations = {
|
47
|
+
q: { required: false, type: String },
|
48
|
+
tag: { required: false, type: Integer },
|
49
|
+
status: { required: false, type: Integer },
|
50
|
+
count: { required: false, type: Integer },
|
51
|
+
page: { required: false, type: Integer },
|
52
|
+
metadata: { required: false, type: Hash }
|
53
|
+
}
|
54
|
+
|
55
|
+
HTTParty.get("#{Pandadoc::Api::API_ROOT}/documents",
|
56
|
+
headers: { 'Authorization' => auth_header(token) },
|
57
|
+
query: validated_params(params, validations))
|
58
|
+
end
|
59
|
+
|
60
|
+
def create(token, params = {})
|
61
|
+
validations = {
|
62
|
+
name: { required: true, type: String },
|
63
|
+
template_uuid: { required: true, type: String },
|
64
|
+
recipients: { required: true, type: Array },
|
65
|
+
tokens: { required: false, type: Hash },
|
66
|
+
fields: { required: false, type: Hash },
|
67
|
+
metadata: { required: false, type: Hash },
|
68
|
+
pricing_tables: { required: false, type: Array }
|
69
|
+
}
|
70
|
+
|
71
|
+
HTTParty.post("#{Pandadoc::Api::API_ROOT}/documents",
|
72
|
+
headers: { 'Authorization' => auth_header(token), 'Content-Type': 'application/json' },
|
73
|
+
body: validated_params(params, validations))
|
74
|
+
end
|
75
|
+
|
76
|
+
def status(token, document_id)
|
77
|
+
HTTParty.get("#{Pandadoc::Api::API_ROOT}/documents/#{document_id}",
|
78
|
+
headers: { 'Authorization' => auth_header(token) })
|
79
|
+
end
|
80
|
+
|
81
|
+
def details(token, document_id)
|
82
|
+
HTTParty.get("#{Pandadoc::Api::API_ROOT}/documents/#{document_id}/details",
|
83
|
+
headers: { 'Authorization' => auth_header(token) })
|
84
|
+
end
|
85
|
+
|
86
|
+
# send is already a Ruby thing, overriding it would be bad
|
87
|
+
def send_doc(token, document_id, params = {})
|
88
|
+
validations = {
|
89
|
+
message: { required: false, type: String },
|
90
|
+
silent: { required: false, type: [TrueClass, FalseClass] }
|
91
|
+
}
|
92
|
+
|
93
|
+
HTTParty.post("#{Pandadoc::Api::API_ROOT}/documents/#{document_id}/send",
|
94
|
+
headers: { 'Authorization' => auth_header(token), 'Content-Type': 'application/json' },
|
95
|
+
body: validated_params(params, validations))
|
96
|
+
end
|
97
|
+
|
98
|
+
def link(token, document_id, params = {})
|
99
|
+
validations = {
|
100
|
+
recipient: { required: true, type: String },
|
101
|
+
lifetime: { required: false, type: Integer }
|
102
|
+
}
|
103
|
+
|
104
|
+
response = HTTParty.post("#{Pandadoc::Api::API_ROOT}/documents/#{document_id}/session",
|
105
|
+
headers: { 'Authorization' => auth_header(token), 'Content-Type': 'application/json' },
|
106
|
+
body: validated_params(params, validations))
|
107
|
+
|
108
|
+
json_response = JSON.parse(response.body, symbolize_names: true)
|
109
|
+
session_id = json_response[:id]
|
110
|
+
|
111
|
+
"https://app.pandadoc.com/s/#{session_id}"
|
112
|
+
end
|
113
|
+
|
114
|
+
def download(token, document_id)
|
115
|
+
HTTParty.get("#{Pandadoc::Api::API_ROOT}/documents/#{document_id}/download",
|
116
|
+
headers: { 'Authorization' => auth_header(token) })
|
117
|
+
end
|
118
|
+
|
119
|
+
def auth_header(token)
|
120
|
+
"Bearer #{token}"
|
121
|
+
end
|
122
|
+
|
123
|
+
def validated_params(params, validations)
|
124
|
+
valid_keys = validations.keys
|
125
|
+
valid_params = params.keep_if { |key| valid_keys.include? key }
|
126
|
+
|
127
|
+
validations.each_pair do |key, validators|
|
128
|
+
if validators[:required] == true && valid_params[key].nil?
|
129
|
+
raise RequiredParameterError.new('Missing required parameter', key)
|
130
|
+
end
|
131
|
+
|
132
|
+
validators_type_array = validators[:type].is_a?(Array) ? validators[:type] : [validators[:type]]
|
133
|
+
if valid_params[key] && !validators_type_array.include?(valid_params[key].class)
|
134
|
+
raise ParameterTypeError.new("Invalid parameter type, received #{valid_params[key].class} requested #{validators[:type]}", valid_params[:key].class, validators[:type])
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
valid_params
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
module Pandadoc
|
4
|
+
module Api
|
5
|
+
class Template
|
6
|
+
def list(token, params = {})
|
7
|
+
validations = {
|
8
|
+
q: { required: false, type: String },
|
9
|
+
tag: { required: false, type: Integer },
|
10
|
+
count: { required: false, type: Integer },
|
11
|
+
page: { required: false, type: Integer }
|
12
|
+
}
|
13
|
+
|
14
|
+
HTTParty.get("#{Pandadoc::Api::API_ROOT}/templates",
|
15
|
+
headers: { 'Authorization' => auth_header(token) },
|
16
|
+
query: validated_params(params, validations))
|
17
|
+
end
|
18
|
+
|
19
|
+
def details(token, template_id)
|
20
|
+
HTTParty.get("#{Pandadoc::Api::API_ROOT}/templates/#{template_id}/details",
|
21
|
+
headers: { 'Authorization' => auth_header(token) })
|
22
|
+
end
|
23
|
+
|
24
|
+
def auth_header(token)
|
25
|
+
"Bearer #{token}"
|
26
|
+
end
|
27
|
+
|
28
|
+
def validated_params(params, validations)
|
29
|
+
valid_keys = validations.keys
|
30
|
+
valid_params = params.keep_if { |key| valid_keys.include? key }
|
31
|
+
|
32
|
+
validations.each_pair do |key, validators|
|
33
|
+
if validators[:required] == true && valid_params[key].nil?
|
34
|
+
raise RequiredParameterError.new('Missing required parameter', key)
|
35
|
+
end
|
36
|
+
|
37
|
+
validators_type_array = validators[:type].is_a?(Array) ? validators[:type] : [validators[:type]]
|
38
|
+
if valid_params[key] && !validators_type_array.include?(valid_params[key].class)
|
39
|
+
raise ParameterTypeError.new("Invalid parameter type, received #{valid_params[key].class} requested #{validators[:type]}", valid_params[:key].class, validators[:type])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
valid_params
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'pandadoc/api/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'pandadoc-api'
|
7
|
+
spec.version = Pandadoc::Api::VERSION
|
8
|
+
spec.authors = ['Michael Carey']
|
9
|
+
spec.email = ['mike@catchandrelease.com']
|
10
|
+
|
11
|
+
spec.summary = 'Ruby API Wrapper for the PandaDoc API'
|
12
|
+
spec.description = 'Ruby API Wrapper for the PandaDoc API'
|
13
|
+
spec.homepage = 'http://github.com/CatchRelease/pandadoc-api'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_dependency 'httparty', '~> 0.16'
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
spec.add_development_dependency 'rubocop', '~> 0.58'
|
31
|
+
spec.add_development_dependency 'webmock', '~> 3.4'
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pandadoc-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Carey
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-07-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.16'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.58'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.58'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.4'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.4'
|
97
|
+
description: Ruby API Wrapper for the PandaDoc API
|
98
|
+
email:
|
99
|
+
- mike@catchandrelease.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".rubocop.yml"
|
107
|
+
- ".travis.yml"
|
108
|
+
- CODE_OF_CONDUCT.md
|
109
|
+
- Gemfile
|
110
|
+
- Gemfile.lock
|
111
|
+
- LICENSE.txt
|
112
|
+
- README.md
|
113
|
+
- Rakefile
|
114
|
+
- bin/console
|
115
|
+
- bin/setup
|
116
|
+
- lib/pandadoc/api.rb
|
117
|
+
- lib/pandadoc/api/document.rb
|
118
|
+
- lib/pandadoc/api/template.rb
|
119
|
+
- lib/pandadoc/api/version.rb
|
120
|
+
- pandadoc-api.gemspec
|
121
|
+
homepage: http://github.com/CatchRelease/pandadoc-api
|
122
|
+
licenses:
|
123
|
+
- MIT
|
124
|
+
metadata: {}
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubyforge_project:
|
141
|
+
rubygems_version: 2.7.6
|
142
|
+
signing_key:
|
143
|
+
specification_version: 4
|
144
|
+
summary: Ruby API Wrapper for the PandaDoc API
|
145
|
+
test_files: []
|