transloadit 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/README.md +15 -1
- data/lib/transloadit.rb +4 -0
- data/lib/transloadit/version.rb +1 -1
- data/test/unit/test_transloadit.rb +11 -4
- metadata +67 -21
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Fantastic file uploading for your web application.
|
|
4
4
|
|
5
5
|
## Description
|
6
6
|
|
7
|
-
This is the official Ruby gem for [Transloadit](transloadit.com). It allows
|
7
|
+
This is the official Ruby gem for [Transloadit](http://transloadit.com). It allows
|
8
8
|
you to automate uploading files through the Transloadit REST API.
|
9
9
|
|
10
10
|
## Install
|
@@ -168,6 +168,20 @@ transloadit.assembly(
|
|
168
168
|
:fields => {:tag => 'ninjacats'}
|
169
169
|
).submit! open('ninja-cat.mpg')
|
170
170
|
```
|
171
|
+
|
172
|
+
### 6. Notify URL
|
173
|
+
|
174
|
+
If you want to be notified when the processing is finished you can provide
|
175
|
+
a notify url for the assembly.
|
176
|
+
|
177
|
+
```ruby
|
178
|
+
transloadit.assembly(
|
179
|
+
:notify_url => 'http://example.com/processing_finished'
|
180
|
+
).submit! open('ninja-cat.mpg')
|
181
|
+
```
|
182
|
+
|
183
|
+
Read up more on the notifications [on Transloadit's documentation page](http://transloadit.com/docs/notifications-vs-redirect-url)
|
184
|
+
|
171
185
|
## Documentation
|
172
186
|
|
173
187
|
Up-to-date YARD documentation is automatically generated. You can view the
|
data/lib/transloadit.rb
CHANGED
@@ -21,6 +21,8 @@ class Transloadit
|
|
21
21
|
# generated from this instance remain valid
|
22
22
|
attr_accessor :duration
|
23
23
|
|
24
|
+
attr_accessor :max_size
|
25
|
+
|
24
26
|
#
|
25
27
|
# Creates a new instance of the Transloadit API.
|
26
28
|
#
|
@@ -36,6 +38,7 @@ class Transloadit
|
|
36
38
|
self.key = options[:key]
|
37
39
|
self.secret = options[:secret]
|
38
40
|
self.duration = options[:duration] || 5 * 60
|
41
|
+
self.max_size = options[:max_size]
|
39
42
|
|
40
43
|
_ensure_key_provided
|
41
44
|
end
|
@@ -84,6 +87,7 @@ class Transloadit
|
|
84
87
|
#
|
85
88
|
def to_hash
|
86
89
|
result = { :key => self.key }
|
90
|
+
result.update(:max_size => self.max_size) unless self.max_size.nil?
|
87
91
|
result.update(:expires => _generate_expiry) unless self.secret.nil?
|
88
92
|
result
|
89
93
|
end
|
data/lib/transloadit/version.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
|
1
|
+
require_relative '../test_helper'
|
2
2
|
|
3
3
|
describe Transloadit do
|
4
4
|
before do
|
5
5
|
@key = 'a'
|
6
6
|
@secret = 'b'
|
7
7
|
@duration = 10
|
8
|
+
@max_size = 100
|
8
9
|
end
|
9
10
|
|
10
11
|
it 'must allow initialization' do
|
@@ -34,7 +35,8 @@ describe Transloadit do
|
|
34
35
|
@transloadit = Transloadit.new(
|
35
36
|
:key => @key,
|
36
37
|
:secret => @secret,
|
37
|
-
:duration => @duration
|
38
|
+
:duration => @duration,
|
39
|
+
:max_size => @max_size
|
38
40
|
)
|
39
41
|
end
|
40
42
|
|
@@ -50,6 +52,10 @@ describe Transloadit do
|
|
50
52
|
@transloadit.duration.must_equal @duration
|
51
53
|
end
|
52
54
|
|
55
|
+
it 'must allow access to the max_size' do
|
56
|
+
@transloadit.max_size.must_equal @max_size
|
57
|
+
end
|
58
|
+
|
53
59
|
it 'must create steps' do
|
54
60
|
step = @transloadit.step('resize', '/image/resize', :width => 320)
|
55
61
|
|
@@ -82,8 +88,9 @@ describe Transloadit do
|
|
82
88
|
end
|
83
89
|
|
84
90
|
it 'must produce Transloadit-compatible hash output' do
|
85
|
-
@transloadit.to_hash[:key]
|
86
|
-
@transloadit.to_hash[:
|
91
|
+
@transloadit.to_hash[:key] .must_equal @key
|
92
|
+
@transloadit.to_hash[:max_size].must_equal @max_size
|
93
|
+
@transloadit.to_hash[:expires] .
|
87
94
|
must_match %r{\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}\+00:00}
|
88
95
|
end
|
89
96
|
|
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.3
|
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:
|
13
|
+
date: 2012-11-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,15 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
26
31
|
- !ruby/object:Gem::Dependency
|
27
32
|
name: json
|
28
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
29
34
|
none: false
|
30
35
|
requirements:
|
31
36
|
- - ! '>='
|
@@ -33,10 +38,15 @@ dependencies:
|
|
33
38
|
version: '0'
|
34
39
|
type: :runtime
|
35
40
|
prerelease: false
|
36
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
37
47
|
- !ruby/object:Gem::Dependency
|
38
48
|
name: rake
|
39
|
-
requirement:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
40
50
|
none: false
|
41
51
|
requirements:
|
42
52
|
- - ! '>='
|
@@ -44,10 +54,15 @@ dependencies:
|
|
44
54
|
version: '0'
|
45
55
|
type: :development
|
46
56
|
prerelease: false
|
47
|
-
version_requirements:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
48
63
|
- !ruby/object:Gem::Dependency
|
49
64
|
name: minitest
|
50
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
51
66
|
none: false
|
52
67
|
requirements:
|
53
68
|
- - ! '>='
|
@@ -55,10 +70,15 @@ dependencies:
|
|
55
70
|
version: '0'
|
56
71
|
type: :development
|
57
72
|
prerelease: false
|
58
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
59
79
|
- !ruby/object:Gem::Dependency
|
60
80
|
name: simplecov
|
61
|
-
requirement:
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
62
82
|
none: false
|
63
83
|
requirements:
|
64
84
|
- - ! '>='
|
@@ -66,10 +86,15 @@ dependencies:
|
|
66
86
|
version: '0'
|
67
87
|
type: :development
|
68
88
|
prerelease: false
|
69
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
70
95
|
- !ruby/object:Gem::Dependency
|
71
96
|
name: vcr
|
72
|
-
requirement:
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
73
98
|
none: false
|
74
99
|
requirements:
|
75
100
|
- - ! '>='
|
@@ -77,10 +102,15 @@ dependencies:
|
|
77
102
|
version: '0'
|
78
103
|
type: :development
|
79
104
|
prerelease: false
|
80
|
-
version_requirements:
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
81
111
|
- !ruby/object:Gem::Dependency
|
82
112
|
name: webmock
|
83
|
-
requirement:
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
84
114
|
none: false
|
85
115
|
requirements:
|
86
116
|
- - ! '>='
|
@@ -88,10 +118,15 @@ dependencies:
|
|
88
118
|
version: '0'
|
89
119
|
type: :development
|
90
120
|
prerelease: false
|
91
|
-
version_requirements:
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
92
127
|
- !ruby/object:Gem::Dependency
|
93
128
|
name: yard
|
94
|
-
requirement:
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
95
130
|
none: false
|
96
131
|
requirements:
|
97
132
|
- - ! '>='
|
@@ -99,10 +134,15 @@ dependencies:
|
|
99
134
|
version: '0'
|
100
135
|
type: :development
|
101
136
|
prerelease: false
|
102
|
-
version_requirements:
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
103
143
|
- !ruby/object:Gem::Dependency
|
104
144
|
name: rdiscount
|
105
|
-
requirement:
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
106
146
|
none: false
|
107
147
|
requirements:
|
108
148
|
- - ! '>='
|
@@ -110,7 +150,12 @@ dependencies:
|
|
110
150
|
version: '0'
|
111
151
|
type: :development
|
112
152
|
prerelease: false
|
113
|
-
version_requirements:
|
153
|
+
version_requirements: !ruby/object:Gem::Requirement
|
154
|
+
none: false
|
155
|
+
requirements:
|
156
|
+
- - ! '>='
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
114
159
|
description: The transloadit gem allows you to automate uploading files through the
|
115
160
|
Transloadit REST API
|
116
161
|
email:
|
@@ -164,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
209
|
version: 1.3.6
|
165
210
|
requirements: []
|
166
211
|
rubyforge_project: transloadit
|
167
|
-
rubygems_version: 1.8.
|
212
|
+
rubygems_version: 1.8.24
|
168
213
|
signing_key:
|
169
214
|
specification_version: 3
|
170
215
|
summary: Official Ruby gem for Transloadit
|
@@ -180,3 +225,4 @@ test_files:
|
|
180
225
|
- test/unit/transloadit/test_request.rb
|
181
226
|
- test/unit/transloadit/test_response.rb
|
182
227
|
- test/unit/transloadit/test_step.rb
|
228
|
+
has_rdoc:
|