gds-api-adapters 5.0.0 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -98,7 +98,7 @@ module GdsApi
98
98
  def do_json_request(method, url, params = nil, &create_response)
99
99
 
100
100
  begin
101
- response = do_request_with_cache(method, url, params.to_json)
101
+ response = do_request_with_cache(method, url, (params.to_json if params))
102
102
 
103
103
  rescue RestClient::ResourceNotFound => e
104
104
  raise GdsApi::HTTPNotFound.new(e.http_code)
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '5.0.0'
2
+ VERSION = '5.0.1'
3
3
  end
@@ -347,6 +347,12 @@ class JsonClientTest < MiniTest::Spec
347
347
  assert_equal({}, @client.put_json(url, payload).to_hash)
348
348
  end
349
349
 
350
+ def test_does_not_encode_json_if_payload_is_nil
351
+ url = "http://some.endpoint/some.json"
352
+ stub_request(:put, url).with(body: nil).to_return(:body => "{}", :status => 200)
353
+ assert_equal({}, @client.put_json(url, nil).to_hash)
354
+ end
355
+
350
356
  def test_can_build_custom_response_object
351
357
  url = "http://some.endpoint/some.json"
352
358
  stub_request(:get, url).to_return(:body => "Hello there!")
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 5.0.0
5
+ version: 5.0.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Stewart
@@ -188,50 +188,50 @@ extra_rdoc_files: []
188
188
 
189
189
  files:
190
190
  - lib/gds_api/version.rb
191
- - lib/gds_api/publisher.rb
191
+ - lib/gds_api/base.rb
192
+ - lib/gds_api/licence_application.rb
192
193
  - lib/gds_api/panopticon/registerer.rb
193
- - lib/gds_api/asset_manager.rb
194
- - lib/gds_api/content_api.rb
194
+ - lib/gds_api/needotron.rb
195
195
  - lib/gds_api/imminence.rb
196
- - lib/gds_api/test_helpers/publisher.rb
197
- - lib/gds_api/test_helpers/asset_manager.rb
198
- - lib/gds_api/test_helpers/content_api.rb
199
- - lib/gds_api/test_helpers/imminence.rb
200
- - lib/gds_api/test_helpers/licence_application.rb
201
- - lib/gds_api/test_helpers/mapit.rb
202
- - lib/gds_api/test_helpers/content_api/artefact_stub.rb
203
- - lib/gds_api/test_helpers/panopticon.rb
204
- - lib/gds_api/test_helpers/json_client_helper.rb
205
- - lib/gds_api/licence_application.rb
206
- - lib/gds_api/base.rb
196
+ - lib/gds_api/rummager.rb
197
+ - lib/gds_api/content_api.rb
207
198
  - lib/gds_api/mapit.rb
199
+ - lib/gds_api/exceptions.rb
208
200
  - lib/gds_api/json_client.rb
201
+ - lib/gds_api/core-ext/openstruct.rb
209
202
  - lib/gds_api/response.rb
210
203
  - lib/gds_api/content_api/list_response.rb
211
204
  - lib/gds_api/content_api/response.rb
212
- - lib/gds_api/rummager.rb
213
- - lib/gds_api/panopticon.rb
214
- - lib/gds_api/core-ext/openstruct.rb
205
+ - lib/gds_api/publisher.rb
206
+ - lib/gds_api/test_helpers/licence_application.rb
207
+ - lib/gds_api/test_helpers/imminence.rb
208
+ - lib/gds_api/test_helpers/content_api.rb
209
+ - lib/gds_api/test_helpers/mapit.rb
210
+ - lib/gds_api/test_helpers/content_api/artefact_stub.rb
211
+ - lib/gds_api/test_helpers/publisher.rb
212
+ - lib/gds_api/test_helpers/asset_manager.rb
213
+ - lib/gds_api/test_helpers/panopticon.rb
214
+ - lib/gds_api/test_helpers/json_client_helper.rb
215
215
  - lib/gds_api/part_methods.rb
216
- - lib/gds_api/needotron.rb
217
- - lib/gds_api/exceptions.rb
216
+ - lib/gds_api/asset_manager.rb
217
+ - lib/gds_api/panopticon.rb
218
218
  - lib/gds_api/helpers.rb
219
219
  - README.md
220
220
  - Rakefile
221
- - test/panopticon_api_test.rb
221
+ - test/rummager_test.rb
222
222
  - test/publisher_api_test.rb
223
+ - test/content_api_response_test.rb
224
+ - test/licence_application_api_test.rb
223
225
  - test/mapit_test.rb
224
- - test/rummager_test.rb
226
+ - test/panopticon_api_test.rb
225
227
  - test/imminence_api_test.rb
226
- - test/panopticon_registerer_test.rb
227
- - test/content_api_test.rb
228
- - test/asset_manager_test.rb
229
- - test/content_api_response_test.rb
230
228
  - test/json_client_test.rb
231
- - test/gds_api_base_test.rb
232
- - test/licence_application_api_test.rb
233
- - test/fixtures/hello.txt
234
229
  - test/test_helper.rb
230
+ - test/fixtures/hello.txt
231
+ - test/asset_manager_test.rb
232
+ - test/gds_api_base_test.rb
233
+ - test/content_api_test.rb
234
+ - test/panopticon_registerer_test.rb
235
235
  homepage: http://github.com/alphagov/gds-api-adapters
236
236
  licenses: []
237
237
 
@@ -245,7 +245,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
245
245
  requirements:
246
246
  - - ">="
247
247
  - !ruby/object:Gem::Version
248
- hash: 2029378621472477619
248
+ hash: -4331553469349136654
249
249
  segments:
250
250
  - 0
251
251
  version: "0"
@@ -254,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
254
  requirements:
255
255
  - - ">="
256
256
  - !ruby/object:Gem::Version
257
- hash: 2029378621472477619
257
+ hash: -4331553469349136654
258
258
  segments:
259
259
  - 0
260
260
  version: "0"
@@ -266,17 +266,17 @@ signing_key:
266
266
  specification_version: 3
267
267
  summary: Adapters to work with GDS APIs
268
268
  test_files:
269
- - test/panopticon_api_test.rb
269
+ - test/rummager_test.rb
270
270
  - test/publisher_api_test.rb
271
+ - test/content_api_response_test.rb
272
+ - test/licence_application_api_test.rb
271
273
  - test/mapit_test.rb
272
- - test/rummager_test.rb
274
+ - test/panopticon_api_test.rb
273
275
  - test/imminence_api_test.rb
274
- - test/panopticon_registerer_test.rb
275
- - test/content_api_test.rb
276
- - test/asset_manager_test.rb
277
- - test/content_api_response_test.rb
278
276
  - test/json_client_test.rb
279
- - test/gds_api_base_test.rb
280
- - test/licence_application_api_test.rb
281
- - test/fixtures/hello.txt
282
277
  - test/test_helper.rb
278
+ - test/fixtures/hello.txt
279
+ - test/asset_manager_test.rb
280
+ - test/gds_api_base_test.rb
281
+ - test/content_api_test.rb
282
+ - test/panopticon_registerer_test.rb