b2-client 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 006350eee9b61b446739d43bb95ade334a923b1580d8b979af6649835c4c0194
4
- data.tar.gz: e3ee2264a88ff6d7b1992207ecb5b7a7d40fde199fabe1d001f701c91d22d70c
3
+ metadata.gz: 363125274c03af55134baf86b01809e5a734e95ee66387d99d11f944335dbf77
4
+ data.tar.gz: df553ccde16861367d1880b707e1b9cfcaad9d6ce3b9c57d7dee29bb63fd9598
5
5
  SHA512:
6
- metadata.gz: 287e941dec6ed6c401aae3a8980e95c9ee3ab49d887d3741113ad45724442f3278173c4ecfd07f4359bd133d0210ca404de2790e9ba717b0f5986987934be806
7
- data.tar.gz: cc66419b6b343872265126c4edc2551d5c837475401a5bb082f574bfa374f2deb75789bef334246830fa58bfa29b25f6129440309bf43373b66d1092ce8c606b
6
+ metadata.gz: 832053595b87941afbd6c04b9ff7a3497501540856e329db4346c06b0c43cf01eb45c2e8536826f03d337a430a14e9c3da68cbdb0426c45cae15ee746a50e401
7
+ data.tar.gz: f8912c4ba9c8f00e0554ecf01a9f1919c154efa14ad749e42bd74891ae389529d97272f2579de467737f0eed79b6ac35e6221c38031293aaee2384761d43e57d
@@ -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)
@@ -1,3 +1,3 @@
1
1
  class B2
2
- VERSION = '1.0.4'
2
+ VERSION = '1.0.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: b2-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Bracy