aliyunoss-activestorage-adapter 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/active_storage/service/aliyunoss_service.rb +7 -18
- data/lib/active_storage/service/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da85098760deeaa15abaacbfaea96a8f2cd8a400a0f1a4b7929a6aa18c0a12e2
|
4
|
+
data.tar.gz: e4ff1b53aac25dfb3da9aa4dad820c18d46c9a48f47daee88e546146428ee938
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27d4b70af51f81fd2106b87eff63f4e4ca3f78292641647d8faa96e682311d7ec903195b6490815ab021b34caaaa6dd051f7a348ff2b8a41cd857999506ef0a1
|
7
|
+
data.tar.gz: 2db5dbab5e0a78751d8859f639a39228d632bfdd2071c2a4f46f9c75206a2c62d67b6a9db08d189ad7360d1bf529c41eef5cb70db1871c5f991a09368937fc4b
|
data/Gemfile.lock
CHANGED
@@ -40,16 +40,13 @@ module ActiveStorage
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
# Update metadata for the file identified by +key+ in the service.
|
44
|
-
# Override in subclasses only if the service needs to store specific
|
45
|
-
# metadata that has to be updated upon identification.
|
46
|
-
def update_metadata(key, **metadata)
|
47
|
-
raise NotImplementedError
|
48
|
-
end
|
49
|
-
|
50
43
|
# Return the content of the file at the +key+.
|
51
44
|
def download(key)
|
52
|
-
|
45
|
+
if block_given?
|
46
|
+
yield @bucket.download(path_for(key))
|
47
|
+
else
|
48
|
+
@bucket.download(path_for(key))
|
49
|
+
end
|
53
50
|
end
|
54
51
|
|
55
52
|
# Return the partial content in the byte +range+ of the file at the +key+.
|
@@ -57,11 +54,6 @@ module ActiveStorage
|
|
57
54
|
@bucket.download(path_for(key), Range: range)
|
58
55
|
end
|
59
56
|
|
60
|
-
# Concatenate multiple files into a single "composed" file.
|
61
|
-
def compose(source_keys, destination_key, filename: nil, content_type: nil, disposition: nil, custom_metadata: {})
|
62
|
-
raise NotImplementedError
|
63
|
-
end
|
64
|
-
|
65
57
|
# Delete the file at the +key+.
|
66
58
|
def delete(key)
|
67
59
|
@bucket.delete(path_for(key))
|
@@ -108,6 +100,7 @@ module ActiveStorage
|
|
108
100
|
end
|
109
101
|
|
110
102
|
# Returns a Hash of headers for +url_for_direct_upload+ requests.
|
103
|
+
# AliyunOSS API requires 'Date' header
|
111
104
|
def headers_for_direct_upload(key, filename:, content_type:, content_length:, checksum:, custom_metadata: {})
|
112
105
|
@bucket.direct_upload_headers(path_for(key), filename:,
|
113
106
|
content_type:, content_length:, checksum:, custom_metadata: {})
|
@@ -127,11 +120,7 @@ module ActiveStorage
|
|
127
120
|
end
|
128
121
|
|
129
122
|
def public_url(key, **)
|
130
|
-
"https://#{@bucket}.#{@location}.aliyuncs.com#{path_for(key)}"
|
131
|
-
end
|
132
|
-
|
133
|
-
def custom_metadata_headers(metadata)
|
134
|
-
raise NotImplementedError
|
123
|
+
"https://#{@bucket.name}.#{@bucket.location}.aliyuncs.com#{path_for(key)}"
|
135
124
|
end
|
136
125
|
|
137
126
|
def instrument(operation, payload = {}, &block)
|