b2-client 1.0.1 → 1.0.2

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: fd33ba10f4089d70caa9a3c857517300cc428a1589660bff8a99f87779bff547
4
- data.tar.gz: 8a641aeaa454fb3313ef25b2eef2b8120b31874dbc0fb6afb9209bf5cfcabc66
3
+ metadata.gz: e0be79261fee4bcca3e1ba5a8dbe172bc505d38a35b79a0b3e25f81de26a900a
4
+ data.tar.gz: 593efe787fb433de833a8acb964f470ee9f5bc27c71b6ada97af1284e9d955e7
5
5
  SHA512:
6
- metadata.gz: 16103376d13143f6606848a41f2aa4fafa31afec786b4b86dfc1c71e823cdacd692b4aa4b514ae7a5bdde52925ad3cb21fe57cbe6a241d0b375b5aa7cbdfef6f
7
- data.tar.gz: df8e92a10236f6b0f7ae5b303cf262d8d30ad2d605398445b6b47fe65d038b206832e4286ccd234eefb97b82d01e9144df1ad7bcbef1bf819873f827f40217b7
6
+ metadata.gz: 8eb2b33f95494b125c0397de1355063b256c420a717ca4eb0ffd0772f815afd2e094d8dbb7ab22904ef8f7ac651a5e019aa19137e3127a46fa1b6e97982d60d7
7
+ data.tar.gz: 5505cb044eba0400384f2d072fa079bd7adfa8a5a3826719825644ab819d8945f5966cbc69f6485214cddc81a9f8890fbc2b79c72f2e0c110f9418ef474f91bf
data/lib/b2/connection.rb CHANGED
@@ -84,6 +84,7 @@ class B2
84
84
  end
85
85
 
86
86
  def download(bucket, key, to=nil, &block)
87
+ opened_file = (to && to.is_a?(String))
87
88
  to = ::File.open(to, 'wb') if to.is_a?(String)
88
89
  digestor = Digest::SHA1.new
89
90
  data = ""
@@ -117,7 +118,12 @@ class B2
117
118
  end
118
119
  end
119
120
  end
120
-
121
+
122
+ if opened_file
123
+ to.close
124
+ elsif to
125
+ to.flush
126
+ end
121
127
  block.nil? && to.nil? ? data : nil
122
128
  end
123
129
 
data/lib/b2/version.rb CHANGED
@@ -1,3 +1,3 @@
1
- module B2
2
- VERSION = '1.0.1'
1
+ class B2
2
+ VERSION = '1.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: b2-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Bracy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-13 00:00:00.000000000 Z
11
+ date: 2018-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake