gds-api-adapters 74.0.0 → 75.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gds_api/account_api.rb +0 -40
- data/lib/gds_api/test_helpers/account_api.rb +0 -137
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 836544dd1d7130e6ba4f035b660be34e3b108b8ed16f93882cbeb3ee48ea2e6c
|
4
|
+
data.tar.gz: 6052c7b0b52ad0bf354b8b97e42fc7e90c98a1ceed2253a8fc501cd4e10b0a6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 220248bfb16db073e03b98e675278f9776eaa5965010ae737a829a352eb0baf9be23630d3eeec10288397341f6ded0bd4da53a94c70fcf53a09843d64c1bee83
|
7
|
+
data.tar.gz: f0be992cf2e9324bcefafcbf167f5959d6e993ba9e8530d109785c3868e0961d77b16dd57ec48ac3176688d0dde5c608b7b82d75a8b53626d0ee942ff27294ba
|
data/lib/gds_api/account_api.rb
CHANGED
@@ -127,46 +127,6 @@ class GdsApi::AccountApi < GdsApi::Base
|
|
127
127
|
delete_json("#{endpoint}/api/email-subscriptions/#{CGI.escape(name)}", {}, auth_headers(govuk_account_session))
|
128
128
|
end
|
129
129
|
|
130
|
-
# Look up all pages saved by a user in their Account
|
131
|
-
#
|
132
|
-
# @param [String] govuk_account_session Value of the session header
|
133
|
-
#
|
134
|
-
# @return [Hash] containing :saved_pages, an array of single saved page hashes
|
135
|
-
def get_saved_pages(govuk_account_session:)
|
136
|
-
get_json("#{endpoint}/api/saved-pages", auth_headers(govuk_account_session))
|
137
|
-
end
|
138
|
-
|
139
|
-
# Return a single page by unique URL
|
140
|
-
#
|
141
|
-
# @param [String] the path of a page to check
|
142
|
-
# @param [String] govuk_account_session Value of the session header
|
143
|
-
#
|
144
|
-
# @return [Hash] containing :saved_page, a hash of a single saved page value
|
145
|
-
def get_saved_page(page_path:, govuk_account_session:)
|
146
|
-
get_json("#{endpoint}/api/saved-pages/#{CGI.escape(page_path)}", auth_headers(govuk_account_session))
|
147
|
-
end
|
148
|
-
|
149
|
-
# Upsert a single saved page entry in a users account
|
150
|
-
#
|
151
|
-
# @param [String] the path of a page to check
|
152
|
-
# @param [String] govuk_account_session Value of the session header
|
153
|
-
#
|
154
|
-
# @return [Hash] A single saved page value (if sucessful)
|
155
|
-
def save_page(page_path:, govuk_account_session:)
|
156
|
-
put_json("#{endpoint}/api/saved-pages/#{CGI.escape(page_path)}", {}, auth_headers(govuk_account_session))
|
157
|
-
end
|
158
|
-
|
159
|
-
# Delete a single saved page entry from a users account
|
160
|
-
#
|
161
|
-
# @param [String] the path of a page to check
|
162
|
-
# @param [String] govuk_account_session Value of the session header
|
163
|
-
#
|
164
|
-
# @return [GdsApi::Response] A status code of 204 indicates the saved page has been successfully deleted.
|
165
|
-
# A status code of 404 indicates there is no saved page with this path.
|
166
|
-
def delete_saved_page(page_path:, govuk_account_session:)
|
167
|
-
delete_json("#{endpoint}/api/saved-pages/#{CGI.escape(page_path)}", {}, auth_headers(govuk_account_session))
|
168
|
-
end
|
169
|
-
|
170
130
|
private
|
171
131
|
|
172
132
|
def nested_query_string(params)
|
@@ -297,143 +297,6 @@ module GdsApi
|
|
297
297
|
**options,
|
298
298
|
)
|
299
299
|
end
|
300
|
-
|
301
|
-
######################
|
302
|
-
# GET /api/saved-pages
|
303
|
-
######################
|
304
|
-
def stub_account_api_returning_saved_pages(saved_pages: [], **options)
|
305
|
-
stub_account_api_request(
|
306
|
-
:get,
|
307
|
-
"/api/saved-pages",
|
308
|
-
response_body: { saved_pages: saved_pages },
|
309
|
-
**options,
|
310
|
-
)
|
311
|
-
end
|
312
|
-
|
313
|
-
def stub_account_api_unauthorized_get_saved_pages(**options)
|
314
|
-
stub_account_api_request(
|
315
|
-
:get,
|
316
|
-
"/api/saved-pages",
|
317
|
-
response_status: 401,
|
318
|
-
**options,
|
319
|
-
)
|
320
|
-
end
|
321
|
-
|
322
|
-
#################################
|
323
|
-
# GET /api/saved_pages/:page_path
|
324
|
-
#################################
|
325
|
-
def stub_account_api_get_saved_page(page_path:, content_id: "46163ed2-1777-4ee6-bdd4-6a2007e49d8f", title: "Ministry of Magic", **options)
|
326
|
-
stub_account_api_request(
|
327
|
-
:get,
|
328
|
-
"/api/saved-pages/#{CGI.escape(page_path)}",
|
329
|
-
response_body: {
|
330
|
-
saved_page: {
|
331
|
-
page_path: page_path,
|
332
|
-
content_id: content_id,
|
333
|
-
title: title,
|
334
|
-
},
|
335
|
-
},
|
336
|
-
**options,
|
337
|
-
)
|
338
|
-
end
|
339
|
-
|
340
|
-
def stub_account_api_does_not_have_saved_page(page_path:, **options)
|
341
|
-
stub_account_api_request(
|
342
|
-
:get,
|
343
|
-
"/api/saved-pages/#{CGI.escape(page_path)}",
|
344
|
-
response_status: 404,
|
345
|
-
**options,
|
346
|
-
)
|
347
|
-
end
|
348
|
-
|
349
|
-
def stub_account_api_unauthorized_get_saved_page(page_path:, **options)
|
350
|
-
stub_account_api_request(
|
351
|
-
:get,
|
352
|
-
"/api/saved-pages/#{CGI.escape(page_path)}",
|
353
|
-
response_status: 401,
|
354
|
-
**options,
|
355
|
-
)
|
356
|
-
end
|
357
|
-
|
358
|
-
#################################
|
359
|
-
# PUT /api/saved-pages/:page_path
|
360
|
-
#################################
|
361
|
-
def stub_account_api_save_page(page_path:, content_id: "c840bfa2-011a-42cc-ac7a-a6da990aff0b", title: "Ministry of Magic", **options)
|
362
|
-
stub_account_api_request(
|
363
|
-
:put,
|
364
|
-
"/api/saved-pages/#{CGI.escape(page_path)}",
|
365
|
-
response_body: {
|
366
|
-
saved_page: {
|
367
|
-
page_path: page_path,
|
368
|
-
content_id: content_id,
|
369
|
-
title: title,
|
370
|
-
},
|
371
|
-
},
|
372
|
-
**options,
|
373
|
-
)
|
374
|
-
end
|
375
|
-
|
376
|
-
def stub_account_api_save_page_already_exists(page_path:, **options)
|
377
|
-
stub_account_api_save_page(page_path: page_path, **options)
|
378
|
-
end
|
379
|
-
|
380
|
-
def stub_account_api_save_page_cannot_save_page(page_path:, **options)
|
381
|
-
stub_account_api_request(
|
382
|
-
:put,
|
383
|
-
"/api/saved-pages/#{CGI.escape(page_path)}",
|
384
|
-
response_status: 422,
|
385
|
-
response_body: cannot_save_page_problem_detail({ page_path: page_path }),
|
386
|
-
**options,
|
387
|
-
)
|
388
|
-
end
|
389
|
-
|
390
|
-
def stub_account_api_unauthorized_save_page(page_path:, **options)
|
391
|
-
stub_account_api_request(
|
392
|
-
:put,
|
393
|
-
"/api/saved-pages/#{CGI.escape(page_path)}",
|
394
|
-
response_status: 401,
|
395
|
-
**options,
|
396
|
-
)
|
397
|
-
end
|
398
|
-
|
399
|
-
def cannot_save_page_problem_detail(option = {})
|
400
|
-
{
|
401
|
-
title: "Cannot save page",
|
402
|
-
detail: "Cannot save page with path #{option['page_path']}, check it is not blank, and is a well formatted url path.",
|
403
|
-
type: "https://github.com/alphagov/account-api/blob/main/docs/api.md#cannot-save-page",
|
404
|
-
**option,
|
405
|
-
}
|
406
|
-
end
|
407
|
-
|
408
|
-
####################################
|
409
|
-
# DELETE /api/saved-pages/:page_path
|
410
|
-
####################################
|
411
|
-
def stub_account_api_delete_saved_page(page_path:, **options)
|
412
|
-
stub_account_api_request(
|
413
|
-
:delete,
|
414
|
-
"/api/saved-pages/#{CGI.escape(page_path)}",
|
415
|
-
response_status: 204,
|
416
|
-
**options,
|
417
|
-
)
|
418
|
-
end
|
419
|
-
|
420
|
-
def stub_account_api_delete_saved_page_does_not_exist(page_path:, **options)
|
421
|
-
stub_account_api_request(
|
422
|
-
:delete,
|
423
|
-
"/api/saved-pages/#{CGI.escape(page_path)}",
|
424
|
-
response_status: 404,
|
425
|
-
**options,
|
426
|
-
)
|
427
|
-
end
|
428
|
-
|
429
|
-
def stub_account_api_unauthorized_delete_saved_page(page_path:, **options)
|
430
|
-
stub_account_api_request(
|
431
|
-
:delete,
|
432
|
-
"/api/saved-pages/#{CGI.escape(page_path)}",
|
433
|
-
response_status: 401,
|
434
|
-
**options,
|
435
|
-
)
|
436
|
-
end
|
437
300
|
end
|
438
301
|
end
|
439
302
|
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: 75.0.0
|
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: 2021-09-
|
11
|
+
date: 2021-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|