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 +4 -4
- data/Gemfile +2 -2
- data/README.md +2 -2
- data/VERSION +1 -1
- data/lib/open-uri-s3.rb +8 -9
- data/open-uri-s3.gemspec +5 -5
- data/spec/lib/open-uri-s3_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 818e0f417de91f2ff326399a1a07e9d1b7a5c822
|
4
|
+
data.tar.gz: 8db7c78d571007f1fcb263e6d97bdbbdb52b84fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9792b83ea026bb21d428fda3aeba0b4af5190cbbb4083dfb80273cb0e0bbedaad7f8f4eb9c86773e9045b98ded597c69c65413087e8635fb474749d04f4ee85d
|
7
|
+
data.tar.gz: e181494ace6718df65f0e0d6e62e06e7e2fca4b8b9875b682da917db825bae669b9cc271cb9ce4a64717293ecab139a4aab0de7b900282c67fe93ce173e1077d
|
data/Gemfile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
source "
|
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
|
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://
|
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.
|
1
|
+
1.5.0
|
data/lib/open-uri-s3.rb
CHANGED
@@ -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 [
|
8
|
+
# @return [AWS::S3::S3Object] S3 object (quacks like IO)
|
9
9
|
def open(*args)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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 =
|
18
|
+
object = bucket.objects[path]
|
20
19
|
|
21
20
|
if block_given?
|
22
21
|
yield object
|
data/open-uri-s3.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "open-uri-s3"
|
8
|
-
s.version = "1.
|
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-
|
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"])
|
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
|
+
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-
|
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
|
- - '>='
|