gds-api-adapters 81.0.0 → 81.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b05bc427e1871e4a8b4d0abbd4a0f33bede6a2e2abd1dc9538d734d19bcd7715
4
- data.tar.gz: 3a824dc05509ad151471dcec3e5d536b4036af83d64ce93d614b6a6ff22deda7
3
+ metadata.gz: 0b11bd7eb4a668b5790fdb64c024873a3b0b3df0ade81e8b9f3b5544d96a9398
4
+ data.tar.gz: 39cae6d431d650c0ad17462036a8f3a7934699699fd70637de826a99a0a43e41
5
5
  SHA512:
6
- metadata.gz: a289fa007a4da3cb78bb31f8647aa43bf3e49fd43c1a2bb6e63f00fd60b03448b1fbf4e5ee7e1881cce8bbc9011db5d75478dc0c6833d42813aa7a010e60f52d
7
- data.tar.gz: d1680c586b6443e1a1a95d4ea1195664de2f9ca971d8d3b764d5767813b41cd82f91704ff6c4d63a4a71de2a2ff13292d5ba09ea0d3954f6c3061576b1714451
6
+ metadata.gz: 371d714c774758917e44223f938a2cd39ae0cc9111b4fd492c4532b8c6b8a615d0d6183a396401336a8facd428d5112a9ff5d029da03c42af45545f1dc7ba4fd
7
+ data.tar.gz: 2004337b8f10dafb2130d6e1b50dfd65bd78b74640319b78bccea1ddb82882c09c358930ec9d789d9f9a6e35036cc9f95f72cbd964f9f711af3f7911fd18ce0b
@@ -595,6 +595,12 @@ module GdsApi
595
595
  url = "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists"
596
596
  query ? "#{url}?#{query}" : url
597
597
  end
598
+
599
+ # Find and return the subscriber list for a topic if one exists.
600
+ def email_alert_api_has_subscriber_list_for_topic(content_id:, list: {})
601
+ url = "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists?links%5Btopics%5D%5B0%5D=#{content_id}"
602
+ stub_request(:get, url).to_return(status: 200, body: { "subscriber_list" => list }.to_json)
603
+ end
598
604
  end
599
605
  end
600
606
  end
@@ -5,11 +5,11 @@ module GdsApi
5
5
  module LocalLinksManager
6
6
  LOCAL_LINKS_MANAGER_ENDPOINT = Plek.current.find("local-links-manager")
7
7
 
8
- def stub_local_links_manager_has_a_link(authority_slug:, lgsl:, lgil:, url:, country_name: "England", status: "ok", local_custodian_code: nil)
8
+ def stub_local_links_manager_has_a_link(authority_slug:, lgsl:, lgil:, url:, country_name: "England", status: "ok", snac: "00AG", local_custodian_code: nil)
9
9
  response = {
10
10
  "local_authority" => {
11
11
  "name" => authority_slug.capitalize,
12
- "snac" => "00AG",
12
+ "snac" => snac,
13
13
  "tier" => "unitary",
14
14
  "homepage_url" => "http://#{authority_slug}.example.com",
15
15
  "country_name" => country_name,
@@ -34,11 +34,11 @@ module GdsApi
34
34
  end
35
35
  end
36
36
 
37
- def stub_local_links_manager_has_no_link(authority_slug:, lgsl:, lgil:, country_name: "England", local_custodian_code: nil)
37
+ def stub_local_links_manager_has_no_link(authority_slug:, lgsl:, lgil:, country_name: "England", snac: "00AG", local_custodian_code: nil)
38
38
  response = {
39
39
  "local_authority" => {
40
40
  "name" => authority_slug.capitalize,
41
- "snac" => "00AG",
41
+ "snac" => snac,
42
42
  "tier" => "unitary",
43
43
  "homepage_url" => "http://#{authority_slug}.example.com",
44
44
  "country_name" => country_name,
@@ -57,11 +57,11 @@ module GdsApi
57
57
  end
58
58
  end
59
59
 
60
- def stub_local_links_manager_has_no_link_and_no_homepage_url(authority_slug:, lgsl:, lgil:, country_name: "England", local_custodian_code: nil)
60
+ def stub_local_links_manager_has_no_link_and_no_homepage_url(authority_slug:, lgsl:, lgil:, country_name: "England", snac: "00AG", local_custodian_code: nil)
61
61
  response = {
62
62
  "local_authority" => {
63
63
  "name" => authority_slug.capitalize,
64
- "snac" => "00AG",
64
+ "snac" => snac,
65
65
  "tier" => "unitary",
66
66
  "homepage_url" => nil,
67
67
  "country_name" => country_name,
@@ -98,13 +98,13 @@ module GdsApi
98
98
  parameters
99
99
  end
100
100
 
101
- def stub_local_links_manager_has_a_local_authority(authority_slug, local_custodian_code: nil)
101
+ def stub_local_links_manager_has_a_local_authority(authority_slug, country_name: "England", local_custodian_code: nil)
102
102
  response = {
103
103
  "local_authorities" => [
104
104
  {
105
105
  "name" => authority_slug.capitalize,
106
106
  "homepage_url" => "http://#{authority_slug}.example.com",
107
- "country_name" => "England",
107
+ "country_name" => country_name,
108
108
  "tier" => "unitary",
109
109
  "slug" => authority_slug,
110
110
  },
@@ -177,13 +177,13 @@ module GdsApi
177
177
  .to_return(body: {}.to_json, status: 404)
178
178
  end
179
179
 
180
- def stub_local_links_manager_has_a_local_authority_without_homepage(authority_slug)
180
+ def stub_local_links_manager_has_a_local_authority_without_homepage(authority_slug, country_name: "England", local_custodian_code: nil)
181
181
  response = {
182
182
  "local_authorities" => [
183
183
  {
184
184
  "name" => authority_slug.capitalize,
185
185
  "homepage_url" => "",
186
- "country_name" => "England",
186
+ "country_name" => country_name,
187
187
  "tier" => "unitary",
188
188
  "slug" => authority_slug,
189
189
  },
@@ -193,6 +193,12 @@ module GdsApi
193
193
  stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/local-authority")
194
194
  .with(query: { authority_slug: authority_slug })
195
195
  .to_return(body: response.to_json, status: 200)
196
+
197
+ unless local_custodian_code.nil?
198
+ stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/local-authority")
199
+ .with(query: { local_custodian_code: local_custodian_code })
200
+ .to_return(body: response.to_json, status: 200)
201
+ end
196
202
  end
197
203
  end
198
204
  end
@@ -7,8 +7,8 @@ module GdsApi
7
7
  results = []
8
8
  locations.each do |l|
9
9
  results << {
10
- "latitude" => l["latitude"],
11
- "longitude" => l["longitude"],
10
+ "latitude" => l["latitude"] || 0,
11
+ "longitude" => l["longitude"] || 0,
12
12
  "postcode" => postcode,
13
13
  "local_custodian_code" => l["local_custodian_code"],
14
14
  }
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "81.0.0".freeze
2
+ VERSION = "81.0.3".freeze
3
3
  end
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: 81.0.0
4
+ version: 81.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-12 00:00:00.000000000 Z
11
+ date: 2022-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable