gds-api-adapters 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,12 +25,12 @@ module GdsApi
25
25
  if to_hash.has_key?(method.to_s)
26
26
  to_ostruct.send(method)
27
27
  else
28
- super
28
+ nil
29
29
  end
30
30
  end
31
31
 
32
32
  def respond_to_missing?(method)
33
- to_hash.has_key?(method.to_s) || super
33
+ true
34
34
  end
35
35
 
36
36
  private
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '0.0.26'
2
+ VERSION = '0.0.27'
3
3
  end
@@ -83,6 +83,14 @@ class JsonClientTest < MiniTest::Spec
83
83
  response = @client.put_json(url, payload)
84
84
  assert_equal 2, response.a.b
85
85
  end
86
+
87
+ def test_accessing_non_existent_attribute_of_response_returns_nil
88
+ url = "http://some.endpoint/some.json"
89
+ stub_request(:put, url).to_return(:body => '{"a":1}', :status => 200)
90
+ response = @client.put_json(url, {})
91
+ assert_equal nil, response.does_not_exist
92
+ end
93
+
86
94
 
87
95
  def test_client_can_use_basic_auth
88
96
  client = GdsApi::JsonClient.new(basic_auth: {user: 'user', password: 'password'})
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.26
5
+ version: 0.0.27
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Stewart
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-01-10 00:00:00 Z
13
+ date: 2012-01-11 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: plek
@@ -160,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
160
  requirements:
161
161
  - - ">="
162
162
  - !ruby/object:Gem::Version
163
- hash: -3364287350249021531
163
+ hash: -1974159379979390999
164
164
  segments:
165
165
  - 0
166
166
  version: "0"
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - ">="
171
171
  - !ruby/object:Gem::Version
172
- hash: -3364287350249021531
172
+ hash: -1974159379979390999
173
173
  segments:
174
174
  - 0
175
175
  version: "0"