gds-api-adapters 78.1.0 → 79.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4aced99bb9908549cfe0a2d8f2a57df4e799d55fe7df796f3f29ae7361884694
4
- data.tar.gz: 29835f7a98aaf0cb5e4feadd57de90a2c01231a7dc12f28f5aa99845994a5a9d
3
+ metadata.gz: e10a938b3148397b6c9a4ff3a06a6105f4d07ad02a80b4103440cd065b92d4ba
4
+ data.tar.gz: e246e963aa42bcb62dc1479a076713ce4fefbcac40ca00e07b7f492a54396517
5
5
  SHA512:
6
- metadata.gz: 9f6a041fb8a075caafd88fc3f7828cd41be441ad1b491f5c738bfb3b726bd34993d30eaf52c83da3f55d19ce40267a6141e2221e8fef4a9d5682cede429537a2
7
- data.tar.gz: 0d47922f059483ff795bac96f673f8bb51284a544b0af926e4aa7afbbd6f53c9310a371d53107dd2b1fba3b5656ac8c60fbf6cb0af490b8e295a261958a5b055
6
+ metadata.gz: b2ee8e777bac9cbefe10b5497c5ec6cd48e4f7566cb07eff82bfa35a800c1fa28c99c3bfcd93c2dfa20fc63205c65142ddc4bc4e649ab1fa312565ea03bb324c
7
+ data.tar.gz: 5764cc76a32646d8162f37d76098540acfe10e10d2c27f91504cf72c3a9abc3d8802f01c9d4cd64df920a503184e605ce718c1e0229a96aad52c2fda8e29f5cc
@@ -267,6 +267,17 @@ class GdsApi::EmailAlertApi < GdsApi::Base
267
267
  )
268
268
  end
269
269
 
270
+ # Update subscriber list details, such as title
271
+ # @param [Hash] params A hash of detail paramaters that can be updated. For example title.
272
+ # For allowed parameters see:
273
+ # https://github.com/alphagov/email-alert-api/blob/main/docs/api.md#patch-subscriber-listsxxx
274
+ def update_subscriber_list_details(slug:, params: {})
275
+ patch_json(
276
+ "#{endpoint}/subscriber-lists/#{slug}",
277
+ params,
278
+ )
279
+ end
280
+
270
281
  private
271
282
 
272
283
  def nested_query_string(params)
@@ -440,6 +440,11 @@ module GdsApi
440
440
  ).to_return(status: 404)
441
441
  end
442
442
 
443
+ def stub_email_alert_api_bulk_unsubscribe_conflict(slug:)
444
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/bulk-unsubscribe")
445
+ .to_return(status: 409)
446
+ end
447
+
443
448
  def stub_email_alert_api_bulk_unsubscribe_conflict_with_message(slug:, govuk_request_id:, body:, sender_message_id:)
444
449
  stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/bulk-unsubscribe")
445
450
  .with(
@@ -451,13 +456,43 @@ module GdsApi
451
456
  ).to_return(status: 409)
452
457
  end
453
458
 
454
- def stub_email_alert_api_bulk_unsubscribe_bad_request(slug:, body:)
459
+ def stub_email_alert_api_bulk_unsubscribe_bad_request(slug:)
460
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/bulk-unsubscribe")
461
+ .to_return(status: 422)
462
+ end
463
+
464
+ def stub_email_alert_api_bulk_unsubscribe_bad_request_with_message(slug:, govuk_request_id:, body:, sender_message_id:)
455
465
  stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/bulk-unsubscribe")
456
466
  .with(
457
- body: { body: body }.to_json,
467
+ body: {
468
+ body: body,
469
+ sender_message_id: sender_message_id,
470
+ }.to_json,
471
+ headers: { "Govuk-Request-Id" => govuk_request_id },
458
472
  ).to_return(status: 422)
459
473
  end
460
474
 
475
+ def stub_update_subscriber_list_details(slug:, params:)
476
+ stub_request(:patch, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}")
477
+ .with(body: params.to_json)
478
+ .to_return(
479
+ status: 200,
480
+ body: get_subscriber_list_response(params).to_json,
481
+ )
482
+ end
483
+
484
+ def stub_update_subscriber_list_details_not_found(slug:, params:)
485
+ stub_request(:patch, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}")
486
+ .with(body: params.to_json)
487
+ .to_return(status: 404)
488
+ end
489
+
490
+ def stub_update_subscriber_list_details_unprocessible_entity(slug:, params: {})
491
+ stub_request(:patch, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}")
492
+ .with(body: params.to_json)
493
+ .to_return(status: 422)
494
+ end
495
+
461
496
  private
462
497
 
463
498
  def get_subscriber_response(id, address, govuk_account_id)
@@ -537,6 +572,7 @@ module GdsApi
537
572
  if attributes
538
573
  tags = attributes["tags"]
539
574
  links = attributes["links"]
575
+ content_id = attributes["content_id"]
540
576
  document_type = attributes["document_type"]
541
577
  email_document_supertype = attributes["email_document_supertype"]
542
578
  government_document_supertype = attributes["government_document_supertype"]
@@ -546,6 +582,7 @@ module GdsApi
546
582
  params = {}
547
583
  params[:tags] = tags if tags
548
584
  params[:links] = links if links
585
+ params[:content_id] = content_id if content_id
549
586
  params[:document_type] = document_type if document_type
550
587
  params[:email_document_supertype] = email_document_supertype if email_document_supertype
551
588
  params[:government_document_supertype] = government_document_supertype if government_document_supertype
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "78.1.0".freeze
2
+ VERSION = "79.0.0".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: 78.1.0
4
+ version: 79.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: 2022-01-19 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable