active_rest_client 0.9.72 → 0.9.73
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/active_rest_client.gemspec +1 -1
- data/lib/active_rest_client/lazy_association_loader.rb +1 -1
- data/lib/active_rest_client/proxy_base.rb +1 -1
- data/lib/active_rest_client/request.rb +3 -3
- data/lib/active_rest_client/version.rb +1 -1
- data/spec/lib/base_spec.rb +2 -2
- data/spec/lib/request_spec.rb +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 460632a3d6da332f38436d8c4d578253dc3a0f2e
|
4
|
+
data.tar.gz: a44d3ca33dcca47286b5fc69f420d72028062616
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ccb4c9ad92d157a9996be9d79824f03d143156707b2526761df89dbc08666c173ae0fda3865ab471c5355f107d8b08ceaf981942b560ea0babbd0fd1994c0c5
|
7
|
+
data.tar.gz: d42484ef26ea1c377db1bee2dd6977c6e9bf82d9b4618e646765a1a8f8b417f2dd28aa09390734a4e4bd275fa0e00a219d20283528c56756bc1fd60a004c8f82
|
data/active_rest_client.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'terminal-notifier-guard'
|
31
31
|
spec.add_development_dependency 'coveralls'
|
32
32
|
|
33
|
-
spec.add_runtime_dependency "
|
33
|
+
spec.add_runtime_dependency "multi_json"
|
34
34
|
spec.add_runtime_dependency "activesupport"
|
35
35
|
spec.add_runtime_dependency "faraday", "~> 0.9"
|
36
36
|
spec.add_runtime_dependency "patron", ">= 0.4.9" # 0.4.18 breaks against Curl v0.7.15 but works with webmock
|
@@ -80,7 +80,7 @@ module ActiveRestClient
|
|
80
80
|
|
81
81
|
def ensure_lazy_loaded
|
82
82
|
if @object.nil?
|
83
|
-
method =
|
83
|
+
method = MultiJson.load(MultiJson.dump(@request.method),:symbolize_keys => true)
|
84
84
|
method[:method] = :get
|
85
85
|
method[:options][:url] = @url
|
86
86
|
method[:options][:overriden_name] = @options[:overriden_name]
|
@@ -69,7 +69,7 @@ module ActiveRestClient
|
|
69
69
|
def translate(result, options = {})
|
70
70
|
result.headers["content-type"] = "application/hal+json"
|
71
71
|
result = OpenStruct.new(status:result.status, headers:result.headers, body:result.body)
|
72
|
-
obj =
|
72
|
+
obj = MultiJson.load(result.body)
|
73
73
|
result.body = yield obj
|
74
74
|
result
|
75
75
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "cgi"
|
2
|
-
require "
|
2
|
+
require "multi_json"
|
3
3
|
|
4
4
|
module ActiveRestClient
|
5
5
|
|
@@ -267,7 +267,7 @@ module ActiveRestClient
|
|
267
267
|
if response.body.is_a?(Array) || response.body.is_a?(Hash)
|
268
268
|
body = response.body
|
269
269
|
else
|
270
|
-
body =
|
270
|
+
body = MultiJson.load(response.body) || {}
|
271
271
|
end
|
272
272
|
body = begin
|
273
273
|
@method[:name].nil? ? body : translator.send(@method[:name], body)
|
@@ -302,7 +302,7 @@ module ActiveRestClient
|
|
302
302
|
end
|
303
303
|
|
304
304
|
result
|
305
|
-
rescue
|
305
|
+
rescue MultiJson::ParseError
|
306
306
|
raise ResponseParseException.new(status:response.status, body:response.body)
|
307
307
|
end
|
308
308
|
|
data/spec/lib/base_spec.rb
CHANGED
@@ -276,11 +276,11 @@ describe ActiveRestClient::Base do
|
|
276
276
|
let(:location) { EmptyExample.new(place:"Room 1408") }
|
277
277
|
let(:lazy) { Laz }
|
278
278
|
let(:object) { EmptyExample.new(name:"Programming 101", location:location, students:[student1, student2]) }
|
279
|
-
let(:json_parsed_object) {
|
279
|
+
let(:json_parsed_object) { MultiJson.load(object.to_json) }
|
280
280
|
|
281
281
|
it "should be able to export to valid json" do
|
282
282
|
expect(object.to_json).to_not be_blank
|
283
|
-
expect{
|
283
|
+
expect{MultiJson.load(object.to_json)}.to_not raise_error
|
284
284
|
end
|
285
285
|
|
286
286
|
it "should not be using Object's #to_json method" do
|
data/spec/lib/request_spec.rb
CHANGED
@@ -39,7 +39,7 @@ describe ActiveRestClient::Request do
|
|
39
39
|
class FilteredBodyExampleClient < ExampleClient
|
40
40
|
base_url "http://www.example.com"
|
41
41
|
before_request do |name, request|
|
42
|
-
request.body =
|
42
|
+
request.body = MultiJson.dump(request.post_params)
|
43
43
|
end
|
44
44
|
|
45
45
|
post :save, "/save"
|
@@ -472,7 +472,7 @@ describe ActiveRestClient::Request do
|
|
472
472
|
end
|
473
473
|
|
474
474
|
it "replaces the body completely in a filter" do
|
475
|
-
ActiveRestClient::Connection.any_instance.should_receive(:post).with("/save", "{\"
|
475
|
+
ActiveRestClient::Connection.any_instance.should_receive(:post).with("/save", "{\"id\":1234,\"name\":\"john\"}", an_instance_of(Hash)).and_return(OpenStruct.new(body:"{}", headers:{}))
|
476
476
|
FilteredBodyExampleClient.save id:1234, name:'john'
|
477
477
|
end
|
478
478
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_rest_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.73
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Which Ltd
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -152,19 +152,19 @@ dependencies:
|
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
|
-
name:
|
155
|
+
name: multi_json
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
|
-
- -
|
158
|
+
- - ">="
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version:
|
160
|
+
version: '0'
|
161
161
|
type: :runtime
|
162
162
|
prerelease: false
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
|
-
- -
|
165
|
+
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
version:
|
167
|
+
version: '0'
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: activesupport
|
170
170
|
requirement: !ruby/object:Gem::Requirement
|