gds-api-adapters 91.0.0 → 91.1.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: 41e7999151bc881b78197b10d558183acae7e152fa24ab094fe6ffc7b1f3ba04
4
- data.tar.gz: b49490f10d7a25df53c0e9ad1794ae86f5539ec0da7439c8b2e9e0cdd49b3188
3
+ metadata.gz: b228bbfeb3c6670abced9b88f27ff26a2ac8f202c65b4815e7e7bf095bb2f357
4
+ data.tar.gz: dc1d051288ca8e31105dbb25c19f1c822c438b7b15c10a789f4f663fc8d39fa8
5
5
  SHA512:
6
- metadata.gz: b54654c80ed4e66aef36108340a56705d98be773f2c8f3f68c2de337fec44c9ac694c616664b3caf23a9969c92f89bffef7fd8f08ac98c32281abf4b4e25fa53
7
- data.tar.gz: 2204c601e2524af9c848fcd35faae39088c0a8f7716091b21ac59ffd7b5022455dbe39e32722204167449a583a203785b7d1046b5bfae91755057f237c4c7e1a
6
+ metadata.gz: ea46e87d73ad2440115c91e91d73c8aeeb018eca04b0c430bd9c2c5dba7e2041fcc18b62efc0b17631fd8b39cbc9b29098722e8e8404945cf584baef463a0368
7
+ data.tar.gz: caf48a8612c247ac0f6c6e77d0bcf480f77aa74e15fe8ca63316411f818c5a66b36cddc15eb894068e5dfefbe4376b8d9023ae06e0a5b8a5aba5e7a10a623747
@@ -239,6 +239,18 @@ class GdsApi::AssetManager < GdsApi::Base
239
239
  get_raw("#{base_url}/#{uri_encode(legacy_url_path)}")
240
240
  end
241
241
 
242
+ # Fetches an asset given the id and filename
243
+ #
244
+ # @param id [String] The asset identifier.
245
+ # @param filename [String] Filename of the asset.
246
+ # @return [GdsApi::Response] A response object containing the raw asset.
247
+ # If the asset cannot be found, +GdsApi::HTTPNotFound+ will be raised.
248
+ #
249
+ # @raise [HTTPErrorResponse] if the request returns an error
250
+ def media(id, filename)
251
+ get_raw("#{base_url}/media/#{id}/#{filename}")
252
+ end
253
+
242
254
  private
243
255
 
244
256
  def base_url
@@ -21,11 +21,14 @@ module GdsApi
21
21
  .to_return(body: body.to_json, status: 200)
22
22
  end
23
23
 
24
- def stub_asset_manager_has_an_asset(id, atts)
24
+ def stub_asset_manager_has_an_asset(id, atts, filename = "")
25
25
  response = atts.merge("_response_info" => { "status" => "ok" })
26
26
 
27
27
  stub_request(:get, "#{ASSET_MANAGER_ENDPOINT}/assets/#{id}")
28
28
  .to_return(body: response.to_json, status: 200)
29
+
30
+ stub_request(:get, "#{ASSET_MANAGER_ENDPOINT}/media/#{id}/#{filename}")
31
+ .to_return(body: "Some file content", status: 200)
29
32
  end
30
33
 
31
34
  def stub_asset_manager_has_a_whitehall_asset(legacy_url_path, atts)
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "91.0.0".freeze
2
+ VERSION = "91.1.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: 91.0.0
4
+ version: 91.1.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-09-11 00:00:00.000000000 Z
11
+ date: 2023-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable