api_client 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/api_client/base.rb +5 -1
- data/lib/api_client/version.rb +1 -1
- data/spec/api_client/base/parsing_spec.rb +7 -5
- metadata +14 -24
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0e2014cdd7bf63e26ed16cee931446d9291fff29
|
4
|
+
data.tar.gz: c558b5f618e206a097dad7c16452ae4b4694d873
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8c9d4cdbfcd4aedc3e344440007813042dd11939d35aad0e09805b191b23cced2c8b49443987dd8eb446dbf2b74e6c224ec16e37cf4c9683ee83f17d0728c0fb
|
7
|
+
data.tar.gz: 17af9c48a1354418b02e239b5ae1a589e7e40558f84ad7ad148da95c5c83c3d207b9c92c5ca8bde1aed843f03e80c5bb60bfa1d4f3af9d5cba0ddaff8ea30850
|
data/lib/api_client/base.rb
CHANGED
@@ -23,7 +23,11 @@ module ApiClient
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def parse(response)
|
26
|
-
|
26
|
+
if response.is_a?(Faraday::Response)
|
27
|
+
return nil if response.status == 204
|
28
|
+
response = response.body
|
29
|
+
end
|
30
|
+
|
27
31
|
if self.format == :json
|
28
32
|
MultiJson.load(response)
|
29
33
|
elsif self.format == :xml
|
data/lib/api_client/version.rb
CHANGED
@@ -27,10 +27,12 @@ describe ApiClient::Base do
|
|
27
27
|
ApiClient::Base.stub(:format).and_return(:json)
|
28
28
|
parsed = ApiClient::Base.parse(response)
|
29
29
|
parsed.should == {"a"=> "1"}
|
30
|
-
|
31
30
|
end
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
it "returns nil if the response is 204" do
|
33
|
+
response = Faraday::Response.new(:body => nil, :status => 204)
|
34
|
+
ApiClient::Base.stub(:format).and_return(:json)
|
35
|
+
parsed = ApiClient::Base.parse(response)
|
36
|
+
parsed.should == nil
|
37
|
+
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,78 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Marcin Bunsch
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-11-05 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: yajl-ruby
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: faraday
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 0.8.1
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 0.8.1
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: hashie
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 2.0.5
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 2.0.5
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: multi_json
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 1.6.1
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 1.6.1
|
78
69
|
description: API client builder
|
@@ -140,25 +131,24 @@ files:
|
|
140
131
|
- spec/support/matchers.rb
|
141
132
|
homepage: ''
|
142
133
|
licenses: []
|
134
|
+
metadata: {}
|
143
135
|
post_install_message:
|
144
136
|
rdoc_options: []
|
145
137
|
require_paths:
|
146
138
|
- lib
|
147
139
|
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
-
none: false
|
149
140
|
requirements:
|
150
|
-
- -
|
141
|
+
- - '>='
|
151
142
|
- !ruby/object:Gem::Version
|
152
143
|
version: '0'
|
153
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
145
|
requirements:
|
156
|
-
- -
|
146
|
+
- - '>='
|
157
147
|
- !ruby/object:Gem::Version
|
158
148
|
version: '0'
|
159
149
|
requirements: []
|
160
150
|
rubyforge_project: api_client
|
161
|
-
rubygems_version:
|
151
|
+
rubygems_version: 2.0.5
|
162
152
|
signing_key:
|
163
153
|
specification_version: 3
|
164
154
|
summary: API client builder
|