gds-api-adapters 44.0.0 → 45.0.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.
- checksums.yaml +4 -4
- data/lib/gds_api/calendars.rb +10 -0
- data/lib/gds_api/test_helpers/calendars.rb +58 -0
- data/lib/gds_api/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f22b8db89839f1cc7f7d7818d051b91eedc02ae
|
4
|
+
data.tar.gz: 3c7eed48bcc1abc55760a29529c8578cc226200f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b329182f67bafa369a61786f2b681da3c035028f69b2056f684daf5e2b0d8a6ba639410e84f4580d5e13e00d1b8bc549052888c9ee3933b84ae8b49db8a22985
|
7
|
+
data.tar.gz: fcaa0047ba8e5bc3fa6f5c198b4adf69bc9a98b9318c4cf4d754f94159162b62c057547515fe22d2cf8114ea22bb47bcf7cd5653f2e84e79e23ba6811db36a36
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
class GdsApi::Calendars < GdsApi::Base
|
4
|
+
def bank_holidays(division = nil)
|
5
|
+
json_url = "#{endpoint}/bank-holidays"
|
6
|
+
json_url += "/#{division.to_s.tr('_', '-')}" unless division.nil?
|
7
|
+
json_url += ".json"
|
8
|
+
get_json json_url
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module GdsApi
|
2
|
+
module TestHelpers
|
3
|
+
module Calendars
|
4
|
+
CALENDARS_ENDPOINT = Plek.current.find('calendars')
|
5
|
+
|
6
|
+
def calendars_endpoint(in_division: nil)
|
7
|
+
endpoint = "#{CALENDARS_ENDPOINT}/bank-holidays"
|
8
|
+
endpoint += "/#{in_division}" unless in_division.nil?
|
9
|
+
endpoint + '.json'
|
10
|
+
end
|
11
|
+
|
12
|
+
def calendars_has_no_bank_holidays(in_division: nil)
|
13
|
+
calendars_has_bank_holidays_on([], in_division: in_division)
|
14
|
+
end
|
15
|
+
|
16
|
+
def calendars_has_bank_holidays_on(dates, in_division: nil)
|
17
|
+
events = dates.map.with_index do |date, idx|
|
18
|
+
{
|
19
|
+
title: "Caturday #{idx}!",
|
20
|
+
date: date.to_date.iso8601,
|
21
|
+
notes: "Y'know, for cats!",
|
22
|
+
bunting: true
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
response =
|
27
|
+
if in_division.nil?
|
28
|
+
{
|
29
|
+
'england-and-wales' => {
|
30
|
+
division: 'england-and-wales',
|
31
|
+
events: events
|
32
|
+
},
|
33
|
+
'scotland' => {
|
34
|
+
division: 'scotland',
|
35
|
+
events: events
|
36
|
+
},
|
37
|
+
'northern-ireland' => {
|
38
|
+
division: 'northern-ireland',
|
39
|
+
events: events
|
40
|
+
}
|
41
|
+
}
|
42
|
+
else
|
43
|
+
{
|
44
|
+
division: in_division,
|
45
|
+
events: events
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
stub_request(:get, calendars_endpoint(in_division: in_division))
|
50
|
+
.to_return(body: response.to_json, status: 200)
|
51
|
+
end
|
52
|
+
|
53
|
+
def calendars_has_a_bank_holiday_on(date, in_division: nil)
|
54
|
+
calendars_has_bank_holidays_on([date], in_division: in_division)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/gds_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 45.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Stewart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|
@@ -358,6 +358,7 @@ files:
|
|
358
358
|
- lib/gds-api-adapters.rb
|
359
359
|
- lib/gds_api/asset_manager.rb
|
360
360
|
- lib/gds_api/base.rb
|
361
|
+
- lib/gds_api/calendars.rb
|
361
362
|
- lib/gds_api/content_api.rb
|
362
363
|
- lib/gds_api/content_store.rb
|
363
364
|
- lib/gds_api/email_alert_api.rb
|
@@ -389,6 +390,7 @@ files:
|
|
389
390
|
- lib/gds_api/support.rb
|
390
391
|
- lib/gds_api/support_api.rb
|
391
392
|
- lib/gds_api/test_helpers/asset_manager.rb
|
393
|
+
- lib/gds_api/test_helpers/calendars.rb
|
392
394
|
- lib/gds_api/test_helpers/common_responses.rb
|
393
395
|
- lib/gds_api/test_helpers/content_api.rb
|
394
396
|
- lib/gds_api/test_helpers/content_api/artefact_stub.rb
|