gds-api-adapters 7.9.0 → 7.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,6 @@ class GdsApi::NeedApi < GdsApi::Base
7
7
  end
8
8
 
9
9
  def organisations
10
- get_json("#{endpoint}/organisations")
10
+ get_json!("#{endpoint}/organisations")["organisations"]
11
11
  end
12
12
  end
@@ -1,20 +1,25 @@
1
1
  require 'gds_api/test_helpers/json_client_helper'
2
+ require 'gds_api/test_helpers/common_responses'
2
3
 
3
4
  module GdsApi
4
5
  module TestHelpers
5
6
  module NeedApi
6
- # Generally true. If you are initializing the client differently,
7
- # you could redefine/override the constant or stub directly.
8
- NEED_API_ENDPOINT = Plek.current.find('needapi')
7
+ include GdsApi::TestHelpers::CommonResponses
9
8
 
10
- def need_api_has_organisations(organisation_ids)
9
+ NEED_API_ENDPOINT = Plek.current.find('need-api')
10
+
11
+ def need_api_has_organisations(organisations)
11
12
  url = NEED_API_ENDPOINT + "/organisations"
12
- orgs = organisation_ids.map do |k,v|
13
- { "id" => k,
14
- "name" => v
13
+
14
+ body = response_base.merge(
15
+ "organisations" => organisations.map {|id, name|
16
+ {
17
+ "id" => id,
18
+ "name" => name
19
+ }
15
20
  }
16
- end
17
- stub_request(:get, url).to_return(status: 200, body: orgs.to_json, headers: {})
21
+ )
22
+ stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
18
23
  end
19
24
  end
20
25
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '7.9.0'
2
+ VERSION = '7.9.1'
3
3
  end
@@ -6,7 +6,7 @@ describe GdsApi::NeedApi do
6
6
  include GdsApi::TestHelpers::NeedApi
7
7
 
8
8
  before do
9
- @base_api_url = Plek.current.find("needapi")
9
+ @base_api_url = Plek.current.find("need-api")
10
10
  @api = GdsApi::NeedApi.new(@base_api_url)
11
11
  end
12
12
 
@@ -27,12 +27,12 @@ describe GdsApi::NeedApi do
27
27
  "competition-commission" => "Competition Commission"
28
28
  )
29
29
 
30
- orgs = @api.organisations()
30
+ orgs = @api.organisations
31
31
 
32
32
  assert_requested(request_stub)
33
- assert_equal("Committee on Climate Change", orgs[0]["name"])
34
- assert_equal("Competition Commission", orgs[1]["name"])
35
- assert_equal(2, orgs.size)
33
+ assert_equal "Committee on Climate Change", orgs[0]["name"]
34
+ assert_equal "Competition Commission", orgs[1]["name"]
35
+ assert_equal 2, orgs.size
36
36
  end
37
37
  end
38
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.9.0
4
+ version: 7.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-07 00:00:00.000000000 Z
12
+ date: 2013-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: plek
@@ -335,7 +335,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
335
335
  version: '0'
336
336
  segments:
337
337
  - 0
338
- hash: 2244458293853807877
338
+ hash: 584452250631713984
339
339
  required_rubygems_version: !ruby/object:Gem::Requirement
340
340
  none: false
341
341
  requirements:
@@ -344,7 +344,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
344
344
  version: '0'
345
345
  segments:
346
346
  - 0
347
- hash: 2244458293853807877
347
+ hash: 584452250631713984
348
348
  requirements: []
349
349
  rubyforge_project:
350
350
  rubygems_version: 1.8.23