open-uri-s3 1.4.0 → 1.5.0

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: 173a6d9e73fff6d19915a376e1afa06cf1ca3104
4
- data.tar.gz: ac7354c002aaa90e3df0fb3b1094f521a3514c9f
3
+ metadata.gz: 818e0f417de91f2ff326399a1a07e9d1b7a5c822
4
+ data.tar.gz: 8db7c78d571007f1fcb263e6d97bdbbdb52b84fc
5
5
  SHA512:
6
- metadata.gz: 019e2867e6e0929cba03330e18d3150f5f10fac051c4bf4733c7d5fbbe4a312154333ea5ab5f2d3058d2ff55274d0b0b295fc17e52332fe4747d9478ae2b29de
7
- data.tar.gz: 905c19d72cd9199c8f766bdd20d0083c606f1d030f508f144723d83b040a5dac3b443f410bf5ac682b7be07b9af292eb1c467c240ff0d5016c2dda71c563a584
6
+ metadata.gz: 9792b83ea026bb21d428fda3aeba0b4af5190cbbb4083dfb80273cb0e0bbedaad7f8f4eb9c86773e9045b98ded597c69c65413087e8635fb474749d04f4ee85d
7
+ data.tar.gz: e181494ace6718df65f0e0d6e62e06e7e2fca4b8b9875b682da917db825bae669b9cc271cb9ce4a64717293ecab139a4aab0de7b900282c67fe93ce173e1077d
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
  # Add dependencies required to use your gem here.
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
- gem 'aws-sdk'
5
+ gem 'aws-sdk-v1'
6
6
 
7
7
  # Add dependencies to develop your gem here.
8
8
  # Include everything needed to run rake, tests, features, etc.
data/README.md CHANGED
@@ -9,7 +9,7 @@ require 'open-uri-s3'
9
9
  Reading objects:
10
10
 
11
11
  ```ruby
12
- open('s3://my.bucket/public/hello') # returns Aws::S3::Object (quacks like IO)
12
+ open('s3://my.bucket/public/hello') # returns AWS::S3::S3Object (quacks like IO)
13
13
  ```
14
14
 
15
15
  or a safer option (see [this post][open-uri-dangers] on the dangers of using open-uri with user input)
@@ -39,5 +39,5 @@ open('s3://my.bucket/public/hello', 'w'){|f| f.write 'Hello world!'}
39
39
  Copyright (c) 2013 Erik Terpstra. See LICENSE.txt for
40
40
  further details.
41
41
 
42
- [![open-uri-s3 API Documentation](https://dqvhmzwrjy66y.cloudfront.net/assets/badge-d08eb706b0adfe1d16fe2ca9c1e49cbc.png)](https://www.omniref.com/ruby/gems/open-uri-s3)
42
+ [![open-uri-s3 API Documentation](https://www.omniref.com/ruby/gems/open-uri-s3.png)](https://www.omniref.com/ruby/gems/open-uri-s3)
43
43
  [open-uri-dangers]: http://sakurity.com/blog/2015/02/28/openuri.html
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.5.0
@@ -1,22 +1,21 @@
1
- require 'aws-sdk'
1
+ require 'aws-sdk-v1'
2
2
  require 'open-uri'
3
3
  require 'uri'
4
4
 
5
5
  module URI
6
6
  class S3 < Generic
7
7
 
8
- # @return [Aws::S3::Object] S3 object (quacks like IO)
8
+ # @return [AWS::S3::S3Object] S3 object (quacks like IO)
9
9
  def open(*args)
10
- client = Aws::S3::Client.new
11
- bucket_location = client.get_bucket_location(bucket: self.hostname)
12
- location_constraint = bucket_location.data.location_constraint
13
-
14
- if !location_constraint.empty?
15
- client = Aws::S3::Client.new(region: location_constraint)
10
+ s3 = ::AWS::S3.new
11
+ bucket = s3.buckets[self.hostname]
12
+ if bucket.location_constraint
13
+ s3 = ::AWS::S3.new(s3_endpoint: "s3-#{bucket.location_constraint}.amazonaws.com")
14
+ bucket = s3.buckets[self.hostname]
16
15
  end
17
16
 
18
17
  path = self.path[1..-1]
19
- object = client.get_object(bucket: self.hostname, key: path).body
18
+ object = bucket.objects[path]
20
19
 
21
20
  if block_given?
22
21
  yield object
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "open-uri-s3"
8
- s.version = "1.4.0"
8
+ s.version = "1.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Erik Terpstra"]
12
- s.date = "2015-11-24"
12
+ s.date = "2015-11-27"
13
13
  s.description = "AWS S3 protocol support for open-uri"
14
14
  s.email = "erterpstra@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -38,14 +38,14 @@ Gem::Specification.new do |s|
38
38
  s.specification_version = 4
39
39
 
40
40
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
41
- s.add_runtime_dependency(%q<aws-sdk>, [">= 0"])
41
+ s.add_runtime_dependency(%q<aws-sdk-v1>, [">= 0"])
42
42
  s.add_development_dependency(%q<rspec>, ["~> 3.2.0"])
43
43
  s.add_development_dependency(%q<yard>, ["~> 0.7"])
44
44
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
45
45
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
46
46
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.8"])
47
47
  else
48
- s.add_dependency(%q<aws-sdk>, [">= 0"])
48
+ s.add_dependency(%q<aws-sdk-v1>, [">= 0"])
49
49
  s.add_dependency(%q<rspec>, ["~> 3.2.0"])
50
50
  s.add_dependency(%q<yard>, ["~> 0.7"])
51
51
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
@@ -53,7 +53,7 @@ Gem::Specification.new do |s|
53
53
  s.add_dependency(%q<jeweler>, ["~> 1.8.8"])
54
54
  end
55
55
  else
56
- s.add_dependency(%q<aws-sdk>, [">= 0"])
56
+ s.add_dependency(%q<aws-sdk-v1>, [">= 0"])
57
57
  s.add_dependency(%q<rspec>, ["~> 3.2.0"])
58
58
  s.add_dependency(%q<yard>, ["~> 0.7"])
59
59
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
@@ -10,7 +10,7 @@ describe URI::S3 do
10
10
  let(:object) { double('object', read: 'contents') }
11
11
 
12
12
  before do
13
- allow(Aws::S3::Client).to receive(:new).and_return(s3)
13
+ allow(AWS::S3).to receive(:new).and_return(s3)
14
14
  end
15
15
 
16
16
  describe "open" do
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open-uri-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-24 00:00:00.000000000 Z
11
+ date: 2015-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: aws-sdk
14
+ name: aws-sdk-v1
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - '>='