quandl_client 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  module Quandl
2
2
  module Client
3
- VERSION = '0.0.10'
3
+ VERSION = '0.0.11'
4
4
  API_VERSION = 'v1'
5
5
 
6
6
  class << self
@@ -6,4 +6,23 @@ module Her
6
6
  remove_method :data=
7
7
  end
8
8
  end
9
+ module Middleware
10
+ class ParseJSON < Faraday::Response::Middleware
11
+ # @private
12
+ def parse_json(body = nil)
13
+ body ||= '{}'
14
+ message = "Response from the API must behave like a Hash or an Array (last JSON response was #{body.inspect})"
15
+
16
+ json = begin
17
+ Yajl.load(body, :symbolize_keys => true)
18
+ rescue MultiJson::LoadError
19
+ raise Her::Errors::ParseError, message
20
+ end
21
+
22
+ raise Her::Errors::ParseError, message unless json.is_a?(Hash) or json.is_a?(Array)
23
+
24
+ json
25
+ end
26
+ end
27
+ end
9
28
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: quandl_client
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.10
5
+ version: 0.0.11
6
6
  platform: ruby
7
7
  authors:
8
8
  - Blkae Hilscher
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-26 00:00:00.000000000 Z
12
+ date: 2013-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake