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 +4 -4
- data/lib/gds_api/asset_manager.rb +12 -0
- data/lib/gds_api/test_helpers/asset_manager.rb +16 -0
- data/lib/gds_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45e263a103cf5ffe12a351f0cae320b20a9af8e6
|
4
|
+
data.tar.gz: fab91a8f49f54748db72e70f507471f5fbb478b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/gds_api/version.rb
CHANGED