transloadit 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - ree
4
+ - 1.8.7
5
+ - 1.9.2
6
+ - 1.9.3
7
+ - 2.0.0
8
+ - rbx-18mode
9
+ - rbx-19mode
10
+ - jruby-18mode
11
+ - jruby-19mode
12
+ script: "bundle exec rake test"
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ### 1.0.3 / 2013-03-06 ###
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.8.7, 1.8.6, and Rubinius
194
- 1.2.0. If it doesn't, please file a [bug report](https://github.com/transloadit/ruby-sdk/issues).
195
- Compatibility patches for other Rubies are welcomed.
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
- You can run `rake test:multiruby` to test transloadit against all supported
198
- Rubies. Run `rake test:multiruby:setup` once beforehand, though, to set up the
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 'json'
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.to_json
99
+ MultiJson.dump(self.to_hash)
100
100
  end
101
101
 
102
102
  private
@@ -89,7 +89,7 @@ class Transloadit::Assembly
89
89
  # @return [String] JSON-encoded String containing the Assembly's contents
90
90
  #
91
91
  def to_json
92
- self.to_hash.to_json
92
+ MultiJson.dump(self.to_hash)
93
93
  end
94
94
 
95
95
  protected
@@ -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].to_json
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.to_json, escape),
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
@@ -31,7 +31,7 @@ class Transloadit::Response < Delegator
31
31
  # @return [Hash] the parsed JSON body hash
32
32
  #
33
33
  def body
34
- JSON.parse self.__getobj__.body
34
+ MultiJson.load self.__getobj__.body
35
35
  end
36
36
 
37
37
  #
@@ -76,7 +76,7 @@ class Transloadit::Step
76
76
  # @return [String] JSON-encoded String containing the Step's hash contents
77
77
  #
78
78
  def to_json
79
- self.to_hash.to_json
79
+ MultiJson.dump(self.to_hash)
80
80
  end
81
81
 
82
82
  protected
@@ -1,4 +1,4 @@
1
1
  class Transloadit
2
2
  # The current version of Transloadit.
3
- VERSION = '1.0.4'
3
+ VERSION = '1.0.5'
4
4
  end
@@ -1,30 +1,40 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :delete
5
- uri: http://api2.jane.transloadit.com:80/assemblies/76fe5df1c93a0a530f3e583805cf98b4
6
- body:
7
- headers:
8
- accept:
9
- - "*/*; q=0.5, application/xml"
10
- accept-encoding:
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
- user-agent:
14
+ User-Agent:
13
15
  - Transloadit Ruby SDK 0.1.2
14
- response: !ruby/struct:VCR::Response
15
- status: !ruby/struct:VCR::ResponseStatus
16
+ response:
17
+ status:
16
18
  code: 200
17
19
  message: OK
18
- headers:
19
- content-type:
20
+ headers:
21
+ Content-Type:
20
22
  - text/plain
21
- access-control-allow-origin:
22
- - "*"
23
- access-control-allow-methods:
23
+ Access-Control-Allow-Origin:
24
+ - ! '*'
25
+ Access-Control-Allow-Methods:
24
26
  - POST, GET, PUT, DELETE, OPTIONS
25
- access-control-allow-headers:
27
+ Access-Control-Allow-Headers:
26
28
  - X-Requested-With, Content-Type, Accept, Content-Length
27
- transfer-encoding:
29
+ Transfer-Encoding:
28
30
  - chunked
29
- body: "{\"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 Ruby SDK 0.1.2\",\"client_ip\":\"74.95.29.209\",\"client_referer\":null,\"start_date\":\"2011/02/21 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 15:54:17 GMT\",\"title\":null,\"description\":null,\"location\":null,\"city\":null,\"state\":null,\"country\":null,\"country_code\":null,\"keywords\":\"Photo 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\":{}}"
30
- http_version: "1.1"
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
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :get
5
- uri: http://api2.jane.transloadit.com:80/assemblies/76fe5df1c93a0a530f3e583805cf98b4
6
- body:
7
- headers:
8
- accept:
9
- - "*/*; q=0.5, application/xml"
10
- accept-encoding:
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: !ruby/struct:VCR::Response
13
- status: !ruby/struct:VCR::ResponseStatus
14
+ response:
15
+ status:
14
16
  code: 200
15
17
  message: OK
16
- headers:
17
- content-type:
18
+ headers:
19
+ Content-Type:
18
20
  - text/plain
19
- access-control-allow-origin:
20
- - "*"
21
- access-control-allow-methods:
21
+ Access-Control-Allow-Origin:
22
+ - ! '*'
23
+ Access-Control-Allow-Methods:
22
24
  - POST, GET, PUT, DELETE, OPTIONS
23
- access-control-allow-headers:
25
+ Access-Control-Allow-Headers:
24
26
  - X-Requested-With, Content-Type, Accept, Content-Length
25
- transfer-encoding:
27
+ Transfer-Encoding:
26
28
  - chunked
27
- body: "{\"ok\":\"ASSEMBLY_COMPLETED\",\"message\":\"The assembly was successfully completed.\",\"assembly_id\":\"76fe5df1c93a0a530f3e583805cf98b4\",\"assembly_url\":\"http://api2.jane.transloadit.com/assemblies/76fe5df1c93a0a530f3e583805cf98b4\",\"bytes_received\":95355,\"bytes_expected\":95355,\"client_agent\":\"Transloadit Ruby SDK 0.1.2\",\"client_ip\":\"74.95.29.209\",\"client_referer\":null,\"start_date\":\"2011/02/21 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 15:54:17 GMT\",\"title\":null,\"description\":null,\"location\":null,\"city\":null,\"state\":null,\"country\":null,\"country_code\":null,\"keywords\":\"Photo 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\":{}}"
28
- http_version: "1.1"
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
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :get
5
- uri: http://api2.transloadit.com:80/instances/bored
6
- body:
7
- headers:
8
- accept:
9
- - "*/*; q=0.5, application/xml"
10
- accept-encoding:
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
- user-agent:
14
+ User-Agent:
13
15
  - Transloadit Ruby SDK 0.1.2
14
- response: !ruby/struct:VCR::Response
15
- status: !ruby/struct:VCR::ResponseStatus
16
+ response:
17
+ status:
16
18
  code: 200
17
19
  message: OK
18
- headers:
19
- access-control-allow-headers:
20
+ headers:
21
+ Access-Control-Allow-Headers:
20
22
  - X-Requested-With, Content-Type, Accept, Content-Length
21
- access-control-allow-methods:
23
+ Access-Control-Allow-Methods:
22
24
  - POST, GET, PUT, DELETE, OPTIONS
23
- access-control-allow-origin:
24
- - "*"
25
- content-type:
25
+ Access-Control-Allow-Origin:
26
+ - ! '*'
27
+ Content-Type:
26
28
  - text/plain
27
- content-length:
28
- - "94"
29
- connection:
29
+ Content-Length:
30
+ - '94'
31
+ Connection:
30
32
  - keep-alive
31
- body: "{\"ok\":\"BORED_INSTANCE_FOUND\",\"host\":\"jane.transloadit.com\",\"api2_host\":\"jane.transloadit.com\"}"
32
- http_version: "1.1"
33
- - !ruby/struct:VCR::HTTPInteraction
34
- request: !ruby/struct:VCR::Request
35
- method: :get
36
- uri: http://api2.transloadit.com:80/instances/bored?params=%7B%22params%22:%7B%22foo%22:%22bar%22%7D%7D
37
- body:
38
- headers:
39
- accept:
40
- - "*/*; q=0.5, application/xml"
41
- accept-encoding:
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
- user-agent:
49
+ User-Agent:
44
50
  - Transloadit Ruby SDK 0.1.2
45
- response: !ruby/struct:VCR::Response
46
- status: !ruby/struct:VCR::ResponseStatus
51
+ response:
52
+ status:
47
53
  code: 200
48
54
  message: OK
49
- headers:
50
- access-control-allow-headers:
55
+ headers:
56
+ Access-Control-Allow-Headers:
51
57
  - X-Requested-With, Content-Type, Accept, Content-Length
52
- access-control-allow-methods:
58
+ Access-Control-Allow-Methods:
53
59
  - POST, GET, PUT, DELETE, OPTIONS
54
- access-control-allow-origin:
55
- - "*"
56
- content-type:
60
+ Access-Control-Allow-Origin:
61
+ - ! '*'
62
+ Content-Type:
57
63
  - text/plain
58
- content-length:
59
- - "94"
60
- connection:
64
+ Content-Length:
65
+ - '94'
66
+ Connection:
61
67
  - keep-alive
62
- body: "{\"ok\":\"BORED_INSTANCE_FOUND\",\"host\":\"jane.transloadit.com\",\"api2_host\":\"jane.transloadit.com\"}"
63
- http_version: "1.1"
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
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :post
5
- uri: http://api2.transloadit.com:80/assemblies
6
- body: 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
7
- headers:
8
- accept:
9
- - "*/*; q=0.5, application/xml"
10
- accept-encoding:
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
- user-agent:
14
+ User-Agent:
13
15
  - Transloadit Ruby SDK 0.1.2
14
- content-length:
15
- - "278"
16
- content-type:
16
+ Content-Length:
17
+ - '278'
18
+ Content-Type:
17
19
  - application/x-www-form-urlencoded
18
- response: !ruby/struct:VCR::Response
19
- status: !ruby/struct:VCR::ResponseStatus
20
+ response:
21
+ status:
20
22
  code: 200
21
23
  message: OK
22
- headers:
23
- access-control-allow-headers:
24
+ headers:
25
+ Access-Control-Allow-Headers:
24
26
  - X-Requested-With, Content-Type, Accept, Content-Length
25
- access-control-allow-methods:
27
+ Access-Control-Allow-Methods:
26
28
  - POST, GET, PUT, DELETE, OPTIONS
27
- access-control-allow-origin:
28
- - "*"
29
- content-type:
29
+ Access-Control-Allow-Origin:
30
+ - ! '*'
31
+ Content-Type:
30
32
  - text/plain
31
- content-length:
32
- - "482"
33
- connection:
33
+ Content-Length:
34
+ - '482'
35
+ Connection:
34
36
  - keep-alive
35
- body: "{\"ok\":\"ASSEMBLY_COMPLETED\",\"message\":\"The assembly was successfully completed.\",\"assembly_id\":\"2a4cb778995be35ffe5fcda3c01e4267\",\"assembly_url\":\"http://api2.jane.transloadit.com/assemblies/2a4cb778995be35ffe5fcda3c01e4267\",\"bytes_received\":278,\"bytes_expected\":278,\"client_agent\":\"Transloadit Ruby SDK 0.1.2\",\"client_ip\":\"74.95.29.209\",\"client_referer\":null,\"start_date\":\"2011/02/21 23:15:33 GMT\",\"upload_duration\":0.094,\"execution_duration\":0,\"fields\":{},\"uploads\":[],\"results\":{}}"
36
- http_version: "1.1"
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
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :get
5
- uri: http://api2.transloadit.com:80/instances/bored
6
- body:
7
- headers:
8
- accept:
9
- - "*/*; q=0.5, application/xml"
10
- accept-encoding:
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
- user-agent:
14
+ User-Agent:
13
15
  - Transloadit Ruby SDK 0.0.1
14
- response: !ruby/struct:VCR::Response
15
- status: !ruby/struct:VCR::ResponseStatus
16
+ response:
17
+ status:
16
18
  code: 200
17
19
  message: OK
18
- headers:
19
- access-control-allow-headers:
20
+ headers:
21
+ Access-Control-Allow-Headers:
20
22
  - X-Requested-With, Content-Type, Accept, Content-Length
21
- access-control-allow-methods:
23
+ Access-Control-Allow-Methods:
22
24
  - POST, GET, PUT, DELETE, OPTIONS
23
- access-control-allow-origin:
24
- - "*"
25
- content-type:
25
+ Access-Control-Allow-Origin:
26
+ - ! '*'
27
+ Content-Type:
26
28
  - text/plain
27
- content-length:
28
- - "98"
29
- connection:
29
+ Content-Length:
30
+ - '98'
31
+ Connection:
30
32
  - keep-alive
31
- body: "{\"ok\":\"BORED_INSTANCE_FOUND\",\"host\":\"vivian.transloadit.com\",\"api2_host\":\"vivian.transloadit.com\"}"
32
- http_version: "1.1"
33
- - !ruby/struct:VCR::HTTPInteraction
34
- request: !ruby/struct:VCR::Request
35
- method: :post
36
- uri: http://vivian.transloadit.com:80/assemblies
37
- body: 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
38
- headers:
39
- accept:
40
- - "*/*; q=0.5, application/xml"
41
- accept-encoding:
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
- user-agent:
49
+ User-Agent:
44
50
  - Transloadit Ruby SDK 0.0.1
45
- content-length:
46
- - "298"
47
- content-type:
51
+ Content-Length:
52
+ - '298'
53
+ Content-Type:
48
54
  - application/x-www-form-urlencoded
49
- response: !ruby/struct:VCR::Response
50
- status: !ruby/struct:VCR::ResponseStatus
55
+ response:
56
+ status:
51
57
  code: 302
52
58
  message: Moved Temporarily
53
- headers:
54
- content-type:
59
+ headers:
60
+ Content-Type:
55
61
  - text/plain
56
- access-control-allow-origin:
57
- - "*"
58
- access-control-allow-methods:
62
+ Access-Control-Allow-Origin:
63
+ - ! '*'
64
+ Access-Control-Allow-Methods:
59
65
  - POST, GET, PUT, DELETE, OPTIONS
60
- access-control-allow-headers:
66
+ Access-Control-Allow-Headers:
61
67
  - X-Requested-With, Content-Type, Accept, Content-Length
62
- location:
68
+ Location:
63
69
  - http://foo.bar/?assembly_id=177c56e5435176f4877fbc1b397fa4f0&assembly_url=http://api2.vivian.transloadit.com/assemblies/177c56e5435176f4877fbc1b397fa4f0
64
- transfer-encoding:
70
+ Transfer-Encoding:
65
71
  - chunked
66
- body: "{\"ok\":\"ASSEMBLY_COMPLETED\",\"message\":\"The assembly was successfully completed.\",\"assembly_id\":\"177c56e5435176f4877fbc1b397fa4f0\",\"assembly_url\":\"http://api2.vivian.transloadit.com/assemblies/177c56e5435176f4877fbc1b397fa4f0\",\"bytes_received\":298,\"bytes_expected\":298,\"client_agent\":\"Transloadit Ruby SDK 0.0.1\",\"client_ip\":\"69.180.12.41\",\"client_referer\":null,\"start_date\":\"2011/02/07 04:29:15 GMT\",\"upload_duration\":0.038,\"execution_duration\":0.002,\"fields\":{},\"uploads\":[],\"results\":{}}"
67
- http_version: "1.1"
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.config do |c|
12
+ VCR.configure do |c|
13
13
  c.cassette_library_dir = 'test/fixtures/cassettes'
14
14
  c.default_cassette_options = { :record => :none }
15
- c.stub_with :webmock
15
+ c.hook_into :webmock
16
16
  end
@@ -1,4 +1,4 @@
1
- require_relative '../test_helper'
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.to_json
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.to_json
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.to_json
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
- JSON.parse(values['params'])['template_id'].must_equal 'TEMPLATE_ID'
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
- JSON.parse(values['params'])['fields'].must_be_nil
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
 
@@ -52,7 +52,7 @@ describe Transloadit::Step do
52
52
  end
53
53
 
54
54
  it 'must produce Transloadit-compatible JSON output' do
55
- @step.to_json.must_equal @step.to_hash.to_json
55
+ @step.to_json.must_equal MultiJson.dump(@step.to_hash)
56
56
  end
57
57
  end
58
58
 
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 'json'
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', '1.11.3'
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 'rdiscount' # for YARD rdoc formatting
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
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-06 00:00:00.000000000 Z
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: json
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: 1.11.3
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: 1.11.3
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: rdiscount
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