gds-api-adapters 7.22.2 → 7.22.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,11 +12,12 @@ module GdsApi
12
12
  url = NEED_API_ENDPOINT + "/organisations"
13
13
 
14
14
  body = response_base.merge(
15
- "organisations" => organisations.map {|id, name|
16
- {
17
- "id" => id,
18
- "name" => name
19
- }
15
+ "organisations" => organisations.map {|id, attrs|
16
+ if attrs.is_a? String
17
+ { "id" => id }.merge("name" => attrs)
18
+ else
19
+ { "id" => id }.merge(attrs)
20
+ end
20
21
  }
21
22
  )
22
23
  stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '7.22.2'
2
+ VERSION = '7.22.3'
3
3
  end
@@ -189,5 +189,22 @@ describe GdsApi::NeedApi do
189
189
  assert_equal "Competition Commission", orgs[1]["name"]
190
190
  assert_equal 2, orgs.size
191
191
  end
192
+
193
+ it "should return organisations with abbreviations if present" do
194
+ request_stub = need_api_has_organisations(
195
+ "committee-on-climate-change" => {"name" => "Committee on Climate Change",
196
+ "abbreviation" => "CCC"},
197
+ "competition-commission" => {"name" => "Competition Commission",
198
+ "abbreviation" => "CC"}
199
+ )
200
+ orgs = @api.organisations
201
+
202
+ assert_requested(request_stub)
203
+ assert_equal "Committee on Climate Change", orgs[0]["name"]
204
+ assert_equal "Competition Commission", orgs[1]["name"]
205
+ assert_equal "CCC", orgs[0]["abbreviation"]
206
+ assert_equal "CC", orgs[1]["abbreviation"]
207
+ assert_equal 2, orgs.size
208
+ end
192
209
  end
193
210
  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.22.2
4
+ version: 7.22.3
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-11-29 00:00:00.000000000 Z
12
+ date: 2013-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: plek
@@ -340,7 +340,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
340
340
  version: '0'
341
341
  segments:
342
342
  - 0
343
- hash: -3851561303277841732
343
+ hash: 2261435228405301514
344
344
  required_rubygems_version: !ruby/object:Gem::Requirement
345
345
  none: false
346
346
  requirements:
@@ -349,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
349
  version: '0'
350
350
  segments:
351
351
  - 0
352
- hash: -3851561303277841732
352
+ hash: 2261435228405301514
353
353
  requirements: []
354
354
  rubyforge_project:
355
355
  rubygems_version: 1.8.23