gds-api-adapters 60.1.0 → 61.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/Rakefile +0 -6
- data/lib/gds-api-adapters.rb +3 -3
- data/lib/gds_api.rb +45 -45
- data/lib/gds_api/asset_manager.rb +2 -2
- data/lib/gds_api/base.rb +5 -5
- data/lib/gds_api/calendars.rb +1 -1
- data/lib/gds_api/content_store.rb +3 -3
- data/lib/gds_api/email_alert_api.rb +4 -4
- data/lib/gds_api/imminence.rb +2 -2
- data/lib/gds_api/json_client.rb +19 -19
- data/lib/gds_api/link_checker_api.rb +6 -6
- data/lib/gds_api/local_links_manager.rb +1 -1
- data/lib/gds_api/mapit.rb +6 -6
- data/lib/gds_api/middleware/govuk_header_sniffer.rb +1 -1
- data/lib/gds_api/organisations.rb +1 -1
- data/lib/gds_api/performance_platform/data_in.rb +1 -1
- data/lib/gds_api/performance_platform/data_out.rb +14 -14
- data/lib/gds_api/publishing_api.rb +2 -2
- data/lib/gds_api/publishing_api/special_route_publisher.rb +2 -2
- data/lib/gds_api/publishing_api_v2.rb +8 -8
- data/lib/gds_api/railtie.rb +6 -6
- data/lib/gds_api/response.rb +4 -4
- data/lib/gds_api/router.rb +3 -3
- data/lib/gds_api/rummager.rb +1 -1
- data/lib/gds_api/search.rb +10 -20
- data/lib/gds_api/support.rb +1 -1
- data/lib/gds_api/support_api.rb +1 -1
- data/lib/gds_api/test_helpers/asset_manager.rb +4 -4
- data/lib/gds_api/test_helpers/calendars.rb +13 -13
- data/lib/gds_api/test_helpers/common_responses.rb +3 -3
- data/lib/gds_api/test_helpers/content_item_helpers.rb +2 -2
- data/lib/gds_api/test_helpers/content_store.rb +7 -7
- data/lib/gds_api/test_helpers/email_alert_api.rb +19 -19
- data/lib/gds_api/test_helpers/imminence.rb +3 -3
- data/lib/gds_api/test_helpers/json_client_helper.rb +1 -1
- data/lib/gds_api/test_helpers/licence_application.rb +1 -1
- data/lib/gds_api/test_helpers/link_checker_api.rb +5 -5
- data/lib/gds_api/test_helpers/local_links_manager.rb +14 -14
- data/lib/gds_api/test_helpers/mapit.rb +17 -17
- data/lib/gds_api/test_helpers/organisations.rb +7 -7
- data/lib/gds_api/test_helpers/performance_platform/data_out.rb +13 -13
- data/lib/gds_api/test_helpers/publishing_api.rb +8 -8
- data/lib/gds_api/test_helpers/publishing_api_v2.rb +24 -24
- data/lib/gds_api/test_helpers/router.rb +12 -12
- data/lib/gds_api/test_helpers/rummager.rb +3 -3
- data/lib/gds_api/test_helpers/search.rb +18 -18
- data/lib/gds_api/test_helpers/support.rb +1 -1
- data/lib/gds_api/test_helpers/support_api.rb +8 -8
- data/lib/gds_api/test_helpers/worldwide.rb +6 -6
- data/lib/gds_api/version.rb +1 -1
- data/lib/gds_api/worldwide.rb +1 -1
- metadata +4 -4
@@ -19,8 +19,8 @@ module GdsApi
|
|
19
19
|
def response_base
|
20
20
|
{
|
21
21
|
"_response_info" => {
|
22
|
-
"status" => "ok"
|
23
|
-
}
|
22
|
+
"status" => "ok",
|
23
|
+
},
|
24
24
|
}
|
25
25
|
end
|
26
26
|
alias_method :singular_response_base, :response_base
|
@@ -33,7 +33,7 @@ module GdsApi
|
|
33
33
|
"page_size" => 100,
|
34
34
|
"current_page" => 1,
|
35
35
|
"pages" => 1,
|
36
|
-
"results" => []
|
36
|
+
"results" => [],
|
37
37
|
)
|
38
38
|
end
|
39
39
|
end
|
@@ -12,7 +12,7 @@ module GdsApi
|
|
12
12
|
# "base_path" => base_path,
|
13
13
|
"details" => {
|
14
14
|
"body" => "Some content for #{base_path}",
|
15
|
-
}
|
15
|
+
},
|
16
16
|
}
|
17
17
|
end
|
18
18
|
|
@@ -25,7 +25,7 @@ module GdsApi
|
|
25
25
|
"public_updated_at" => nil,
|
26
26
|
"base_path" => base_path,
|
27
27
|
"withdrawn_notice" => {},
|
28
|
-
"details" => {}
|
28
|
+
"details" => {},
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "gds_api/test_helpers/json_client_helper"
|
2
|
+
require "gds_api/test_helpers/content_item_helpers"
|
3
|
+
require "json"
|
4
4
|
|
5
5
|
module GdsApi
|
6
6
|
module TestHelpers
|
@@ -15,7 +15,7 @@ module GdsApi
|
|
15
15
|
# will include "public"
|
16
16
|
# :draft will point to the draft content store if set to true
|
17
17
|
def stub_content_store_endpoint(draft = false)
|
18
|
-
draft ? Plek.current.find(
|
18
|
+
draft ? Plek.current.find("draft-content-store") : Plek.current.find("content-store")
|
19
19
|
end
|
20
20
|
|
21
21
|
def stub_content_store_has_item(base_path, body = content_item_for_base_path(base_path), options = {})
|
@@ -29,8 +29,8 @@ module GdsApi
|
|
29
29
|
body: body,
|
30
30
|
headers: {
|
31
31
|
cache_control: "#{visibility}, max-age=#{max_age}",
|
32
|
-
date: Time.now.httpdate
|
33
|
-
}
|
32
|
+
date: Time.now.httpdate,
|
33
|
+
},
|
34
34
|
)
|
35
35
|
end
|
36
36
|
|
@@ -73,7 +73,7 @@ module GdsApi
|
|
73
73
|
stub_request(:get, url).to_return(
|
74
74
|
status: 410,
|
75
75
|
body: body,
|
76
|
-
headers: {}
|
76
|
+
headers: {},
|
77
77
|
)
|
78
78
|
end
|
79
79
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "gds_api/test_helpers/json_client_helper"
|
2
|
+
require "json"
|
3
3
|
|
4
4
|
module GdsApi
|
5
5
|
module TestHelpers
|
@@ -214,21 +214,21 @@ module GdsApi
|
|
214
214
|
def stub_email_alert_api_creates_a_subscription(subscriber_list_id, address, frequency, returned_subscription_id)
|
215
215
|
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriptions")
|
216
216
|
.with(
|
217
|
-
body: { subscriber_list_id: subscriber_list_id, address: address, frequency: frequency }.to_json
|
217
|
+
body: { subscriber_list_id: subscriber_list_id, address: address, frequency: frequency }.to_json,
|
218
218
|
).to_return(status: 201, body: { subscription_id: returned_subscription_id }.to_json)
|
219
219
|
end
|
220
220
|
|
221
221
|
def stub_email_alert_api_creates_an_existing_subscription(subscriber_list_id, address, frequency, returned_subscription_id)
|
222
222
|
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriptions")
|
223
223
|
.with(
|
224
|
-
body: { subscriber_list_id: subscriber_list_id, address: address, frequency: frequency }.to_json
|
224
|
+
body: { subscriber_list_id: subscriber_list_id, address: address, frequency: frequency }.to_json,
|
225
225
|
).to_return(status: 200, body: { subscription_id: returned_subscription_id }.to_json)
|
226
226
|
end
|
227
227
|
|
228
228
|
def stub_email_alert_api_refuses_to_create_subscription(subscriber_list_id, address, frequency)
|
229
229
|
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriptions")
|
230
230
|
.with(
|
231
|
-
body: { subscriber_list_id: subscriber_list_id, address: address, frequency: frequency }.to_json
|
231
|
+
body: { subscriber_list_id: subscriber_list_id, address: address, frequency: frequency }.to_json,
|
232
232
|
).to_return(status: 422)
|
233
233
|
end
|
234
234
|
|
@@ -236,7 +236,7 @@ module GdsApi
|
|
236
236
|
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/auth-token")
|
237
237
|
.to_return(
|
238
238
|
status: 201,
|
239
|
-
body: get_subscriber_response(subscriber_id, address).to_json
|
239
|
+
body: get_subscriber_response(subscriber_id, address).to_json,
|
240
240
|
)
|
241
241
|
end
|
242
242
|
|
@@ -249,7 +249,7 @@ module GdsApi
|
|
249
249
|
JSON.parse(req.body).symbolize_keys == {
|
250
250
|
subscriber_list_id: subscriber_list_id,
|
251
251
|
address: address,
|
252
|
-
frequency: frequency
|
252
|
+
frequency: frequency,
|
253
253
|
}
|
254
254
|
end
|
255
255
|
end
|
@@ -259,8 +259,8 @@ module GdsApi
|
|
259
259
|
.to_return(
|
260
260
|
status: 200,
|
261
261
|
body: {
|
262
|
-
subscriber_list: returned_attributes
|
263
|
-
}.to_json
|
262
|
+
subscriber_list: returned_attributes,
|
263
|
+
}.to_json,
|
264
264
|
)
|
265
265
|
end
|
266
266
|
|
@@ -300,8 +300,8 @@ module GdsApi
|
|
300
300
|
{
|
301
301
|
"subscriber" => {
|
302
302
|
"id" => id,
|
303
|
-
"address" => address
|
304
|
-
}
|
303
|
+
"address" => address,
|
304
|
+
},
|
305
305
|
}
|
306
306
|
end
|
307
307
|
|
@@ -328,8 +328,8 @@ module GdsApi
|
|
328
328
|
"id" => subscriber_list_id,
|
329
329
|
"slug" => "some-thing",
|
330
330
|
"title" => title,
|
331
|
-
}
|
332
|
-
}
|
331
|
+
},
|
332
|
+
},
|
333
333
|
}
|
334
334
|
end
|
335
335
|
|
@@ -337,7 +337,7 @@ module GdsApi
|
|
337
337
|
{
|
338
338
|
"subscriber" => {
|
339
339
|
"id" => id,
|
340
|
-
"address" => address
|
340
|
+
"address" => address,
|
341
341
|
},
|
342
342
|
"subscriptions" => [
|
343
343
|
{
|
@@ -347,10 +347,10 @@ module GdsApi
|
|
347
347
|
"id" => "447135c3-07d6-4c3a-8a3b-efa49ef70e52",
|
348
348
|
"subscriber_list" => {
|
349
349
|
"id" => 1000,
|
350
|
-
"slug" => "some-thing"
|
351
|
-
}
|
352
|
-
}
|
353
|
-
]
|
350
|
+
"slug" => "some-thing",
|
351
|
+
},
|
352
|
+
},
|
353
|
+
],
|
354
354
|
}
|
355
355
|
end
|
356
356
|
|
@@ -360,7 +360,7 @@ module GdsApi
|
|
360
360
|
"id" => "447135c3-07d6-4c3a-8a3b-efa49ef70e52",
|
361
361
|
"title" => "Some title",
|
362
362
|
"active_subscriptions_count" => 42,
|
363
|
-
}.merge(attributes)
|
363
|
+
}.merge(attributes),
|
364
364
|
}
|
365
365
|
end
|
366
366
|
|
@@ -1,15 +1,15 @@
|
|
1
|
-
require
|
1
|
+
require "gds_api/test_helpers/json_client_helper"
|
2
2
|
|
3
3
|
module GdsApi
|
4
4
|
module TestHelpers
|
5
5
|
module Imminence
|
6
6
|
# Generally true. If you are initializing the client differently,
|
7
7
|
# you could redefine/override the constant or stub directly.
|
8
|
-
IMMINENCE_API_ENDPOINT = Plek.current.find(
|
8
|
+
IMMINENCE_API_ENDPOINT = Plek.current.find("imminence")
|
9
9
|
|
10
10
|
def stub_imminence_has_places(latitude, longitude, details)
|
11
11
|
query_hash = { "lat" => latitude, "lng" => longitude, "limit" => "5" }
|
12
|
-
stub_imminence_places_request(details[
|
12
|
+
stub_imminence_places_request(details["slug"], query_hash, details["details"])
|
13
13
|
end
|
14
14
|
|
15
15
|
def stub_imminence_has_areas_for_postcode(postcode, areas)
|
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require "gds_api/json_client"
|
@@ -39,7 +39,7 @@ module GdsApi
|
|
39
39
|
|
40
40
|
def stub_link_checker_api_get_batch(id:, status: :completed, links: [], totals: {}, completed_at: nil)
|
41
41
|
body = stub_link_checker_api_batch_report_hash(
|
42
|
-
id: id, status: status, links: links, totals: totals, completed_at: completed_at
|
42
|
+
id: id, status: status, links: links, totals: totals, completed_at: completed_at,
|
43
43
|
).to_json
|
44
44
|
|
45
45
|
stub_request(:get, "#{LINK_CHECKER_API_ENDPOINT}/batch/#{id}")
|
@@ -54,7 +54,7 @@ module GdsApi
|
|
54
54
|
status: status,
|
55
55
|
links: links,
|
56
56
|
totals: totals,
|
57
|
-
completed_at: completed_at
|
57
|
+
completed_at: completed_at,
|
58
58
|
).to_json
|
59
59
|
|
60
60
|
request_body = {
|
@@ -69,7 +69,7 @@ module GdsApi
|
|
69
69
|
.to_return(
|
70
70
|
body: response_body,
|
71
71
|
status: status == :in_progress ? 202 : 201,
|
72
|
-
headers: { "Content-Type" => "application/json" }
|
72
|
+
headers: { "Content-Type" => "application/json" },
|
73
73
|
)
|
74
74
|
end
|
75
75
|
|
@@ -79,14 +79,14 @@ module GdsApi
|
|
79
79
|
request_body = {
|
80
80
|
links: links,
|
81
81
|
app: app,
|
82
|
-
reference: reference
|
82
|
+
reference: reference,
|
83
83
|
}.to_json
|
84
84
|
|
85
85
|
stub_request(:post, "#{LINK_CHECKER_API_ENDPOINT}/monitor")
|
86
86
|
.with(body: request_body)
|
87
87
|
.to_return(
|
88
88
|
body: response_body,
|
89
|
-
headers: { "Content-Type" => "application/json" }
|
89
|
+
headers: { "Content-Type" => "application/json" },
|
90
90
|
)
|
91
91
|
end
|
92
92
|
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
1
|
+
require "gds_api/test_helpers/json_client_helper"
|
2
2
|
|
3
3
|
module GdsApi
|
4
4
|
module TestHelpers
|
5
5
|
module LocalLinksManager
|
6
|
-
LOCAL_LINKS_MANAGER_ENDPOINT = Plek.current.find(
|
6
|
+
LOCAL_LINKS_MANAGER_ENDPOINT = Plek.current.find("local-links-manager")
|
7
7
|
|
8
8
|
def stub_local_links_manager_has_a_link(authority_slug:, lgsl:, lgil:, url:)
|
9
9
|
response = {
|
@@ -17,7 +17,7 @@ module GdsApi
|
|
17
17
|
"lgsl_code" => lgsl,
|
18
18
|
"lgil_code" => lgil,
|
19
19
|
"url" => url,
|
20
|
-
}
|
20
|
+
},
|
21
21
|
}
|
22
22
|
|
23
23
|
stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/link")
|
@@ -82,9 +82,9 @@ module GdsApi
|
|
82
82
|
{
|
83
83
|
"name" => authority_slug.capitalize,
|
84
84
|
"homepage_url" => "http://#{authority_slug}.example.com",
|
85
|
-
"tier" => "unitary"
|
86
|
-
}
|
87
|
-
]
|
85
|
+
"tier" => "unitary",
|
86
|
+
},
|
87
|
+
],
|
88
88
|
}
|
89
89
|
|
90
90
|
stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/local-authority")
|
@@ -98,14 +98,14 @@ module GdsApi
|
|
98
98
|
{
|
99
99
|
"name" => district_slug.capitalize,
|
100
100
|
"homepage_url" => "http://#{district_slug}.example.com",
|
101
|
-
"tier" => "district"
|
101
|
+
"tier" => "district",
|
102
102
|
},
|
103
103
|
{
|
104
104
|
"name" => county_slug.capitalize,
|
105
105
|
"homepage_url" => "http://#{county_slug}.example.com",
|
106
|
-
"tier" => "county"
|
107
|
-
}
|
108
|
-
]
|
106
|
+
"tier" => "county",
|
107
|
+
},
|
108
|
+
],
|
109
109
|
}
|
110
110
|
|
111
111
|
stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/local-authority")
|
@@ -115,7 +115,7 @@ module GdsApi
|
|
115
115
|
|
116
116
|
def stub_local_links_manager_request_without_local_authority_slug
|
117
117
|
stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/local-authority")
|
118
|
-
.with(query: { authority_slug:
|
118
|
+
.with(query: { authority_slug: "" })
|
119
119
|
.to_return(body: {}.to_json, status: 400)
|
120
120
|
end
|
121
121
|
|
@@ -131,9 +131,9 @@ module GdsApi
|
|
131
131
|
{
|
132
132
|
"name" => authority_slug.capitalize,
|
133
133
|
"homepage_url" => "",
|
134
|
-
"tier" => "unitary"
|
135
|
-
}
|
136
|
-
]
|
134
|
+
"tier" => "unitary",
|
135
|
+
},
|
136
|
+
],
|
137
137
|
}
|
138
138
|
|
139
139
|
stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/local-authority")
|
@@ -1,18 +1,18 @@
|
|
1
1
|
module GdsApi
|
2
2
|
module TestHelpers
|
3
3
|
module Mapit
|
4
|
-
MAPIT_ENDPOINT = Plek.current.find(
|
4
|
+
MAPIT_ENDPOINT = Plek.current.find("mapit")
|
5
5
|
|
6
6
|
def stub_mapit_has_a_postcode(postcode, coords)
|
7
7
|
response = {
|
8
8
|
"wgs84_lat" => coords.first,
|
9
9
|
"wgs84_lon" => coords.last,
|
10
|
-
"postcode" => postcode
|
10
|
+
"postcode" => postcode,
|
11
11
|
}
|
12
12
|
|
13
|
-
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/" + postcode.tr(
|
13
|
+
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/" + postcode.tr(" ", "+") + ".json")
|
14
14
|
.to_return(body: response.to_json, status: 200)
|
15
|
-
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/partial/" + postcode.split(
|
15
|
+
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/partial/" + postcode.split(" ").first + ".json")
|
16
16
|
.to_return(body: response.to_json, status: 200)
|
17
17
|
end
|
18
18
|
|
@@ -20,35 +20,35 @@ module GdsApi
|
|
20
20
|
response = {
|
21
21
|
"wgs84_lat" => coords.first,
|
22
22
|
"wgs84_lon" => coords.last,
|
23
|
-
"postcode" => postcode
|
23
|
+
"postcode" => postcode,
|
24
24
|
}
|
25
25
|
|
26
26
|
area_response = Hash[areas.map.with_index { |area, i|
|
27
27
|
[i, {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
"codes" => {
|
29
|
+
"ons" => area["ons"],
|
30
|
+
"gss" => area["gss"],
|
31
|
+
"govuk_slug" => area["govuk_slug"],
|
32
32
|
},
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
"name" => area["name"],
|
34
|
+
"type" => area["type"],
|
35
|
+
"country_name" => area["country_name"],
|
36
36
|
}]
|
37
37
|
}]
|
38
38
|
|
39
|
-
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/" + postcode.tr(
|
40
|
-
.to_return(body: response.merge(
|
41
|
-
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/partial/" + postcode.split(
|
39
|
+
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/" + postcode.tr(" ", "+") + ".json")
|
40
|
+
.to_return(body: response.merge("areas" => area_response).to_json, status: 200)
|
41
|
+
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/partial/" + postcode.split(" ").first + ".json")
|
42
42
|
.to_return(body: response.to_json, status: 200)
|
43
43
|
end
|
44
44
|
|
45
45
|
def stub_mapit_does_not_have_a_postcode(postcode)
|
46
|
-
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/" + postcode.tr(
|
46
|
+
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/" + postcode.tr(" ", "+") + ".json")
|
47
47
|
.to_return(body: { "code" => 404, "error" => "No Postcode matches the given query." }.to_json, status: 404)
|
48
48
|
end
|
49
49
|
|
50
50
|
def stub_mapit_does_not_have_a_bad_postcode(postcode)
|
51
|
-
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/" + postcode.tr(
|
51
|
+
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/" + postcode.tr(" ", "+") + ".json")
|
52
52
|
.to_return(body: { "code" => 400, "error" => "Postcode '#{postcode}' is not valid." }.to_json, status: 400)
|
53
53
|
end
|
54
54
|
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "gds_api/test_helpers/json_client_helper"
|
2
|
+
require "gds_api/test_helpers/common_responses"
|
3
|
+
require "plek"
|
4
|
+
require "securerandom"
|
5
5
|
|
6
6
|
module GdsApi
|
7
7
|
module TestHelpers
|
@@ -55,7 +55,7 @@ module GdsApi
|
|
55
55
|
|
56
56
|
if i.zero?
|
57
57
|
# First page exists at URL with and without page param
|
58
|
-
stub_request(:get, links[:self].sub(/\?page=1/,
|
58
|
+
stub_request(:get, links[:self].sub(/\?page=1/, "")).
|
59
59
|
to_return(status: 200, body: page_details.to_json, headers: { "Link" => link_headers.join(", ") })
|
60
60
|
end
|
61
61
|
end
|
@@ -104,13 +104,13 @@ module GdsApi
|
|
104
104
|
"parent_organisations" => [
|
105
105
|
{
|
106
106
|
"id" => "#{WEBSITE_ROOT}/api/organisations/#{slug}-parent-1",
|
107
|
-
"web_url" => "#{WEBSITE_ROOT}/government/organisations/#{slug}-parent-1"
|
107
|
+
"web_url" => "#{WEBSITE_ROOT}/government/organisations/#{slug}-parent-1",
|
108
108
|
},
|
109
109
|
],
|
110
110
|
"child_organisations" => [
|
111
111
|
{
|
112
112
|
"id" => "#{WEBSITE_ROOT}/api/organisations/#{slug}-child-1",
|
113
|
-
"web_url" => "#{WEBSITE_ROOT}/government/organisations/#{slug}-child-1"
|
113
|
+
"web_url" => "#{WEBSITE_ROOT}/government/organisations/#{slug}-child-1",
|
114
114
|
},
|
115
115
|
],
|
116
116
|
}
|
@@ -21,9 +21,9 @@ module GdsApi
|
|
21
21
|
def stub_search_terms(slug, response_body = {})
|
22
22
|
options = {
|
23
23
|
slug: slug,
|
24
|
-
transaction:
|
25
|
-
group_by:
|
26
|
-
collect:
|
24
|
+
transaction: "search-terms",
|
25
|
+
group_by: "searchKeyword",
|
26
|
+
collect: "searchUniques:sum",
|
27
27
|
}
|
28
28
|
stub_statistics(options, false, response_body)
|
29
29
|
end
|
@@ -31,9 +31,9 @@ module GdsApi
|
|
31
31
|
def stub_searches(slug, is_multipart, response_body = {})
|
32
32
|
options = {
|
33
33
|
slug: slug,
|
34
|
-
transaction:
|
35
|
-
group_by:
|
36
|
-
collect:
|
34
|
+
transaction: "search-terms",
|
35
|
+
group_by: "pagePath",
|
36
|
+
collect: "searchUniques:sum",
|
37
37
|
}
|
38
38
|
stub_statistics(options, is_multipart, response_body)
|
39
39
|
end
|
@@ -41,9 +41,9 @@ module GdsApi
|
|
41
41
|
def stub_page_views(slug, is_multipart, response_body = {})
|
42
42
|
options = {
|
43
43
|
slug: slug,
|
44
|
-
transaction:
|
45
|
-
group_by:
|
46
|
-
collect:
|
44
|
+
transaction: "page-statistics",
|
45
|
+
group_by: "pagePath",
|
46
|
+
collect: "uniquePageviews:sum",
|
47
47
|
}
|
48
48
|
stub_statistics(options, is_multipart, response_body)
|
49
49
|
end
|
@@ -51,9 +51,9 @@ module GdsApi
|
|
51
51
|
def stub_problem_reports(slug, is_multipart, response_body = {})
|
52
52
|
options = {
|
53
53
|
slug: slug,
|
54
|
-
transaction:
|
55
|
-
group_by:
|
56
|
-
collect:
|
54
|
+
transaction: "page-contacts",
|
55
|
+
group_by: "pagePath",
|
56
|
+
collect: "total:sum",
|
57
57
|
}
|
58
58
|
stub_statistics(options, is_multipart, response_body)
|
59
59
|
end
|
@@ -64,7 +64,7 @@ module GdsApi
|
|
64
64
|
collect: options[:collect],
|
65
65
|
duration: 42,
|
66
66
|
period: "day",
|
67
|
-
end_at: Date.today.to_time.getutc.iso8601
|
67
|
+
end_at: Date.today.to_time.getutc.iso8601,
|
68
68
|
}
|
69
69
|
|
70
70
|
filter_param = is_multipart ? :filter_by_prefix : :filter_by
|