presigner 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/README.md +1 -1
- data/lib/presigner.rb +4 -3
- data/lib/presigner/version.rb +1 -1
- data/test/test_presigner.rb +20 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3f4adbfcecd30e2ef055e30422d4c742a896a58
|
4
|
+
data.tar.gz: aa759f581b9af22456040a3e952b9f7bbb00455c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9585fa043433eb7240c86ebc5da7f804bdffea17af4e9b54474a5e2af8120a56c525c2ba473d764908fac70c6a7aff0b2a840fdc7c38f586934b5090c8cb0f9
|
7
|
+
data.tar.gz: 1ac7da801128d21b2d1f6aee27a141521d5d7b138bcfe7e67af2e9b4761748088e54bbe44a7da5a2b0f65a6bb0137d9c9b694bcf8e0069d971e3ecee3fdb586c
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/lib/presigner.rb
CHANGED
@@ -9,15 +9,16 @@ class Presigner
|
|
9
9
|
def initialize(options)
|
10
10
|
@bucket = options[:bucket]
|
11
11
|
@key = options[:key]
|
12
|
-
@duration = options[:duration]
|
12
|
+
@duration = options[:duration] || DEFAULT_DURATION
|
13
|
+
@region = options[:region] || "us-east-1"
|
13
14
|
@base = Time.now.to_i
|
14
15
|
end
|
15
16
|
|
16
|
-
attr_reader :duration, :base, :bucket, :key
|
17
|
+
attr_reader :duration, :base, :bucket, :key, :region
|
17
18
|
|
18
19
|
def generate
|
19
20
|
|
20
|
-
s3 = AWS::S3.new
|
21
|
+
s3 = AWS::S3.new(region: region)
|
21
22
|
# check if specified bucket and key exist.
|
22
23
|
begin
|
23
24
|
target_obj = s3.buckets[bucket].objects[key]
|
data/lib/presigner/version.rb
CHANGED
data/test/test_presigner.rb
CHANGED
@@ -27,7 +27,26 @@ class PresignerTest < Test::Unit::TestCase
|
|
27
27
|
|
28
28
|
test "check if duration calculation is correct" do
|
29
29
|
actual = @presigner.calc_duration
|
30
|
-
assert_equal(actual,
|
30
|
+
assert_equal(actual, Presigner::DEFAULT_DURATION)
|
31
|
+
end
|
32
|
+
|
33
|
+
test "check Presigner.new without optional arguments" do
|
34
|
+
presigner = Presigner.new(bucket: 'foobucket',
|
35
|
+
key: 'barkey')
|
36
|
+
## maybe < 2 sec.
|
37
|
+
assert_true(presigner.base < Time.now.to_i + 2 && presigner.base > Time.now.to_i - 1)
|
38
|
+
assert_equal(Presigner::DEFAULT_DURATION, presigner.duration)
|
39
|
+
assert_equal("us-east-1", presigner.region)
|
40
|
+
end
|
41
|
+
|
42
|
+
test "check Presigner.new with optional arguments" do
|
43
|
+
presigner = Presigner.new(bucket: 'foobucket',
|
44
|
+
key: 'barkey',
|
45
|
+
duration: 123,
|
46
|
+
region: 'ap-northeast-1',
|
47
|
+
)
|
48
|
+
assert_equal(123, presigner.duration)
|
49
|
+
assert_equal("ap-northeast-1", presigner.region)
|
31
50
|
end
|
32
51
|
|
33
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: presigner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masao Mochizuki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -149,10 +149,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
151
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.
|
152
|
+
rubygems_version: 2.4.5.1
|
153
153
|
signing_key:
|
154
154
|
specification_version: 4
|
155
155
|
summary: CLI Tool to generate Pre-Signed URL for Amazon S3
|
156
156
|
test_files:
|
157
157
|
- test/test_presigner.rb
|
158
|
-
has_rdoc:
|