gds-api-adapters 88.0.0 → 88.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fa52b3b12ddcdccdb616cec115476df62b8fc6867e57af88f5f548cb4329980
4
- data.tar.gz: d17c3037dff01c916b918f540b148dce2ee32bca682892575cc40edc9fe4e98f
3
+ metadata.gz: 7adeea7abfc8234541609b17eca719cd8d39be01991cc68ca285bda907f9a96a
4
+ data.tar.gz: 3e75818f4bf1a56e94089e94e341a5d8adb8f9a8e3b6faa5a8592f929355a0d9
5
5
  SHA512:
6
- metadata.gz: ca21816f3109d107bf3997ccdd4024a9d0e9734196335585cffef04ee6f9d30e9a0b52dae76648671c766fb2a653499165ba2bcd92874e6112cfb8d2643f438a
7
- data.tar.gz: 1012911579e99a24ce46ac7eb71d12c376ea42ba715240b61730ea262cb0a25de6767daef720f16780f8e59e935f09af5fe269d3e2ee567f8b877425c49e926b
6
+ metadata.gz: a4ae5ac10341ba1c29872cf3772be25db3cbbba4a567a09da807b6b0909c1b7dc8d5bf0acdef4dd93fc07596ea7aa5bb299709f1a11a75d062bbeeb7f1910c12
7
+ data.tar.gz: b4cc259326d27d9c80b5bcf3ec25759ada42ff3f5440013e4056ff01cc44f2140b2c0d82862017ac72bcded2dd65802ca988a6261b5c7866bf5a389ce0edcc43
@@ -128,7 +128,7 @@ class GdsApi::AssetManager < GdsApi::Base
128
128
  post_multipart("#{base_url}/whitehall_assets", asset: asset)
129
129
  end
130
130
 
131
- # Fetches a Whitehall asset given the legacy URL path
131
+ # Fetches a Whitehall asset's metadata given the legacy URL path
132
132
  #
133
133
  # @param legacy_url_path [String] The Whitehall asset identifier.
134
134
  # @return [GdsApi::Response] A response object containing the parsed JSON
@@ -171,7 +171,7 @@ class GdsApi::AssetManager < GdsApi::Base
171
171
  put_multipart("#{base_url}/assets/#{id}", asset: asset)
172
172
  end
173
173
 
174
- # Fetches an asset given the id
174
+ # Fetches an asset's metadata given the id
175
175
  #
176
176
  # @param id [String] The asset identifier (a UUID).
177
177
  # @return [GdsApi::Response, nil] A response object containing the parsed JSON response. If
@@ -228,6 +228,17 @@ class GdsApi::AssetManager < GdsApi::Base
228
228
  post_json("#{base_url}/assets/#{id}/restore")
229
229
  end
230
230
 
231
+ # Fetches a Whitehall asset given the legacy URL path
232
+ #
233
+ # @param legacy_url_path [String] The Whitehall asset identifier.
234
+ # @return [GdsApi::Response] A response object containing the raw asset.
235
+ # If the asset cannot be found, +GdsApi::HTTPNotFound+ will be raised.
236
+ #
237
+ # @raise [HTTPErrorResponse] if the request returns an error
238
+ def whitehall_media(legacy_url_path)
239
+ get_raw("#{base_url}/#{uri_encode(legacy_url_path)}")
240
+ end
241
+
231
242
  private
232
243
 
233
244
  def base_url
@@ -260,6 +260,19 @@ class GdsApi::EmailAlertApi < GdsApi::Base
260
260
  )
261
261
  end
262
262
 
263
+ # Migrate all users from one existing subscriber list to another existing subscriber list
264
+ #
265
+ # @param [string] to_slug Identifier for the successor subscription list
266
+ # @param [string] from_slug Identifier for the source subscription list
267
+
268
+ def bulk_migrate(from_slug:, to_slug:)
269
+ post_json(
270
+ "#{endpoint}/subscriber-lists/bulk-migrate",
271
+ from_slug: from_slug,
272
+ to_slug: to_slug,
273
+ )
274
+ end
275
+
263
276
  # Update subscriber list details, such as title
264
277
  # @param [Hash] params A hash of detail paramaters that can be updated. For example title.
265
278
  # For allowed parameters see:
@@ -33,6 +33,9 @@ module GdsApi
33
33
 
34
34
  stub_request(:get, "#{ASSET_MANAGER_ENDPOINT}/whitehall_assets/#{legacy_url_path}")
35
35
  .to_return(body: response.to_json, status: 200)
36
+
37
+ stub_request(:get, "#{ASSET_MANAGER_ENDPOINT}/#{legacy_url_path}")
38
+ .to_return(body: "Some file content", status: 200)
36
39
  end
37
40
 
38
41
  def stub_asset_manager_does_not_have_an_asset(id)
@@ -456,6 +456,24 @@ module GdsApi
456
456
  .to_return(status: 422)
457
457
  end
458
458
 
459
+ def stub_email_alert_api_bulk_migrate(from_slug:, to_slug:)
460
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/bulk-migrate")
461
+ .with(body: { from_slug: from_slug, to_slug: to_slug }.to_json)
462
+ .to_return(status: 202)
463
+ end
464
+
465
+ def stub_email_alert_api_bulk_migrate_bad_request(from_slug:, to_slug:)
466
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/bulk-migrate")
467
+ .with(body: { from_slug: from_slug, to_slug: to_slug }.to_json)
468
+ .to_return(status: 422)
469
+ end
470
+
471
+ def stub_email_alert_api_bulk_migrate_not_found(from_slug:, to_slug:)
472
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/bulk-migrate")
473
+ .with(body: { from_slug: from_slug, to_slug: to_slug }.to_json)
474
+ .to_return(status: 404)
475
+ end
476
+
459
477
  def stub_update_subscriber_list_details(slug:, params:)
460
478
  stub_request(:patch, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}")
461
479
  .with(body: params.to_json)
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "88.0.0".freeze
2
+ VERSION = "88.2.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: 88.0.0
4
+ version: 88.2.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: 2023-05-23 00:00:00.000000000 Z
11
+ date: 2023-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable