transloadit 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +12 -0
- data/CHANGELOG.md +5 -1
- data/README.md +9 -7
- data/Rakefile +1 -33
- data/lib/transloadit.rb +2 -2
- data/lib/transloadit/assembly.rb +1 -1
- data/lib/transloadit/request.rb +3 -3
- data/lib/transloadit/response.rb +1 -1
- data/lib/transloadit/step.rb +1 -1
- data/lib/transloadit/version.rb +1 -1
- data/test/fixtures/cassettes/cancel_assembly.yml +32 -22
- data/test/fixtures/cassettes/fetch_assembly.yml +32 -21
- data/test/fixtures/cassettes/fetch_bored.yml +57 -47
- data/test/fixtures/cassettes/post_assembly.yml +36 -27
- data/test/fixtures/cassettes/submit_assembly.yml +62 -49
- data/test/test_helper.rb +2 -2
- data/test/unit/test_transloadit.rb +3 -3
- data/test/unit/transloadit/test_assembly.rb +3 -3
- data/test/unit/transloadit/test_response.rb +1 -1
- data/test/unit/transloadit/test_step.rb +1 -1
- data/transloadit.gemspec +3 -3
- metadata +9 -8
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
### 1.0.
|
1
|
+
### 1.0.5 / 2013-03-13 ###
|
2
|
+
|
3
|
+
* Use MultiJSON so everyone can use the JSON parser they like. (thanks @kselden for the patch)
|
4
|
+
|
5
|
+
### 1.0.4 / 2013-03-06 ###
|
2
6
|
|
3
7
|
* allow symbols as keys for response attributes (thanks @gbuesing for reporting)
|
4
8
|
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/transloadit/ruby-sdk.png?branch=master)](https://travis-ci.org/transloadit/ruby-sdk)
|
2
|
+
|
1
3
|
# transloadit
|
2
4
|
|
3
5
|
Fantastic file uploading for your web application.
|
@@ -190,11 +192,11 @@ for the latest [git master](http://rubydoc.info/github/transloadit/ruby-sdk/mast
|
|
190
192
|
|
191
193
|
## Compatibility
|
192
194
|
|
193
|
-
At a minimum, this gem should work on MRI 1.9.2, 1
|
194
|
-
1.
|
195
|
-
|
195
|
+
At a minimum, this gem should work on MRI 2.0.0, 1.9.3, 1.9.2, 1,8.7, Rubinius in both 1.8 mode and 1.9 mode,
|
196
|
+
and JRuby in both 1.8 mode and 1.9 mode. It may also work on 1.8.6, but support for those
|
197
|
+
Rubies is not guaranteed. If it doesn't work on one of the officially supported Rubies, please file a
|
198
|
+
[bug report](https://github.com/transloadit/ruby-sdk/issues). Compatibility patches for other Rubies
|
199
|
+
are welcomed.
|
196
200
|
|
197
|
-
|
198
|
-
|
199
|
-
RVM environments. [RVM](rvm.beginrescueend.com/) must be installed in order to
|
200
|
-
test against multiple Rubies.
|
201
|
+
Testing against these versions is performed automatically by
|
202
|
+
[Travis CI](https://travis-ci.org/transloadit/ruby-sdk).
|
data/Rakefile
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'rubygems/package_task'
|
2
2
|
require 'rake/testtask'
|
3
3
|
|
4
|
-
RUBIES = %w{ 1.9.2 1.8.7 1.8.6 rbx-1.2.0 }
|
5
|
-
|
6
4
|
GEMSPEC = 'transloadit.gemspec'
|
7
5
|
|
8
6
|
spec = eval open(GEMSPEC).read
|
@@ -15,40 +13,10 @@ Rake::TestTask.new do |test|
|
|
15
13
|
test.pattern = 'test/**/test_*.rb'
|
16
14
|
end
|
17
15
|
|
18
|
-
namespace :test do
|
19
|
-
begin
|
20
|
-
`rvm -v` # raise an exception if RVM isn't installed
|
21
|
-
|
22
|
-
desc 'Run tests against all supported Rubies'
|
23
|
-
task :multiruby do
|
24
|
-
system "rvm #{RUBIES.join(',')} ruby bundle exec rake -s test"
|
25
|
-
|
26
|
-
# clean up after Rubinius
|
27
|
-
require 'pathname'
|
28
|
-
Pathname.glob('**/*.rbc').each {|path| path.unlink }
|
29
|
-
end
|
30
|
-
|
31
|
-
namespace :multiruby do
|
32
|
-
desc 'Prepare supported rubiesfor testing'
|
33
|
-
task :setup do
|
34
|
-
warn 'Preparing multiruby. This may take awhile...'
|
35
|
-
|
36
|
-
# create gemsets, install bundler, bundle
|
37
|
-
RUBIES.each {|ruby| system "rvm #{ruby} gemset create transloadit" }
|
38
|
-
system "rvm #{RUBIES.join(',')} gem install bundler --no-ri --no-rdoc"
|
39
|
-
system "rvm #{RUBIES.join(',')} ruby bundle install"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
rescue Errno::ENOENT
|
43
|
-
desc 'You need `rvm` installed to test against multiple Rubies'
|
44
|
-
task :multiruby
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
16
|
begin
|
49
17
|
require 'yard'
|
50
18
|
require 'yard/rake/yardoc_task'
|
51
|
-
|
19
|
+
|
52
20
|
YARD::Rake::YardocTask.new :doc do |yard|
|
53
21
|
yard.options = %w{
|
54
22
|
--title Transloadit
|
data/lib/transloadit.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'multi_json'
|
2
2
|
|
3
3
|
#
|
4
4
|
# Implements the Transloadit REST API in Ruby. Check the {file:README.md README}
|
@@ -96,7 +96,7 @@ class Transloadit
|
|
96
96
|
# @return [String] JSON-encoded String containing the object's hash contents
|
97
97
|
#
|
98
98
|
def to_json
|
99
|
-
self.to_hash
|
99
|
+
MultiJson.dump(self.to_hash)
|
100
100
|
end
|
101
101
|
|
102
102
|
private
|
data/lib/transloadit/assembly.rb
CHANGED
data/lib/transloadit/request.rb
CHANGED
@@ -149,7 +149,7 @@ class Transloadit::Request
|
|
149
149
|
return {} if payload.respond_to?(:empty?) and payload.empty?
|
150
150
|
|
151
151
|
# TODO: refactor this, don't update a hash that's not ours
|
152
|
-
payload.update :params => payload[:params]
|
152
|
+
payload.update :params => MultiJson.dump(payload[:params])
|
153
153
|
payload.update :signature => self.signature(payload[:params])
|
154
154
|
payload.delete :signature if payload[:signature].nil?
|
155
155
|
payload
|
@@ -169,7 +169,7 @@ class Transloadit::Request
|
|
169
169
|
|
170
170
|
escape = Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")
|
171
171
|
params = {
|
172
|
-
:params => URI.escape(params
|
172
|
+
:params => URI.escape(MultiJson.dump(params), escape),
|
173
173
|
:signature => self.signature(params)
|
174
174
|
}
|
175
175
|
|
@@ -194,7 +194,7 @@ class Transloadit::Request
|
|
194
194
|
# @return [String] the HMAC signature for the params
|
195
195
|
#
|
196
196
|
def signature(params)
|
197
|
-
self.class._hmac(self.secret, params) if self.secret
|
197
|
+
self.class._hmac(self.secret, params) if self.secret.to_s.length > 0
|
198
198
|
end
|
199
199
|
|
200
200
|
private
|
data/lib/transloadit/response.rb
CHANGED
data/lib/transloadit/step.rb
CHANGED
data/lib/transloadit/version.rb
CHANGED
@@ -1,30 +1,40 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: http://api2.jane.transloadit.com
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: http://api2.jane.transloadit.com/assemblies/76fe5df1c93a0a530f3e583805cf98b4
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
11
13
|
- gzip, deflate
|
12
|
-
|
14
|
+
User-Agent:
|
13
15
|
- Transloadit Ruby SDK 0.1.2
|
14
|
-
response:
|
15
|
-
status:
|
16
|
+
response:
|
17
|
+
status:
|
16
18
|
code: 200
|
17
19
|
message: OK
|
18
|
-
headers:
|
19
|
-
|
20
|
+
headers:
|
21
|
+
Content-Type:
|
20
22
|
- text/plain
|
21
|
-
|
22
|
-
-
|
23
|
-
|
23
|
+
Access-Control-Allow-Origin:
|
24
|
+
- ! '*'
|
25
|
+
Access-Control-Allow-Methods:
|
24
26
|
- POST, GET, PUT, DELETE, OPTIONS
|
25
|
-
|
27
|
+
Access-Control-Allow-Headers:
|
26
28
|
- X-Requested-With, Content-Type, Accept, Content-Length
|
27
|
-
|
29
|
+
Transfer-Encoding:
|
28
30
|
- chunked
|
29
|
-
body:
|
30
|
-
|
31
|
+
body:
|
32
|
+
encoding: UTF-8
|
33
|
+
string: ! '{"ok":"ASSEMBLY_CANCELED","message":"The assembly was canceled.","assembly_id":"76fe5df1c93a0a530f3e583805cf98b4","assembly_url":"http://api2.jane.transloadit.com/assemblies/76fe5df1c93a0a530f3e583805cf98b4","bytes_received":95355,"bytes_expected":95355,"client_agent":"Transloadit
|
34
|
+
Ruby SDK 0.1.2","client_ip":"74.95.29.209","client_referer":null,"start_date":"2011/02/21
|
35
|
+
15:54:17 GMT","upload_duration":0.394,"execution_duration":0.006,"fields":{},"uploads":[{"id":"0767b43537389a177a1be96ab06e8a4b","name":"test.png","basename":"test","ext":"png","size":95010,"mime":"image/jpeg","type":"image","field":"file_0","original_id":"0767b43537389a177a1be96ab06e8a4b","url":"http://tmp.jane.transloadit.com/upload/bf7801cb21fb96cbafd403467244d125.png","meta":{"width":640,"height":480,"date_recorded":null,"date_file_created":null,"date_file_modified":"2011/02/21
|
36
|
+
15:54:17 GMT","title":null,"description":null,"location":null,"city":null,"state":null,"country":null,"country_code":null,"keywords":"Photo
|
37
|
+
Booth","aperture":null,"exposure_compensation":null,"exposure_mode":null,"exposure_time":null,"flash":null,"focal_length":null,"f_number":null,"iso":null,"light_value":null,"metering_mode":null,"shutter_speed":null,"white_balance":null,"device_name":null,"device_vendor":null,"device_software":null,"latitude":null,"longitude":null,"frame_count":null}}],"results":{}}'
|
38
|
+
http_version: '1.1'
|
39
|
+
recorded_at: Fri, 08 Mar 2013 15:13:10 GMT
|
40
|
+
recorded_with: VCR 2.4.0
|
@@ -1,28 +1,39 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: http://api2.jane.transloadit.com
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://api2.jane.transloadit.com/assemblies/76fe5df1c93a0a530f3e583805cf98b4
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
11
13
|
- gzip, deflate
|
12
|
-
response:
|
13
|
-
status:
|
14
|
+
response:
|
15
|
+
status:
|
14
16
|
code: 200
|
15
17
|
message: OK
|
16
|
-
headers:
|
17
|
-
|
18
|
+
headers:
|
19
|
+
Content-Type:
|
18
20
|
- text/plain
|
19
|
-
|
20
|
-
-
|
21
|
-
|
21
|
+
Access-Control-Allow-Origin:
|
22
|
+
- ! '*'
|
23
|
+
Access-Control-Allow-Methods:
|
22
24
|
- POST, GET, PUT, DELETE, OPTIONS
|
23
|
-
|
25
|
+
Access-Control-Allow-Headers:
|
24
26
|
- X-Requested-With, Content-Type, Accept, Content-Length
|
25
|
-
|
27
|
+
Transfer-Encoding:
|
26
28
|
- chunked
|
27
|
-
body:
|
28
|
-
|
29
|
+
body:
|
30
|
+
encoding: UTF-8
|
31
|
+
string: ! '{"ok":"ASSEMBLY_COMPLETED","message":"The assembly was successfully
|
32
|
+
completed.","assembly_id":"76fe5df1c93a0a530f3e583805cf98b4","assembly_url":"http://api2.jane.transloadit.com/assemblies/76fe5df1c93a0a530f3e583805cf98b4","bytes_received":95355,"bytes_expected":95355,"client_agent":"Transloadit
|
33
|
+
Ruby SDK 0.1.2","client_ip":"74.95.29.209","client_referer":null,"start_date":"2011/02/21
|
34
|
+
15:54:17 GMT","upload_duration":0.394,"execution_duration":0.006,"fields":{},"uploads":[{"id":"0767b43537389a177a1be96ab06e8a4b","name":"test.png","basename":"test","ext":"png","size":95010,"mime":"image/jpeg","type":"image","field":"file_0","original_id":"0767b43537389a177a1be96ab06e8a4b","url":"http://tmp.jane.transloadit.com/upload/bf7801cb21fb96cbafd403467244d125.png","meta":{"width":640,"height":480,"date_recorded":null,"date_file_created":null,"date_file_modified":"2011/02/21
|
35
|
+
15:54:17 GMT","title":null,"description":null,"location":null,"city":null,"state":null,"country":null,"country_code":null,"keywords":"Photo
|
36
|
+
Booth","aperture":null,"exposure_compensation":null,"exposure_mode":null,"exposure_time":null,"flash":null,"focal_length":null,"f_number":null,"iso":null,"light_value":null,"metering_mode":null,"shutter_speed":null,"white_balance":null,"device_name":null,"device_vendor":null,"device_software":null,"latitude":null,"longitude":null,"frame_count":null}}],"results":{}}'
|
37
|
+
http_version: '1.1'
|
38
|
+
recorded_at: Fri, 08 Mar 2013 15:13:10 GMT
|
39
|
+
recorded_with: VCR 2.4.0
|
@@ -1,63 +1,73 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: http://api2.transloadit.com
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://api2.transloadit.com/instances/bored
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
11
13
|
- gzip, deflate
|
12
|
-
|
14
|
+
User-Agent:
|
13
15
|
- Transloadit Ruby SDK 0.1.2
|
14
|
-
response:
|
15
|
-
status:
|
16
|
+
response:
|
17
|
+
status:
|
16
18
|
code: 200
|
17
19
|
message: OK
|
18
|
-
headers:
|
19
|
-
|
20
|
+
headers:
|
21
|
+
Access-Control-Allow-Headers:
|
20
22
|
- X-Requested-With, Content-Type, Accept, Content-Length
|
21
|
-
|
23
|
+
Access-Control-Allow-Methods:
|
22
24
|
- POST, GET, PUT, DELETE, OPTIONS
|
23
|
-
|
24
|
-
-
|
25
|
-
|
25
|
+
Access-Control-Allow-Origin:
|
26
|
+
- ! '*'
|
27
|
+
Content-Type:
|
26
28
|
- text/plain
|
27
|
-
|
28
|
-
-
|
29
|
-
|
29
|
+
Content-Length:
|
30
|
+
- '94'
|
31
|
+
Connection:
|
30
32
|
- keep-alive
|
31
|
-
body:
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
-
|
41
|
-
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: ! '{"ok":"BORED_INSTANCE_FOUND","host":"jane.transloadit.com","api2_host":"jane.transloadit.com"}'
|
36
|
+
http_version: '1.1'
|
37
|
+
recorded_at: Fri, 08 Mar 2013 15:13:10 GMT
|
38
|
+
- request:
|
39
|
+
method: get
|
40
|
+
uri: http://api2.transloadit.com/instances/bored?params=%7B%22params%22:%7B%22foo%22:%22bar%22%7D%7D
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: ''
|
44
|
+
headers:
|
45
|
+
Accept:
|
46
|
+
- ! '*/*; q=0.5, application/xml'
|
47
|
+
Accept-Encoding:
|
42
48
|
- gzip, deflate
|
43
|
-
|
49
|
+
User-Agent:
|
44
50
|
- Transloadit Ruby SDK 0.1.2
|
45
|
-
response:
|
46
|
-
status:
|
51
|
+
response:
|
52
|
+
status:
|
47
53
|
code: 200
|
48
54
|
message: OK
|
49
|
-
headers:
|
50
|
-
|
55
|
+
headers:
|
56
|
+
Access-Control-Allow-Headers:
|
51
57
|
- X-Requested-With, Content-Type, Accept, Content-Length
|
52
|
-
|
58
|
+
Access-Control-Allow-Methods:
|
53
59
|
- POST, GET, PUT, DELETE, OPTIONS
|
54
|
-
|
55
|
-
-
|
56
|
-
|
60
|
+
Access-Control-Allow-Origin:
|
61
|
+
- ! '*'
|
62
|
+
Content-Type:
|
57
63
|
- text/plain
|
58
|
-
|
59
|
-
-
|
60
|
-
|
64
|
+
Content-Length:
|
65
|
+
- '94'
|
66
|
+
Connection:
|
61
67
|
- keep-alive
|
62
|
-
body:
|
63
|
-
|
68
|
+
body:
|
69
|
+
encoding: UTF-8
|
70
|
+
string: ! '{"ok":"BORED_INSTANCE_FOUND","host":"jane.transloadit.com","api2_host":"jane.transloadit.com"}'
|
71
|
+
http_version: '1.1'
|
72
|
+
recorded_at: Fri, 08 Mar 2013 15:13:10 GMT
|
73
|
+
recorded_with: VCR 2.4.0
|
@@ -1,36 +1,45 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: http://api2.transloadit.com
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api2.transloadit.com/assemblies
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: params=%7B%22auth%22%3A%7B%22key%22%3A%22%22%2C%22expires%22%3A%222011%2F02%2F21%2023%3A15%3A43%2B00%3A00%22%7D%2C%22steps%22%3A%7B%22encode%22%3A%7B%22robot%22%3A%22%2Fvideo%2Fencode%22%7D%7D%7D&signature=d1a856e3d04103da448a512070139d3e721594cc
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
11
13
|
- gzip, deflate
|
12
|
-
|
14
|
+
User-Agent:
|
13
15
|
- Transloadit Ruby SDK 0.1.2
|
14
|
-
|
15
|
-
-
|
16
|
-
|
16
|
+
Content-Length:
|
17
|
+
- '278'
|
18
|
+
Content-Type:
|
17
19
|
- application/x-www-form-urlencoded
|
18
|
-
response:
|
19
|
-
status:
|
20
|
+
response:
|
21
|
+
status:
|
20
22
|
code: 200
|
21
23
|
message: OK
|
22
|
-
headers:
|
23
|
-
|
24
|
+
headers:
|
25
|
+
Access-Control-Allow-Headers:
|
24
26
|
- X-Requested-With, Content-Type, Accept, Content-Length
|
25
|
-
|
27
|
+
Access-Control-Allow-Methods:
|
26
28
|
- POST, GET, PUT, DELETE, OPTIONS
|
27
|
-
|
28
|
-
-
|
29
|
-
|
29
|
+
Access-Control-Allow-Origin:
|
30
|
+
- ! '*'
|
31
|
+
Content-Type:
|
30
32
|
- text/plain
|
31
|
-
|
32
|
-
-
|
33
|
-
|
33
|
+
Content-Length:
|
34
|
+
- '482'
|
35
|
+
Connection:
|
34
36
|
- keep-alive
|
35
|
-
body:
|
36
|
-
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: ! '{"ok":"ASSEMBLY_COMPLETED","message":"The assembly was successfully
|
40
|
+
completed.","assembly_id":"2a4cb778995be35ffe5fcda3c01e4267","assembly_url":"http://api2.jane.transloadit.com/assemblies/2a4cb778995be35ffe5fcda3c01e4267","bytes_received":278,"bytes_expected":278,"client_agent":"Transloadit
|
41
|
+
Ruby SDK 0.1.2","client_ip":"74.95.29.209","client_referer":null,"start_date":"2011/02/21
|
42
|
+
23:15:33 GMT","upload_duration":0.094,"execution_duration":0,"fields":{},"uploads":[],"results":{}}'
|
43
|
+
http_version: '1.1'
|
44
|
+
recorded_at: Fri, 08 Mar 2013 15:13:10 GMT
|
45
|
+
recorded_with: VCR 2.4.0
|
@@ -1,67 +1,80 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: http://api2.transloadit.com
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://api2.transloadit.com/instances/bored
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
11
13
|
- gzip, deflate
|
12
|
-
|
14
|
+
User-Agent:
|
13
15
|
- Transloadit Ruby SDK 0.0.1
|
14
|
-
response:
|
15
|
-
status:
|
16
|
+
response:
|
17
|
+
status:
|
16
18
|
code: 200
|
17
19
|
message: OK
|
18
|
-
headers:
|
19
|
-
|
20
|
+
headers:
|
21
|
+
Access-Control-Allow-Headers:
|
20
22
|
- X-Requested-With, Content-Type, Accept, Content-Length
|
21
|
-
|
23
|
+
Access-Control-Allow-Methods:
|
22
24
|
- POST, GET, PUT, DELETE, OPTIONS
|
23
|
-
|
24
|
-
-
|
25
|
-
|
25
|
+
Access-Control-Allow-Origin:
|
26
|
+
- ! '*'
|
27
|
+
Content-Type:
|
26
28
|
- text/plain
|
27
|
-
|
28
|
-
-
|
29
|
-
|
29
|
+
Content-Length:
|
30
|
+
- '98'
|
31
|
+
Connection:
|
30
32
|
- keep-alive
|
31
|
-
body:
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
-
|
41
|
-
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: ! '{"ok":"BORED_INSTANCE_FOUND","host":"vivian.transloadit.com","api2_host":"vivian.transloadit.com"}'
|
36
|
+
http_version: '1.1'
|
37
|
+
recorded_at: Fri, 08 Mar 2013 15:13:10 GMT
|
38
|
+
- request:
|
39
|
+
method: post
|
40
|
+
uri: http://vivian.transloadit.com/assemblies
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: params=%7B%22steps%22%3A%7B%22a479db2c601661d8f914caf9cf258c0b%22%3A%7B%22robot%22%3A%22%2Fvideo%2Fthumbs%22%7D%7D%2C%22redirect_url%22%3A%22http%3A%2F%2Ffoo.bar%2F%22%2C%22auth%22%3A%7B%22key%22%3A%22%22%7D%2C%22file_0%22%3A%22%23%3CFile%3A0x00000100c63738%3E%22%7D
|
44
|
+
headers:
|
45
|
+
Accept:
|
46
|
+
- ! '*/*; q=0.5, application/xml'
|
47
|
+
Accept-Encoding:
|
42
48
|
- gzip, deflate
|
43
|
-
|
49
|
+
User-Agent:
|
44
50
|
- Transloadit Ruby SDK 0.0.1
|
45
|
-
|
46
|
-
-
|
47
|
-
|
51
|
+
Content-Length:
|
52
|
+
- '298'
|
53
|
+
Content-Type:
|
48
54
|
- application/x-www-form-urlencoded
|
49
|
-
response:
|
50
|
-
status:
|
55
|
+
response:
|
56
|
+
status:
|
51
57
|
code: 302
|
52
58
|
message: Moved Temporarily
|
53
|
-
headers:
|
54
|
-
|
59
|
+
headers:
|
60
|
+
Content-Type:
|
55
61
|
- text/plain
|
56
|
-
|
57
|
-
-
|
58
|
-
|
62
|
+
Access-Control-Allow-Origin:
|
63
|
+
- ! '*'
|
64
|
+
Access-Control-Allow-Methods:
|
59
65
|
- POST, GET, PUT, DELETE, OPTIONS
|
60
|
-
|
66
|
+
Access-Control-Allow-Headers:
|
61
67
|
- X-Requested-With, Content-Type, Accept, Content-Length
|
62
|
-
|
68
|
+
Location:
|
63
69
|
- http://foo.bar/?assembly_id=177c56e5435176f4877fbc1b397fa4f0&assembly_url=http://api2.vivian.transloadit.com/assemblies/177c56e5435176f4877fbc1b397fa4f0
|
64
|
-
|
70
|
+
Transfer-Encoding:
|
65
71
|
- chunked
|
66
|
-
body:
|
67
|
-
|
72
|
+
body:
|
73
|
+
encoding: UTF-8
|
74
|
+
string: ! '{"ok":"ASSEMBLY_COMPLETED","message":"The assembly was successfully
|
75
|
+
completed.","assembly_id":"177c56e5435176f4877fbc1b397fa4f0","assembly_url":"http://api2.vivian.transloadit.com/assemblies/177c56e5435176f4877fbc1b397fa4f0","bytes_received":298,"bytes_expected":298,"client_agent":"Transloadit
|
76
|
+
Ruby SDK 0.0.1","client_ip":"69.180.12.41","client_referer":null,"start_date":"2011/02/07
|
77
|
+
04:29:15 GMT","upload_duration":0.038,"execution_duration":0.002,"fields":{},"uploads":[],"results":{}}'
|
78
|
+
http_version: '1.1'
|
79
|
+
recorded_at: Fri, 08 Mar 2013 15:13:10 GMT
|
80
|
+
recorded_with: VCR 2.4.0
|
data/test/test_helper.rb
CHANGED
@@ -9,8 +9,8 @@ require 'minitest/autorun'
|
|
9
9
|
require 'transloadit'
|
10
10
|
require 'vcr'
|
11
11
|
|
12
|
-
VCR.
|
12
|
+
VCR.configure do |c|
|
13
13
|
c.cassette_library_dir = 'test/fixtures/cassettes'
|
14
14
|
c.default_cassette_options = { :record => :none }
|
15
|
-
c.
|
15
|
+
c.hook_into :webmock
|
16
16
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
3
|
describe Transloadit do
|
4
4
|
before do
|
@@ -95,7 +95,7 @@ describe Transloadit do
|
|
95
95
|
end
|
96
96
|
|
97
97
|
it 'must produce Transloadit-compatible JSON output' do
|
98
|
-
@transloadit.to_json.must_equal @transloadit.to_hash
|
98
|
+
@transloadit.to_json.must_equal MultiJson.dump(@transloadit.to_hash)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
@@ -109,7 +109,7 @@ describe Transloadit do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
it 'must not include a secret in its JSON output' do
|
112
|
-
@transloadit.to_json.must_equal @transloadit.to_hash
|
112
|
+
@transloadit.to_json.must_equal MultiJson.dump(@transloadit.to_hash)
|
113
113
|
end
|
114
114
|
end
|
115
115
|
end
|
@@ -58,7 +58,7 @@ describe Transloadit::Assembly do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
it 'must produce Transloadit-compatible JSON output' do
|
61
|
-
@assembly.to_json.must_equal @assembly.to_hash
|
61
|
+
@assembly.to_json.must_equal MultiJson.dump(@assembly.to_hash)
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'must submit files for upload' do
|
@@ -89,7 +89,7 @@ describe Transloadit::Assembly do
|
|
89
89
|
|
90
90
|
assert_requested(:post, 'jane.transloadit.com/assemblies') do |req|
|
91
91
|
values = values_from_post_body(req.body)
|
92
|
-
|
92
|
+
MultiJson.load(values['params'])['template_id'].must_equal 'TEMPLATE_ID'
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
@@ -104,7 +104,7 @@ describe Transloadit::Assembly do
|
|
104
104
|
assert_requested(:post, 'jane.transloadit.com/assemblies') do |req|
|
105
105
|
values = values_from_post_body(req.body)
|
106
106
|
values['tag'].must_equal 'ninja-cat'
|
107
|
-
|
107
|
+
MultiJson.load(values['params'])['fields'].must_be_nil
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
@@ -53,7 +53,7 @@ describe Transloadit::Response do
|
|
53
53
|
|
54
54
|
# TODO: can this be tested better?
|
55
55
|
it 'must allow reloading the assembly' do
|
56
|
-
VCR.use_cassette 'fetch_assembly' do
|
56
|
+
VCR.use_cassette 'fetch_assembly', :allow_playback_repeats => true do
|
57
57
|
@response.send(:__getobj__).
|
58
58
|
wont_be_same_as @response.reload!.send(:__getobj__)
|
59
59
|
|
data/transloadit.gemspec
CHANGED
@@ -22,15 +22,15 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.require_paths = %w{ lib }
|
23
23
|
|
24
24
|
gem.add_dependency 'rest-client'
|
25
|
-
gem.add_dependency '
|
25
|
+
gem.add_dependency 'multi_json'
|
26
26
|
|
27
27
|
gem.add_development_dependency 'rake'
|
28
28
|
gem.add_development_dependency 'minitest' # needed for < 1.9.2
|
29
29
|
gem.add_development_dependency 'simplecov'
|
30
30
|
|
31
|
-
gem.add_development_dependency 'vcr'
|
31
|
+
gem.add_development_dependency 'vcr'
|
32
32
|
gem.add_development_dependency 'webmock'
|
33
33
|
|
34
34
|
gem.add_development_dependency 'yard'
|
35
|
-
gem.add_development_dependency '
|
35
|
+
gem.add_development_dependency 'kramdown' # for YARD rdoc formatting
|
36
36
|
end
|
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.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-03-
|
13
|
+
date: 2013-03-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '0'
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
name:
|
32
|
+
name: multi_json
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
none: false
|
35
35
|
requirements:
|
@@ -97,17 +97,17 @@ dependencies:
|
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
98
98
|
none: false
|
99
99
|
requirements:
|
100
|
-
- - '
|
100
|
+
- - ! '>='
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: '0'
|
103
103
|
type: :development
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
|
-
- - '
|
108
|
+
- - ! '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: webmock
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,7 +141,7 @@ dependencies:
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
- !ruby/object:Gem::Dependency
|
144
|
-
name:
|
144
|
+
name: kramdown
|
145
145
|
requirement: !ruby/object:Gem::Requirement
|
146
146
|
none: false
|
147
147
|
requirements:
|
@@ -166,6 +166,7 @@ extensions: []
|
|
166
166
|
extra_rdoc_files: []
|
167
167
|
files:
|
168
168
|
- .gitignore
|
169
|
+
- .travis.yml
|
169
170
|
- CHANGELOG.md
|
170
171
|
- Gemfile
|
171
172
|
- README.md
|