hullio 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/hull/connection.rb +2 -1
- data/lib/hull/response/parse_json.rb +15 -0
- data/lib/hull/version.rb +1 -1
- metadata +3 -2
data/lib/hull/connection.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
require 'hull/request/auth'
|
3
|
+
require 'hull/response/parse_json'
|
3
4
|
require 'faraday_middleware/response/parse_json'
|
4
5
|
require 'faraday_middleware/response/caching'
|
5
6
|
|
@@ -27,7 +28,7 @@ module Hull
|
|
27
28
|
builder.use Hull::Request::Auth, credentials
|
28
29
|
builder.use Faraday::Request::UrlEncoded
|
29
30
|
builder.use FaradayMiddleware::Caching, cache_store unless cache_store.nil?
|
30
|
-
builder.use
|
31
|
+
builder.use Hull::Response::ParseJson
|
31
32
|
builder.use Faraday::Response::RaiseError
|
32
33
|
builder.adapter(adapter)
|
33
34
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'faraday_middleware/response_middleware'
|
2
|
+
|
3
|
+
module Hull::Response
|
4
|
+
|
5
|
+
class ParseJson < FaradayMiddleware::ResponseMiddleware
|
6
|
+
dependency do
|
7
|
+
require 'multi_json'
|
8
|
+
end
|
9
|
+
|
10
|
+
define_parser do |body|
|
11
|
+
MultiJson.load body unless body.strip.empty?
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
data/lib/hull/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hullio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-11-
|
13
|
+
date: 2013-11-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/hull/paywall.rb
|
121
121
|
- lib/hull/request.rb
|
122
122
|
- lib/hull/request/auth.rb
|
123
|
+
- lib/hull/response/parse_json.rb
|
123
124
|
- lib/hull/version.rb
|
124
125
|
- lib/hullio.rb
|
125
126
|
homepage: http://hull.io
|