gds-api-adapters 37.0.0 → 37.1.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 +23 -0
- data/lib/gds_api/version.rb +1 -1
- data/test/asset_manager_test.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cd9bfb40b63824da15fe31a714a66fd8512af2b
|
4
|
+
data.tar.gz: e5644d7072987cbd47d7075dd0efbc44655fe34b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c713da493b564dd0314b4c966b9e83a54f35a36d9830634bcf1ebe6f7daa22012b6095a16dedf45f79fa6cb017cefe08c94d6e1c981187b24b4a7daf3d1ed9f
|
7
|
+
data.tar.gz: fd47cf2ce466072e5bf0221e1b1949589671c30972a718fd0285d68ce29e6f95046f79b74b1e30c0f5ff360a42a18672ce9624cda5d6a519a4326790fb26d094
|
@@ -114,6 +114,29 @@ class GdsApi::AssetManager < GdsApi::Base
|
|
114
114
|
delete_json("#{base_url}/assets/#{id}")
|
115
115
|
end
|
116
116
|
|
117
|
+
# Restores an asset given an id
|
118
|
+
#
|
119
|
+
# Makes a +POST+ request to the asset manager api to restore an asset.
|
120
|
+
#
|
121
|
+
# @param id [String] The asset identifier (a UUID).
|
122
|
+
# @return [GdsApi::Response] The wrapped http response from the api. Behaves
|
123
|
+
# both as a +Hash+ and an +OpenStruct+, and responds to the following:
|
124
|
+
# :id the URL of the asset
|
125
|
+
# :name the filename of the asset that will be served
|
126
|
+
# :content_type the content_type of the asset
|
127
|
+
# :file_url the URL from which the asset will be served when it has
|
128
|
+
# passed a virus scan
|
129
|
+
# :state One of 'unscanned', 'clean', or 'infected'. Unless the state is
|
130
|
+
# 'clean' the asset at the :file_url will 404
|
131
|
+
#
|
132
|
+
# @raise [HTTPErrorResponse] if the request returns an error
|
133
|
+
# @example Restore a deleted file
|
134
|
+
# uuid = '594602dd-75b3-4e6f-b5d1-cacf8c4d4164'
|
135
|
+
# asset_manager.restore_asset(uuid)
|
136
|
+
def restore_asset(id)
|
137
|
+
post_json("#{base_url}/assets/#{id}/restore")
|
138
|
+
end
|
139
|
+
|
117
140
|
private
|
118
141
|
def base_url
|
119
142
|
endpoint
|
data/lib/gds_api/version.rb
CHANGED
data/test/asset_manager_test.rb
CHANGED
@@ -81,4 +81,14 @@ describe GdsApi::AssetManager do
|
|
81
81
|
assert_equal "#{base_api_url}/assets/#{asset_id}", response['asset']['id']
|
82
82
|
assert_requested(req)
|
83
83
|
end
|
84
|
+
|
85
|
+
it "restores an asset for the given id" do
|
86
|
+
req = stub_request(:post, "#{base_api_url}/assets/#{asset_id}/restore").
|
87
|
+
to_return(body: JSON.dump(asset_manager_response), status: 200)
|
88
|
+
|
89
|
+
response = api.restore_asset(asset_id)
|
90
|
+
|
91
|
+
assert_equal "#{base_api_url}/assets/#{asset_id}", response['asset']['id']
|
92
|
+
assert_requested(req)
|
93
|
+
end
|
84
94
|
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: 37.
|
4
|
+
version: 37.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Stewart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|