gds-api-adapters 49.5.0 → 49.6.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
  SHA1:
3
- metadata.gz: 0acf4e15b684d05c26eab8a031097d1df852fcf3
4
- data.tar.gz: b32ab9c1a0309b3f2b9f7095caf11c147635f227
3
+ metadata.gz: 45e263a103cf5ffe12a351f0cae320b20a9af8e6
4
+ data.tar.gz: fab91a8f49f54748db72e70f507471f5fbb478b3
5
5
  SHA512:
6
- metadata.gz: 5c430917cb6b1c5750540956640c8ed9242c71067104430a42ab4e053371b043a056dea533a1d4fd83ac8fc6f6de5caf3c0a103e07bad5a81cdf56333c9be1f7
7
- data.tar.gz: 6021f1dc2bbcb09156c4f4f29f103da0e0807d647bf36565fe2123fd596d8ba1b0f853d24d240bb24af66c9de16a257f7e9f52ccb3c86dde3928d983bf583575
6
+ metadata.gz: 2a1b1dec1cc3d235a700a1ab3d5ba3126158778a2d8a254ad1d341ae643e60fc6f2465db30e7dc99cb61048f77d23d0348bab212ac70e630ec31d5e06dddeffd
7
+ data.tar.gz: b0341f37a593d2a474e91b30a0b584465ff7ceb9e3e546d2820b9edbcd5967ba48898c325387aada461c346ef75e141adfc9157cf6746e057342d8fdd97a749e
@@ -127,6 +127,18 @@ class GdsApi::AssetManager < GdsApi::Base
127
127
  post_multipart("#{base_url}/whitehall_assets", asset: asset)
128
128
  end
129
129
 
130
+ # Fetches a Whitehall asset given the legacy URL path
131
+ #
132
+ # @param legacy_url_path [String] The Whitehall asset identifier.
133
+ # @return [GdsApi::Response] A response object containing the parsed JSON
134
+ # response. If the asset cannot be found, +GdsApi::HTTPNotFound+ will be
135
+ # raised.
136
+ #
137
+ # @raise [HTTPErrorResponse] if the request returns an error
138
+ def whitehall_asset(legacy_url_path)
139
+ get_json("#{base_url}/whitehall_assets/#{legacy_url_path}")
140
+ end
141
+
130
142
  # Updates an asset given a hash with one +file+ attribute
131
143
  #
132
144
  # Makes a +PUT+ request to the asset manager api to update an asset.
@@ -10,6 +10,13 @@ module GdsApi
10
10
  .to_return(body: response.to_json, status: 200)
11
11
  end
12
12
 
13
+ def asset_manager_has_a_whitehall_asset(legacy_url_path, atts)
14
+ response = atts.merge("_response_info" => { "status" => "ok" })
15
+
16
+ stub_request(:get, "#{ASSET_MANAGER_ENDPOINT}/whitehall_assets/#{legacy_url_path}")
17
+ .to_return(body: response.to_json, status: 200)
18
+ end
19
+
13
20
  def asset_manager_does_not_have_an_asset(id)
14
21
  response = {
15
22
  "_response_info" => { "status" => "not found" }
@@ -19,6 +26,15 @@ module GdsApi
19
26
  .to_return(body: response.to_json, status: 404)
20
27
  end
21
28
 
29
+ def asset_manager_does_not_have_a_whitehall_asset(legacy_url_path)
30
+ response = {
31
+ "_response_info" => { "status" => "not found" }
32
+ }
33
+
34
+ stub_request(:get, "#{ASSET_MANAGER_ENDPOINT}/whitehall_assets/#{legacy_url_path}")
35
+ .to_return(body: response.to_json, status: 404)
36
+ end
37
+
22
38
  def asset_manager_receives_an_asset(response_url)
23
39
  stub_request(:post, "#{ASSET_MANAGER_ENDPOINT}/assets").to_return(body: { file_url: response_url }.to_json, status: 200)
24
40
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '49.5.0'.freeze
2
+ VERSION = '49.6.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 49.5.0
4
+ version: 49.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Stewart