gds-api-adapters 4.3.0 → 4.4.0
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.
- data/lib/gds_api/content_api.rb +4 -0
- data/lib/gds_api/test_helpers/content_api.rb +16 -0
- data/lib/gds_api/version.rb +1 -1
- data/test/content_api_test.rb +17 -0
- metadata +4 -4
data/lib/gds_api/content_api.rb
CHANGED
@@ -300,6 +300,22 @@ module GdsApi
|
|
300
300
|
@stubbed_content_api_licences << details
|
301
301
|
end
|
302
302
|
|
303
|
+
def content_api_has_countries(countries)
|
304
|
+
response = response_base.merge({
|
305
|
+
"results" => countries.map {|id,name|
|
306
|
+
{
|
307
|
+
"id" => "#{CONTENT_API_ENDPOINT}/travel-advice/#{id}.json",
|
308
|
+
"name" => name,
|
309
|
+
"identifier" => id,
|
310
|
+
"web_url" => "http://www.test.gov.uk/travel-advice/#{id}"
|
311
|
+
}
|
312
|
+
},
|
313
|
+
"total" => countries.length
|
314
|
+
})
|
315
|
+
|
316
|
+
stub_request(:get, %r{\A#{CONTENT_API_ENDPOINT}/travel-advice\.json}).to_return(status: 200, body: response.to_json, headers: { })
|
317
|
+
end
|
318
|
+
|
303
319
|
private
|
304
320
|
|
305
321
|
def titleize_slug(slug)
|
data/lib/gds_api/version.rb
CHANGED
data/test/content_api_test.rb
CHANGED
@@ -492,6 +492,23 @@ describe GdsApi::ContentApi do
|
|
492
492
|
end
|
493
493
|
end
|
494
494
|
|
495
|
+
it "should fetch the list of countries" do
|
496
|
+
content_api_has_countries({
|
497
|
+
'afghanistan' => 'Afghanistan',
|
498
|
+
'albania' => 'Albania',
|
499
|
+
'algeria' => 'Algeria'
|
500
|
+
})
|
501
|
+
|
502
|
+
results = @api.countries['results']
|
503
|
+
assert_equal 3, results.length
|
504
|
+
|
505
|
+
assert_equal ['afghanistan', 'albania', 'algeria'], results.map {|c| c['identifier'] }
|
506
|
+
assert_equal ['Afghanistan', 'Albania', 'Algeria'], results.map {|c| c['name'] }
|
507
|
+
|
508
|
+
assert_equal "#{@base_api_url}/travel-advice/afghanistan.json", results.first['id']
|
509
|
+
assert_equal 'http://www.test.gov.uk/travel-advice/afghanistan', results.first['web_url']
|
510
|
+
end
|
511
|
+
|
495
512
|
def api_response_for_results(results)
|
496
513
|
{
|
497
514
|
"_response_info" => {
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 4.
|
5
|
+
version: 4.4.0
|
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: 2013-
|
13
|
+
date: 2013-02-04 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: plek
|
@@ -236,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
236
|
requirements:
|
237
237
|
- - ">="
|
238
238
|
- !ruby/object:Gem::Version
|
239
|
-
hash:
|
239
|
+
hash: 355718895235244126
|
240
240
|
segments:
|
241
241
|
- 0
|
242
242
|
version: "0"
|
@@ -245,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
245
|
requirements:
|
246
246
|
- - ">="
|
247
247
|
- !ruby/object:Gem::Version
|
248
|
-
hash:
|
248
|
+
hash: 355718895235244126
|
249
249
|
segments:
|
250
250
|
- 0
|
251
251
|
version: "0"
|