transloadit 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/lib/transloadit.rb +11 -8
- data/lib/transloadit/version.rb +1 -1
- data/test/unit/test_transloadit.rb +14 -4
- metadata +21 -21
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'rubygems/package_task'
|
2
2
|
require 'rake/testtask'
|
3
3
|
|
4
4
|
RUBIES = %w{ 1.9.2 1.8.7 1.8.6 rbx-1.2.0 }
|
@@ -6,7 +6,7 @@ RUBIES = %w{ 1.9.2 1.8.7 1.8.6 rbx-1.2.0 }
|
|
6
6
|
GEMSPEC = 'transloadit.gemspec'
|
7
7
|
|
8
8
|
spec = eval open(GEMSPEC).read
|
9
|
-
|
9
|
+
Gem::PackageTask.new(spec) do |gem|
|
10
10
|
gem.need_tar = true
|
11
11
|
end
|
12
12
|
|
data/lib/transloadit.rb
CHANGED
@@ -17,6 +17,10 @@ class Transloadit
|
|
17
17
|
# @return [String] your Transloadit auth secret, for signing requests
|
18
18
|
attr_accessor :secret
|
19
19
|
|
20
|
+
# @return [Integer] the duration in seconds that signed API requests
|
21
|
+
# generated from this instance remain valid
|
22
|
+
attr_accessor :duration
|
23
|
+
|
20
24
|
#
|
21
25
|
# Creates a new instance of the Transloadit API.
|
22
26
|
#
|
@@ -29,8 +33,9 @@ class Transloadit
|
|
29
33
|
# signing requests (optional)
|
30
34
|
#
|
31
35
|
def initialize(options = {})
|
32
|
-
self.key
|
33
|
-
self.secret
|
36
|
+
self.key = options[:key]
|
37
|
+
self.secret = options[:secret]
|
38
|
+
self.duration = options[:duration] || 5 * 60
|
34
39
|
|
35
40
|
_ensure_key_provided
|
36
41
|
end
|
@@ -102,14 +107,12 @@ class Transloadit
|
|
102
107
|
end
|
103
108
|
|
104
109
|
#
|
105
|
-
#
|
106
|
-
#
|
110
|
+
# Generates an API-compatible request expiration timestamp. Uses the
|
111
|
+
# current instance's duration.
|
107
112
|
#
|
108
|
-
# @param [Integer] duration the number of seconds from now to set the
|
109
|
-
# expiry time
|
110
113
|
# @return [String] an API-compatible timestamp
|
111
114
|
#
|
112
|
-
def _generate_expiry
|
113
|
-
(Time.now + duration).utc.strftime('%Y/%m/%d %H:%M:%S+00:00')
|
115
|
+
def _generate_expiry
|
116
|
+
(Time.now + self.duration).utc.strftime('%Y/%m/%d %H:%M:%S+00:00')
|
114
117
|
end
|
115
118
|
end
|
data/lib/transloadit/version.rb
CHANGED
@@ -2,8 +2,9 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
describe Transloadit do
|
4
4
|
before do
|
5
|
-
@key
|
6
|
-
@secret
|
5
|
+
@key = 'a'
|
6
|
+
@secret = 'b'
|
7
|
+
@duration = 10
|
7
8
|
end
|
8
9
|
|
9
10
|
it 'must allow initialization' do
|
@@ -24,11 +25,16 @@ describe Transloadit do
|
|
24
25
|
t.must_be_kind_of Transloadit
|
25
26
|
end
|
26
27
|
|
28
|
+
it 'must provide a default duration' do
|
29
|
+
Transloadit.new(:key => @key).duration.wont_be_nil
|
30
|
+
end
|
31
|
+
|
27
32
|
describe 'when initialized' do
|
28
33
|
before do
|
29
34
|
@transloadit = Transloadit.new(
|
30
|
-
:key
|
31
|
-
:secret
|
35
|
+
:key => @key,
|
36
|
+
:secret => @secret,
|
37
|
+
:duration => @duration
|
32
38
|
)
|
33
39
|
end
|
34
40
|
|
@@ -40,6 +46,10 @@ describe Transloadit do
|
|
40
46
|
@transloadit.secret.must_equal @secret
|
41
47
|
end
|
42
48
|
|
49
|
+
it 'must allow access to the duration' do
|
50
|
+
@transloadit.duration.must_equal @duration
|
51
|
+
end
|
52
|
+
|
43
53
|
it 'must create steps' do
|
44
54
|
step = @transloadit.step('resize', '/image/resize', :width => 320)
|
45
55
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transloadit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-09-20 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|
17
|
-
requirement: &
|
17
|
+
requirement: &70319633544640 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70319633544640
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: json
|
28
|
-
requirement: &
|
28
|
+
requirement: &70319633544140 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70319633544140
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rake
|
39
|
-
requirement: &
|
39
|
+
requirement: &70319633543580 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70319633543580
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: minitest
|
50
|
-
requirement: &
|
50
|
+
requirement: &70319633543100 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70319633543100
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: simplecov
|
61
|
-
requirement: &
|
61
|
+
requirement: &70319633542540 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70319633542540
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: vcr
|
72
|
-
requirement: &
|
72
|
+
requirement: &70319633542040 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70319633542040
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: webmock
|
83
|
-
requirement: &
|
83
|
+
requirement: &70319633541480 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ! '>='
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: '0'
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *70319633541480
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: yard
|
94
|
-
requirement: &
|
94
|
+
requirement: &70319633540820 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ! '>='
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: '0'
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *70319633540820
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: rdiscount
|
105
|
-
requirement: &
|
105
|
+
requirement: &70319633540240 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ! '>='
|
@@ -110,7 +110,7 @@ dependencies:
|
|
110
110
|
version: '0'
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *70319633540240
|
114
114
|
description: The transloadit gem allows you to automate uploading files through the
|
115
115
|
Transloadit REST API
|
116
116
|
email:
|
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
version: 1.3.6
|
165
165
|
requirements: []
|
166
166
|
rubyforge_project: transloadit
|
167
|
-
rubygems_version: 1.8.
|
167
|
+
rubygems_version: 1.8.8
|
168
168
|
signing_key:
|
169
169
|
specification_version: 3
|
170
170
|
summary: Official Ruby gem for Transloadit
|