s3_streamer 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 08b8b13f35734bff5cbdcb9a4cf1ba0770b0671d
4
- data.tar.gz: 570918eb21651ecd7a1bd3545395c1eccd1691db
3
+ metadata.gz: 7c181c889ed6d751e84085c78387de22a1e33014
4
+ data.tar.gz: 9a2fca7fb1659498be13eb5239ab977e6a9c0ea9
5
5
  SHA512:
6
- metadata.gz: 8a7cfe74390bd782a5f5b7af9e440b8260dc7a8c215d1e1a9fcb573ecc42ea466a1d4ff35976181b4f7e8b3bcbb11238f62754c811ad0fb74bb43e6a6e317083
7
- data.tar.gz: 6bc5a341149f6d92ddce682fd5904f9a19260bdb901a166390a28d8d7f79995914d87c8af27f1c30726269750b1bd1361fbf595cbf7b7210eac3958f4e724d81
6
+ metadata.gz: d8e9b881c41b52304a89cf806b08be15a104714c6ca453c9309e159263cd5e738b5b07ab4c69fc7cd1ceead81181aade618f2f664438e5d25054915d673194a2
7
+ data.tar.gz: a0ebd11a12453a721181ebc7616fff81d36f12112e45446eee6f9a1e6fea2f7fa4ab79fedf1072afefe96de2a5b56a9610b5cdea687087d7baf63941e321372c
@@ -5,14 +5,16 @@ module S3Streamer
5
5
  class Downstream
6
6
  DEFAULT_PART_SIZE = 10 * 1024 * 1024
7
7
 
8
+ attr_reader :uri
9
+
8
10
  def initialize(uri, options={})
9
11
  @uri = uri
10
12
  @options = options
11
13
  end
12
14
 
13
15
  def each
14
- Net::HTTP.start(@uri.host) do |http|
15
- http.request(Net::HTTP::Get.new @uri) do |response|
16
+ Net::HTTP.start(uri.host, uri.port, use_ssl: use_ssl) do |http|
17
+ http.request get_uri do |response|
16
18
  buffer = BufferedWriter.new(min_part_size: part_size) do |part|
17
19
  yield part
18
20
  end
@@ -26,6 +28,14 @@ module S3Streamer
26
28
 
27
29
  private
28
30
 
31
+ def use_ssl
32
+ uri.scheme == 'https'
33
+ end
34
+
35
+ def get_uri
36
+ Net::HTTP::Get.new uri
37
+ end
38
+
29
39
  def part_size
30
40
  @options[:part_size] || DEFAULT_PART_SIZE
31
41
  end
@@ -1,3 +1,3 @@
1
1
  module S3Streamer
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_streamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - thilonel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-26 00:00:00.000000000 Z
11
+ date: 2016-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.6.4
128
+ rubygems_version: 2.5.1
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: Stream a file from a remote url using the Ruby AWS SDK to an Amazon S3 bucket.