panda_doc 0.2.1 → 0.3.0
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 +17 -1
- data/README.md +5 -6
- data/lib/panda_doc/document.rb +1 -1
- data/lib/panda_doc/failure_result.rb +6 -1
- data/lib/panda_doc/version.rb +1 -1
- metadata +2 -3
- data/bin/rspec +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d46e1363f6a1b416eb2f04311fe60934c973faa3
|
4
|
+
data.tar.gz: 43e4790a1cf556272115627686f3af5975a076a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e812108468ec7cf00312452b9d84b53fb6802e10335193c1b038885f37fbf47d8388654802dbda4af1aa451ddc47819ecdcd4a2fe4cf8aa605e9af5a6a70ede3
|
7
|
+
data.tar.gz: 7f4f4463daa0c61ae96220847fb272b182851c13afb9c656f37926a6538c208923fb341cba3a8d35fd2ffad3d9bc4a39a26c13f3cf7ff7506b7e2471059f5d71
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
+
## [0.3.0][] (2016-02-20)
|
8
|
+
|
9
|
+
### API change:
|
10
|
+
|
11
|
+
- Raise error on failed response.
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
begin
|
15
|
+
PandaDoc::Document.create(name: "Sample")
|
16
|
+
rescue PandaDoc::FailureResult => e
|
17
|
+
puts e.detail
|
18
|
+
puts e.response
|
19
|
+
end
|
20
|
+
```
|
21
|
+
|
7
22
|
## [0.2.0][] (2016-02-18)
|
8
23
|
|
9
24
|
New:
|
@@ -43,7 +58,8 @@ Fixes:
|
|
43
58
|
|
44
59
|
- Initial release
|
45
60
|
|
46
|
-
[Unreleased]: https://github.com/opti/panda_doc/compare/v0.
|
61
|
+
[Unreleased]: https://github.com/opti/panda_doc/compare/v0.3.0...HEAD
|
62
|
+
[0.3.0]: https://github.com/opti/panda_doc/compare/v0.2.0...v0.3.0
|
47
63
|
[0.2.0]: https://github.com/opti/panda_doc/compare/v0.1.0...v0.2.0
|
48
64
|
[0.1.0]: https://github.com/opti/panda_doc/compare/v0.0.2...v0.1.0
|
49
65
|
[0.0.2]: https://github.com/opti/panda_doc/compare/v0.0.1...v0.0.2
|
data/README.md
CHANGED
@@ -114,12 +114,11 @@ If an error occurs during an API request it will be wrapped into a plain ruby
|
|
114
114
|
object as well.
|
115
115
|
|
116
116
|
```ruby
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
puts response.error.detail
|
117
|
+
begin
|
118
|
+
PandaDoc::Document.create(name: "Sample Document")
|
119
|
+
rescue PandaDoc::FailureResult => e
|
120
|
+
puts e.detail
|
121
|
+
puts e.response
|
123
122
|
end
|
124
123
|
```
|
125
124
|
|
data/lib/panda_doc/document.rb
CHANGED
@@ -20,7 +20,7 @@ module PandaDoc
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def respond(response, type: :document)
|
23
|
-
|
23
|
+
fail FailureResult.new(response) unless response.success?
|
24
24
|
|
25
25
|
SuccessResult.new(
|
26
26
|
ResponseFactory.new(type).build.from_hash(response.body)
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module PandaDoc
|
2
|
-
class FailureResult
|
2
|
+
class FailureResult < StandardError
|
3
3
|
extend Forwardable
|
4
4
|
def_delegators :response, :status, :success?
|
5
|
+
def_delegators :error, :type, :detail
|
5
6
|
|
6
7
|
attr_reader :error
|
7
8
|
|
@@ -12,5 +13,9 @@ module PandaDoc
|
|
12
13
|
@response = response
|
13
14
|
@error = Responses::Error.new(Objects::Error.new).from_hash(response.body)
|
14
15
|
end
|
16
|
+
|
17
|
+
def to_s
|
18
|
+
"#{status} #{type}: #{detail}"
|
19
|
+
end
|
15
20
|
end
|
16
21
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Pstyga
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -88,7 +88,6 @@ files:
|
|
88
88
|
- README.md
|
89
89
|
- Rakefile
|
90
90
|
- bin/console
|
91
|
-
- bin/rspec
|
92
91
|
- bin/setup
|
93
92
|
- lib/panda_doc.rb
|
94
93
|
- lib/panda_doc/api_client.rb
|
data/bin/rspec
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'rspec' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require "pathname"
|
10
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require "rubygems"
|
14
|
-
require "bundler/setup"
|
15
|
-
|
16
|
-
load Gem.bin_path("rspec-core", "rspec")
|