panda_doc 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: 6ebb23e4abe4534d913bab229afc9e8881a62b53
4
- data.tar.gz: d7f6f1562bd1187790e78ce70a2a262d4f1a5b2a
3
+ metadata.gz: 4621a6a8a2efab6f5b41e286093f2012837c9b90
4
+ data.tar.gz: 3dab341642f68b7992741d399ca47a1a429e41e1
5
5
  SHA512:
6
- metadata.gz: 56b872850b068389570cc8d2662967aba03b84d727666660724656ae1693b022213f928564519d38ff08d754e0d3a2060be1169d58af70fd778d5e75a46f80cf
7
- data.tar.gz: 620ad9bab0834711147428a159c5a84539079117a180feff08885fad886364fe7553721d93642cb766fdf7f5ebef61931632535261553596cafa5c45a871a362
6
+ metadata.gz: f4501378b6c81768d70d80430ce558d41c2ee674200a7396560e60e5b1104d3608baf006962e1f022c06043927dd2f6db5f35596ac97b9205706e6366505bf03
7
+ data.tar.gz: 592cb6a5b941e3e4a59e73c8a088cd0c28b210a9c91ab00da758e078c5706aa91fea3bd82d826ebbdd102f347f97d0e89aa98fbf854e36b9566f860f6ddf71aa
data/CHANGELOG.md CHANGED
@@ -4,8 +4,25 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## 0.0.2 (2016-02-13)
8
+
9
+ New:
10
+
11
+ - Introduce `logger` configuration's option to debug requests/responses.
12
+
13
+ ```ruby
14
+ PandaDoc.configure do |config|
15
+ config.logger = Logger.new(STDOUT)
16
+ end
17
+ ```
18
+
19
+ Fixes:
20
+
21
+ - Add support for simple error structure.
22
+
7
23
  ## 0.0.1 (2016-02-03)
8
24
 
9
25
  - Initial release
10
26
 
11
- [Unreleased]: https://github.com/opti/panda_doc/compare/v0.0.1...HEAD
27
+ [Unreleased]: https://github.com/opti/panda_doc/compare/v0.0.2...HEAD
28
+ [0.0.2]: https://github.com/opti/panda_doc/compare/v0.0.1...v0.0.2
data/README.md CHANGED
@@ -123,6 +123,16 @@ else
123
123
  end
124
124
  ```
125
125
 
126
+ #### Debuging
127
+
128
+ You can configure a logger if you need to debug your requests/responses
129
+
130
+ ```ruby
131
+ PandaDoc.configure do |config|
132
+ config.logger = Logger.new(STDOUT)
133
+ end
134
+ ```
135
+
126
136
  ## Development
127
137
 
128
138
  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.
@@ -17,6 +17,9 @@ module PandaDoc
17
17
  @connection = Faraday.new(PandaDoc.configuration.endpoint) do |conn|
18
18
  conn.authorization :Bearer, PandaDoc.configuration.access_token
19
19
  conn.request :json
20
+ if PandaDoc.configuration.logger
21
+ conn.response :logger, PandaDoc.configuration.logger, bodies: true
22
+ end
20
23
  conn.response :json, content_type: /\bjson$/
21
24
  conn.adapter Faraday.default_adapter
22
25
  end
@@ -1,6 +1,7 @@
1
1
  module PandaDoc
2
2
  class Configuration
3
3
  attr_accessor :access_token
4
+ attr_accessor :logger
4
5
 
5
6
  def endpoint
6
7
  "https://api.pandadoc.com"
@@ -5,7 +5,12 @@ module PandaDoc
5
5
 
6
6
  property :type
7
7
 
8
- nested :detail do
8
+ property :message, as: :detail,
9
+ skip_parse: ->(doc:, **) { doc["detail"].is_a?(Hash) }
10
+
11
+ nested :detail, skip_parse: ->(doc:, **) {
12
+ doc["detail"].is_a?(String)
13
+ } do
9
14
  property :message
10
15
  property :code
11
16
  end
@@ -1,3 +1,3 @@
1
1
  module PandaDoc
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Pstyga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-03 00:00:00.000000000 Z
11
+ date: 2016-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday