b2-client 1.0.4 → 1.0.5
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/b2/connection.rb +8 -3
- data/lib/b2/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: 363125274c03af55134baf86b01809e5a734e95ee66387d99d11f944335dbf77
|
4
|
+
data.tar.gz: df553ccde16861367d1880b707e1b9cfcaad9d6ce3b9c57d7dee29bb63fd9598
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 832053595b87941afbd6c04b9ff7a3497501540856e329db4346c06b0c43cf01eb45c2e8536826f03d337a430a14e9c3da68cbdb0426c45cae15ee746a50e401
|
7
|
+
data.tar.gz: f8912c4ba9c8f00e0554ecf01a9f1919c154efa14ad749e42bd74891ae389529d97272f2579de467737f0eed79b6ac35e6221c38031293aaee2384761d43e57d
|
data/lib/b2/connection.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
|
1
3
|
class B2
|
2
4
|
class Connection
|
3
5
|
|
@@ -98,13 +100,16 @@ class B2
|
|
98
100
|
@buckets_cache.find{ |b| b.name == name }&.id
|
99
101
|
end
|
100
102
|
|
101
|
-
def get_download_url(bucket, filename, expires_in: 3_600)
|
103
|
+
def get_download_url(bucket, filename, expires_in: 3_600, disposition: nil)
|
102
104
|
response = post("/b2api/v1/b2_get_download_authorization", {
|
103
105
|
bucketId: lookup_bucket_id(bucket),
|
104
106
|
fileNamePrefix: filename,
|
105
|
-
validDurationInSeconds: expires_in
|
107
|
+
validDurationInSeconds: expires_in,
|
108
|
+
b2ContentDisposition: disposition
|
106
109
|
})
|
107
|
-
@download_url + '/file/' + bucket + '/' + filename + "?Authorization=" + response['authorizationToken']
|
110
|
+
url = @download_url + '/file/' + bucket + '/' + filename + "?Authorization=" + response['authorizationToken']
|
111
|
+
url += "&b2ContentDisposition=#{CGI.escape(disposition)}" if disposition
|
112
|
+
url
|
108
113
|
end
|
109
114
|
|
110
115
|
def download(bucket, key, to=nil, &block)
|
data/lib/b2/version.rb
CHANGED