transloadit 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +23 -0
  3. data/.standard.yml +0 -0
  4. data/CHANGELOG.md +70 -55
  5. data/Gemfile +1 -1
  6. data/README.md +162 -86
  7. data/Rakefile +12 -17
  8. data/examples/README.md +94 -55
  9. data/examples/basic/audio-concat-transcoder.rb +29 -19
  10. data/examples/basic/audio-transcoder.rb +32 -22
  11. data/examples/basic/image-transcoder.rb +22 -17
  12. data/examples/basic/main.rb +31 -37
  13. data/examples/basic/media-transcoder.rb +2 -7
  14. data/lib/transloadit/api_model.rb +13 -13
  15. data/lib/transloadit/assembly.rb +27 -24
  16. data/lib/transloadit/exception.rb +2 -4
  17. data/lib/transloadit/request.rb +58 -52
  18. data/lib/transloadit/response/assembly.rb +14 -13
  19. data/lib/transloadit/response.rb +10 -10
  20. data/lib/transloadit/step.rb +13 -13
  21. data/lib/transloadit/template.rb +5 -5
  22. data/lib/transloadit/version.rb +1 -1
  23. data/lib/transloadit.rb +24 -24
  24. data/test/fixtures/cassettes/cancel_assembly.yml +3 -3
  25. data/test/fixtures/cassettes/create_template.yml +1 -1
  26. data/test/fixtures/cassettes/delete_template.yml +1 -1
  27. data/test/fixtures/cassettes/fetch_assemblies.yml +1 -1
  28. data/test/fixtures/cassettes/fetch_assembly_aborted.yml +3 -3
  29. data/test/fixtures/cassettes/fetch_assembly_errors.yml +3 -3
  30. data/test/fixtures/cassettes/fetch_assembly_executing.yml +3 -3
  31. data/test/fixtures/cassettes/fetch_assembly_notifications.yml +1 -1
  32. data/test/fixtures/cassettes/fetch_assembly_ok.yml +6 -6
  33. data/test/fixtures/cassettes/fetch_assembly_uploading.yml +3 -3
  34. data/test/fixtures/cassettes/fetch_billing.yml +1 -1
  35. data/test/fixtures/cassettes/fetch_root.yml +3 -3
  36. data/test/fixtures/cassettes/fetch_template.yml +1 -1
  37. data/test/fixtures/cassettes/fetch_templates.yml +1 -1
  38. data/test/fixtures/cassettes/post_assembly.yml +2 -2
  39. data/test/fixtures/cassettes/rate_limit_fail.yml +3 -3
  40. data/test/fixtures/cassettes/rate_limit_succeed.yml +4 -4
  41. data/test/fixtures/cassettes/replay_assembly.yml +2 -2
  42. data/test/fixtures/cassettes/replay_assembly_notification.yml +1 -1
  43. data/test/fixtures/cassettes/submit_assembly.yml +3 -3
  44. data/test/fixtures/cassettes/update_template.yml +1 -1
  45. data/test/test_helper.rb +10 -10
  46. data/test/unit/test_transloadit.rb +66 -66
  47. data/test/unit/transloadit/test_api.rb +35 -33
  48. data/test/unit/transloadit/test_assembly.rb +148 -112
  49. data/test/unit/transloadit/test_request.rb +41 -42
  50. data/test/unit/transloadit/test_response.rb +76 -76
  51. data/test/unit/transloadit/test_step.rb +52 -52
  52. data/test/unit/transloadit/test_template.rb +49 -54
  53. data/transloadit.gemspec +25 -26
  54. metadata +25 -41
  55. data/.travis.yml +0 -13
@@ -1,170 +1,170 @@
1
- require 'test_helper'
1
+ require "test_helper"
2
2
 
3
3
  describe Transloadit::Response do
4
- REQUEST_URI = 'http://api2.jane.transloadit.com/assemblies/76fe5df1c93a0a530f3e583805cf98b4'
4
+ request_uri = "https://api2.jane.transloadit.com/assemblies/76fe5df1c93a0a530f3e583805cf98b4"
5
5
 
6
- it 'must allow delegate initialization' do
7
- response = Transloadit::Response.new('test')
8
- response.class.must_equal Transloadit::Response
6
+ it "must allow delegate initialization" do
7
+ response = Transloadit::Response.new("test")
8
+ _(response.class).must_equal Transloadit::Response
9
9
  end
10
10
 
11
- describe 'when initialized' do
11
+ describe "when initialized" do
12
12
  before do
13
- VCR.use_cassette 'fetch_assembly_ok' do
13
+ VCR.use_cassette "fetch_assembly_ok" do
14
14
  @response = Transloadit::Response.new(
15
- RestClient::Resource.new(REQUEST_URI).get
15
+ RestClient::Resource.new(request_uri).get
16
16
  )
17
17
  end
18
18
  end
19
19
 
20
- it 'must parse the body' do
21
- @response.body.must_be_kind_of Hash
20
+ it "must parse the body" do
21
+ _(@response.body).must_be_kind_of Hash
22
22
  end
23
23
 
24
- it 'must allow access to body attributes' do
25
- %w{ ok message assembly_id assembly_url }.each do |attribute|
26
- @response[attribute].must_equal @response.body[attribute]
24
+ it "must allow access to body attributes" do
25
+ %w[ok message assembly_id assembly_ssl_url].each do |attribute|
26
+ _(@response[attribute]).must_equal @response.body[attribute]
27
27
  end
28
28
  end
29
29
 
30
- it 'must allow access to body attributes as symbols' do
31
- [:ok, :message, :assembly_id, :assembly_url].each do |attribute|
32
- @response[attribute].must_equal @response.body[attribute.to_s]
30
+ it "must allow access to body attributes as symbols" do
31
+ [:ok, :message, :assembly_id, :assembly_ssl_url].each do |attribute|
32
+ _(@response[attribute]).must_equal @response.body[attribute.to_s]
33
33
  end
34
34
  end
35
35
 
36
- it 'must inspect as the body' do
37
- @response.inspect.must_equal @response.body.inspect
36
+ it "must inspect as the body" do
37
+ _(@response.inspect).must_equal @response.body.inspect
38
38
  end
39
39
  end
40
40
 
41
- describe 'when extended as an assembly' do
41
+ describe "when extended as an assembly" do
42
42
  before do
43
- VCR.use_cassette 'fetch_assembly_ok' do
43
+ VCR.use_cassette "fetch_assembly_ok" do
44
44
  @response = Transloadit::Response.new(
45
- RestClient::Resource.new(REQUEST_URI).get
45
+ RestClient::Resource.new(request_uri).get
46
46
  ).extend!(Transloadit::Response::Assembly)
47
47
  end
48
48
  end
49
49
 
50
- it 'must allow checking for completion' do
51
- @response.completed?.must_equal true
52
- @response.finished?.must_equal true
53
- @response.error?.must_equal false
50
+ it "must allow checking for completion" do
51
+ _(@response.completed?).must_equal true
52
+ _(@response.finished?).must_equal true
53
+ _(@response.error?).must_equal false
54
54
  end
55
55
 
56
56
  # TODO: can this be tested better?
57
- it 'must allow reloading the assembly' do
58
- VCR.use_cassette 'fetch_assembly_ok', :allow_playback_repeats => true do
59
- @response.send(:__getobj__).
60
- wont_be_same_as @response.reload!.send(:__getobj__)
57
+ it "must allow reloading the assembly" do
58
+ VCR.use_cassette "fetch_assembly_ok", allow_playback_repeats: true do
59
+ _(@response.send(:__getobj__))
60
+ .wont_be_same_as @response.reload!.send(:__getobj__)
61
61
 
62
- @response.object_id.
63
- must_equal @response.reload!.object_id
62
+ _(@response.object_id)
63
+ .must_equal @response.reload!.object_id
64
64
  end
65
65
  end
66
66
 
67
- it 'must allow canceling' do
68
- VCR.use_cassette 'cancel_assembly' do
67
+ it "must allow canceling" do
68
+ VCR.use_cassette "cancel_assembly" do
69
69
  @response.cancel!
70
70
 
71
- @response.completed?.must_equal false
72
- @response['ok'] .must_equal 'ASSEMBLY_CANCELED'
73
- @response.canceled?.must_equal true
74
- @response.finished?.must_equal true
71
+ _(@response.completed?).must_equal false
72
+ _(@response["ok"]).must_equal "ASSEMBLY_CANCELED"
73
+ _(@response.canceled?).must_equal true
74
+ _(@response.finished?).must_equal true
75
75
  end
76
76
  end
77
77
  end
78
78
 
79
- describe 'long-running assembly' do
79
+ describe "long-running assembly" do
80
80
  before do
81
- VCR.use_cassette 'fetch_assembly_executing' do
81
+ VCR.use_cassette "fetch_assembly_executing" do
82
82
  @response = Transloadit::Response.new(
83
- RestClient::Resource.new(REQUEST_URI).get
83
+ RestClient::Resource.new(request_uri).get
84
84
  ).extend!(Transloadit::Response::Assembly)
85
85
  end
86
86
  end
87
87
 
88
- it 'must allow reloading until finished' do
89
- @response.finished?.must_equal false
88
+ it "must allow reloading until finished" do
89
+ _(@response.finished?).must_equal false
90
90
 
91
- VCR.use_cassette 'fetch_assembly_ok' do
92
- VCR.use_cassette 'fetch_assembly_executing' do
91
+ VCR.use_cassette "fetch_assembly_ok" do
92
+ VCR.use_cassette "fetch_assembly_executing" do
93
93
  @response.reload_until_finished!
94
94
  end
95
95
  end
96
96
 
97
- @response.finished?.must_equal true
97
+ _(@response.finished?).must_equal true
98
98
  end
99
99
 
100
- it 'must raise exception if reload until finished tries exceeded' do
100
+ it "must raise exception if reload until finished tries exceeded" do
101
101
  assert_raises Transloadit::Exception::ReloadLimitReached do
102
- VCR.use_cassette 'fetch_assembly_executing', :allow_playback_repeats => true do
102
+ VCR.use_cassette "fetch_assembly_executing", allow_playback_repeats: true do
103
103
  @response.reload_until_finished! tries: 1
104
104
  end
105
105
  end
106
106
  end
107
107
  end
108
108
 
109
- describe 'statuses' do
110
- it 'must allow checking for upload' do
111
- VCR.use_cassette 'fetch_assembly_uploading' do
109
+ describe "statuses" do
110
+ it "must allow checking for upload" do
111
+ VCR.use_cassette "fetch_assembly_uploading" do
112
112
  @response = Transloadit::Response.new(
113
- RestClient::Resource.new(REQUEST_URI).get
113
+ RestClient::Resource.new(request_uri).get
114
114
  ).extend!(Transloadit::Response::Assembly)
115
115
  end
116
116
 
117
- @response.finished?.must_equal false
118
- @response.uploading?.must_equal true
119
- @response.error?.must_equal false
117
+ _(@response.finished?).must_equal false
118
+ _(@response.uploading?).must_equal true
119
+ _(@response.error?).must_equal false
120
120
  end
121
121
 
122
- it 'must allow to check for executing' do
123
- VCR.use_cassette 'fetch_assembly_executing' do
122
+ it "must allow to check for executing" do
123
+ VCR.use_cassette "fetch_assembly_executing" do
124
124
  @response = Transloadit::Response.new(
125
- RestClient::Resource.new(REQUEST_URI).get
125
+ RestClient::Resource.new(request_uri).get
126
126
  ).extend!(Transloadit::Response::Assembly)
127
127
  end
128
128
 
129
- @response.finished?.must_equal false
130
- @response.executing?.must_equal true
131
- @response.error?.must_equal false
129
+ _(@response.finished?).must_equal false
130
+ _(@response.executing?).must_equal true
131
+ _(@response.error?).must_equal false
132
132
  end
133
133
 
134
- it 'must allow to check for replaying' do
135
- VCR.use_cassette 'replay_assembly' do
134
+ it "must allow to check for replaying" do
135
+ VCR.use_cassette "replay_assembly" do
136
136
  @response = Transloadit::Response.new(
137
137
  RestClient::Resource.new(
138
- 'http://api2.transloadit.com/assemblies/55c965a063a311e6ba2d379ef10b28f7/replay'
138
+ "https://api2.transloadit.com/assemblies/55c965a063a311e6ba2d379ef10b28f7/replay"
139
139
  ).post({})
140
140
  ).extend!(Transloadit::Response::Assembly)
141
141
  end
142
142
 
143
- @response.finished?.must_equal false
144
- @response.replaying?.must_equal true
145
- @response.error?.must_equal false
143
+ _(@response.finished?).must_equal false
144
+ _(@response.replaying?).must_equal true
145
+ _(@response.error?).must_equal false
146
146
  end
147
147
 
148
- it 'must allow to check for aborted' do
149
- VCR.use_cassette 'fetch_assembly_aborted' do
148
+ it "must allow to check for aborted" do
149
+ VCR.use_cassette "fetch_assembly_aborted" do
150
150
  @response = Transloadit::Response.new(
151
- RestClient::Resource.new(REQUEST_URI).get
151
+ RestClient::Resource.new(request_uri).get
152
152
  ).extend!(Transloadit::Response::Assembly)
153
153
  end
154
154
 
155
- @response.finished?.must_equal true
156
- @response.aborted?.must_equal true
155
+ _(@response.finished?).must_equal true
156
+ _(@response.aborted?).must_equal true
157
157
  end
158
158
 
159
- it 'must allow to check for errors' do
160
- VCR.use_cassette 'fetch_assembly_errors' do
159
+ it "must allow to check for errors" do
160
+ VCR.use_cassette "fetch_assembly_errors" do
161
161
  @response = Transloadit::Response.new(
162
- RestClient::Resource.new(REQUEST_URI).get
162
+ RestClient::Resource.new(request_uri).get
163
163
  ).extend!(Transloadit::Response::Assembly)
164
164
  end
165
165
 
166
- @response.error?.must_equal true
167
- @response.finished?.must_equal true
166
+ _(@response.error?).must_equal true
167
+ _(@response.finished?).must_equal true
168
168
  end
169
169
  end
170
170
  end
@@ -1,97 +1,97 @@
1
- require 'test_helper'
1
+ require "test_helper"
2
2
 
3
3
  describe Transloadit::Step do
4
- it 'must allow initialization' do
5
- Transloadit::Step.new('store', '/s3/store').
6
- must_be_kind_of Transloadit::Step
4
+ it "must allow initialization" do
5
+ _(Transloadit::Step.new("store", "/s3/store"))
6
+ .must_be_kind_of Transloadit::Step
7
7
  end
8
8
 
9
- describe 'when initialized' do
9
+ describe "when initialized" do
10
10
  before do
11
- @name = 'store'
12
- @robot = '/s3/store'
13
- @key = 'aws-access-key-id'
14
- @secret = 'aws-secret-access-key'
15
- @bucket = 's3-bucket-name'
11
+ @name = "store"
12
+ @robot = "/s3/store"
13
+ @key = "aws-access-key-id"
14
+ @secret = "aws-secret-access-key"
15
+ @bucket = "s3-bucket-name"
16
16
 
17
17
  @step = Transloadit::Step.new @name, @robot,
18
- :key => @key,
19
- :secret => @secret,
20
- :bucket => @bucket
18
+ key: @key,
19
+ secret: @secret,
20
+ bucket: @bucket
21
21
  end
22
22
 
23
- it 'should use the name given' do
24
- @step.name.must_equal @name
23
+ it "should use the name given" do
24
+ _(@step.name).must_equal @name
25
25
  end
26
26
 
27
- it 'must remember the type' do
28
- @step.robot.must_equal @robot
27
+ it "must remember the type" do
28
+ _(@step.robot).must_equal @robot
29
29
  end
30
30
 
31
- it 'must remember the parameters' do
32
- @step.options.must_equal(
33
- :key => @key,
34
- :secret => @secret,
35
- :bucket => @bucket
31
+ it "must remember the parameters" do
32
+ _(@step.options).must_equal(
33
+ key: @key,
34
+ secret: @secret,
35
+ bucket: @bucket
36
36
  )
37
37
  end
38
38
 
39
- it 'must inspect like a hash' do
40
- @step.inspect.must_equal @step.to_hash[@step.name].inspect
39
+ it "must inspect like a hash" do
40
+ _(@step.inspect).must_equal @step.to_hash[@step.name].inspect
41
41
  end
42
42
 
43
- it 'must produce Transloadit-compatible hash output' do
44
- @step.to_hash.must_equal(
43
+ it "must produce Transloadit-compatible hash output" do
44
+ _(@step.to_hash).must_equal(
45
45
  @step.name => {
46
- :robot => @robot,
47
- :key => @key,
48
- :secret => @secret,
49
- :bucket => @bucket
46
+ robot: @robot,
47
+ key: @key,
48
+ secret: @secret,
49
+ bucket: @bucket
50
50
  }
51
51
  )
52
52
  end
53
53
 
54
- it 'must produce Transloadit-compatible JSON output' do
55
- @step.to_json.must_equal MultiJson.dump(@step.to_hash)
54
+ it "must produce Transloadit-compatible JSON output" do
55
+ _(@step.to_json).must_equal MultiJson.dump(@step.to_hash)
56
56
  end
57
57
  end
58
58
 
59
- describe 'when using alternative inputs' do
59
+ describe "when using alternative inputs" do
60
60
  before do
61
- @step = Transloadit::Step.new 'resize', '/image/resize'
61
+ @step = Transloadit::Step.new "resize", "/image/resize"
62
62
  end
63
63
 
64
- it 'must allow using the original file as input' do
65
- @step.use(:original).must_equal ':original'
66
- @step.options[:use] .must_equal ':original'
64
+ it "must allow using the original file as input" do
65
+ _(@step.use(:original)).must_equal ":original"
66
+ _(@step.options[:use]).must_equal ":original"
67
67
  end
68
68
 
69
- it 'must allow using another step' do
70
- input = Transloadit::Step.new 'thumbnail', '/video/thumbnail'
69
+ it "must allow using another step" do
70
+ input = Transloadit::Step.new "thumbnail", "/video/thumbnail"
71
71
 
72
- @step.use(input). must_equal [ input.name ]
73
- @step.options[:use].must_equal [ input.name ]
72
+ _(@step.use(input)).must_equal [input.name]
73
+ _(@step.options[:use]).must_equal [input.name]
74
74
  end
75
75
 
76
- it 'must allow using multiple steps' do
76
+ it "must allow using multiple steps" do
77
77
  inputs = [
78
- Transloadit::Step.new('thumbnail', '/video/thumbnail'),
79
- Transloadit::Step.new('resize', '/image/resize')
78
+ Transloadit::Step.new("thumbnail", "/video/thumbnail"),
79
+ Transloadit::Step.new("resize", "/image/resize")
80
80
  ]
81
81
 
82
- @step.use(inputs). must_equal inputs.map {|i| i.name }
83
- @step.options[:use].must_equal inputs.map {|i| i.name }
82
+ _(@step.use(inputs)).must_equal(inputs.map { |i| i.name })
83
+ _(@step.options[:use]).must_equal(inputs.map { |i| i.name })
84
84
  end
85
85
 
86
- it 'must allow using nothing' do
86
+ it "must allow using nothing" do
87
87
  @step.use :original
88
- @step.use(nil).must_equal nil
89
- @step.options.keys.wont_include(:use)
88
+ assert_nil @step.use(nil)
89
+ _(@step.options.keys).wont_include(:use)
90
90
  end
91
91
 
92
- it 'must include the used steps in the hash output' do
93
- @step.use(:original). must_equal ':original'
94
- @step.to_hash[@step.name][:use].must_equal ':original'
92
+ it "must include the used steps in the hash output" do
93
+ _(@step.use(:original)).must_equal ":original"
94
+ _(@step.to_hash[@step.name][:use]).must_equal ":original"
95
95
  end
96
96
  end
97
97
  end
@@ -1,116 +1,111 @@
1
- require 'test_helper'
1
+ require "test_helper"
2
2
 
3
3
  describe Transloadit::Template do
4
-
5
- it 'must inherit from Transloadit::ApiModel class' do
6
- (Transloadit::Template < Transloadit::ApiModel).must_equal true
4
+ it "must inherit from Transloadit::ApiModel class" do
5
+ _(Transloadit::Template < Transloadit::ApiModel).must_equal true
7
6
  end
8
7
 
9
- describe 'using template API methods' do
8
+ describe "using template API methods" do
10
9
  include WebMock::API
11
10
 
12
11
  before do
13
12
  WebMock.reset!
14
- @transloadit = Transloadit.new(:key => '')
13
+ @transloadit = Transloadit.new(key: "")
15
14
  @template = Transloadit::Template.new @transloadit
16
15
  end
17
16
 
18
- it 'must allow to create new template' do
19
- VCR.use_cassette 'create_template' do
17
+ it "must allow to create new template" do
18
+ VCR.use_cassette "create_template" do
20
19
  response = @template.create(
21
20
  {
22
- :name => 'foo',
23
- :template => {'key' => 'value'}
21
+ name: "foo",
22
+ template: {"key" => "value"}
24
23
  }
25
24
  )
26
- response['ok'].must_equal 'TEMPLATE_CREATED'
27
- response['template_name'].must_equal 'foo'
28
- response['template_content']['key'].must_equal 'value'
25
+ _(response["ok"]).must_equal "TEMPLATE_CREATED"
26
+ _(response["template_name"]).must_equal "foo"
27
+ _(response["template_content"]["key"]).must_equal "value"
29
28
  end
30
29
  end
31
30
 
32
- describe 'when fetching all templates' do
33
-
34
- it 'must perform GET request to /templates' do
35
- stub = stub_request(:get, 'api2.transloadit.com/templates?params=%7B%22auth%22:%7B%22key%22:%22%22%7D%7D')
31
+ describe "when fetching all templates" do
32
+ it "must perform GET request to /templates" do
33
+ stub = stub_request(:get, "https://api2.transloadit.com/templates?params=%7B%22auth%22:%7B%22key%22:%22%22%7D%7D")
36
34
  @template.list
37
35
 
38
36
  assert_requested(stub)
39
37
  end
40
38
 
41
- it 'must return a list of items' do
42
- VCR.use_cassette 'fetch_templates' do
39
+ it "must return a list of items" do
40
+ VCR.use_cassette "fetch_templates" do
43
41
  response = @template.list
44
42
 
45
- response['items'].must_equal []
46
- response['count'].must_equal 0
43
+ _(response["items"]).must_equal []
44
+ _(response["count"]).must_equal 0
47
45
  end
48
46
  end
49
47
  end
50
48
 
51
- describe 'when fetching single template' do
52
-
53
- it 'must perform GET request to /templates/[id]' do
49
+ describe "when fetching single template" do
50
+ it "must perform GET request to /templates/[id]" do
54
51
  stub = stub_request(
55
52
  :get,
56
- 'api2.transloadit.com/templates/76fe5df1c93a0a530f3e583805cf98b4?params=%7B%22auth%22:%7B%22key%22:%22%22%7D%7D'
53
+ "https://api2.transloadit.com/templates/76fe5df1c93a0a530f3e583805cf98b4?params=%7B%22auth%22:%7B%22key%22:%22%22%7D%7D"
57
54
  )
58
- @template.get '76fe5df1c93a0a530f3e583805cf98b4'
55
+ @template.get "76fe5df1c93a0a530f3e583805cf98b4"
59
56
 
60
57
  assert_requested(stub)
61
58
  end
62
59
 
63
- it 'must get template with specified id' do
64
- VCR.use_cassette 'fetch_template' do
65
- response = @template.get '76fe5df1c93a0a530f3e583805cf98b4'
66
- response['ok'].must_equal 'TEMPLATE_FOUND'
67
- response['template_id'].must_equal '76fe5df1c93a0a530f3e583805cf98b4'
60
+ it "must get template with specified id" do
61
+ VCR.use_cassette "fetch_template" do
62
+ response = @template.get "76fe5df1c93a0a530f3e583805cf98b4"
63
+ _(response["ok"]).must_equal "TEMPLATE_FOUND"
64
+ _(response["template_id"]).must_equal "76fe5df1c93a0a530f3e583805cf98b4"
68
65
  end
69
66
  end
70
67
  end
71
68
 
72
- describe 'when updating template' do
73
-
74
- it 'must perform PUT request to templates/[id]' do
75
- url = 'api2.transloadit.com/templates/76fe5df1c93a0a530f3e583805cf98b4'
69
+ describe "when updating template" do
70
+ it "must perform PUT request to templates/[id]" do
71
+ url = "https://api2.transloadit.com/templates/76fe5df1c93a0a530f3e583805cf98b4"
76
72
  stub_request(:put, url)
77
73
  @template.update(
78
- '76fe5df1c93a0a530f3e583805cf98b4',
79
- {:name => 'foo', :template => {:key => 'value'}}
74
+ "76fe5df1c93a0a530f3e583805cf98b4",
75
+ {name: "foo", template: {key: "value"}}
80
76
  )
81
77
 
82
78
  assert_requested(:put, url) do |req|
83
79
  values = values_from_post_body(req.body)
84
- data = MultiJson.load(values['params'])
85
- data['name'].must_equal 'foo'
86
- data['template']['key'].must_equal 'value'
80
+ data = MultiJson.load(values["params"])
81
+ _(data["name"]).must_equal "foo"
82
+ _(data["template"]["key"]).must_equal "value"
87
83
  end
88
84
  end
89
85
 
90
- it 'must update template with specified id' do
91
- VCR.use_cassette 'update_template' do
92
- response = @template.update '55c965a063a311e6ba2d379ef10b28f7'
86
+ it "must update template with specified id" do
87
+ VCR.use_cassette "update_template" do
88
+ response = @template.update "55c965a063a311e6ba2d379ef10b28f7"
93
89
 
94
- response['ok'].must_equal 'TEMPLATE_UPDATED'
95
- response['template_id'].must_equal '55c965a063a311e6ba2d379ef10b28f7'
90
+ _(response["ok"]).must_equal "TEMPLATE_UPDATED"
91
+ _(response["template_id"]).must_equal "55c965a063a311e6ba2d379ef10b28f7"
96
92
  end
97
93
  end
98
94
  end
99
95
 
100
- describe 'when deleting a template' do
101
-
102
- it 'must perform DELETE request to templates/[id]' do
103
- stub = stub_request(:delete, 'api2.transloadit.com/templates/76fe5df1c93a0a530f3e583805cf98b4')
104
- @template.delete '76fe5df1c93a0a530f3e583805cf98b4'
96
+ describe "when deleting a template" do
97
+ it "must perform DELETE request to templates/[id]" do
98
+ stub = stub_request(:delete, "https://api2.transloadit.com/templates/76fe5df1c93a0a530f3e583805cf98b4")
99
+ @template.delete "76fe5df1c93a0a530f3e583805cf98b4"
105
100
 
106
101
  assert_requested(stub)
107
102
  end
108
103
 
109
- it 'must delete specified template templates' do
110
- VCR.use_cassette 'delete_template' do
111
- response = @template.delete '55c965a063a311e6ba2d379ef10b28f7'
104
+ it "must delete specified template templates" do
105
+ VCR.use_cassette "delete_template" do
106
+ response = @template.delete "55c965a063a311e6ba2d379ef10b28f7"
112
107
 
113
- response['ok'].must_equal 'TEMPLATE_DELETED'
108
+ _(response["ok"]).must_equal "TEMPLATE_DELETED"
114
109
  end
115
110
  end
116
111
  end
data/transloadit.gemspec CHANGED
@@ -1,39 +1,38 @@
1
- $:.unshift File.expand_path('../lib', __FILE__)
1
+ $:.unshift File.expand_path("../lib", __FILE__)
2
2
 
3
- require 'transloadit/version'
3
+ require "transloadit/version"
4
4
 
5
5
  Gem::Specification.new do |gem|
6
- gem.name = 'transloadit'
7
- gem.version = Transloadit::VERSION
6
+ gem.name = "transloadit"
7
+ gem.version = Transloadit::VERSION
8
8
  gem.platform = Gem::Platform::RUBY
9
9
 
10
- gem.authors = [ "Stephen Touset", "Robin Mehner" ]
11
- gem.email = %w{ stephen@touset.org robin@coding-robin.de }
12
- gem.homepage = 'http://github.com/transloadit/ruby-sdk/'
13
- gem.license = 'MIT'
10
+ gem.authors = ["Stephen Touset", "Robin Mehner"]
11
+ gem.email = %w[stephen@touset.org robin@coding-robin.de]
12
+ gem.homepage = "https://github.com/transloadit/ruby-sdk/"
13
+ gem.license = "MIT"
14
14
 
15
- gem.summary = 'Official Ruby gem for Transloadit'
16
- gem.description = 'The transloadit gem allows you to automate uploading files through the Transloadit REST API'
15
+ gem.summary = "Official Ruby gem for Transloadit"
16
+ gem.description = "The transloadit gem allows you to automate uploading files through the Transloadit REST API"
17
17
 
18
- gem.required_rubygems_version = '>= 2.2.0'
19
- gem.required_ruby_version = '>= 2.1.0'
18
+ gem.required_rubygems_version = ">= 2.2.0"
19
+ gem.required_ruby_version = ">= 3.0.0"
20
20
 
21
- gem.files = `git ls-files`.split("\n")
22
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
- gem.require_paths = %w{ lib }
21
+ gem.files = `git ls-files`.split("\n")
22
+ gem.require_paths = %w[lib]
24
23
 
25
- gem.add_dependency 'rest-client'
26
- gem.add_dependency 'multi_json'
27
- gem.add_dependency 'mime-types'
24
+ gem.add_dependency "rest-client"
25
+ gem.add_dependency "multi_json"
26
+ gem.add_dependency "mime-types"
28
27
 
29
- gem.add_development_dependency 'rake'
30
- gem.add_development_dependency 'minitest'
31
- gem.add_development_dependency 'simplecov'
28
+ gem.add_development_dependency "rake"
29
+ gem.add_development_dependency "minitest"
30
+ gem.add_development_dependency "simplecov"
31
+ gem.add_development_dependency "standard"
32
32
 
33
- gem.add_development_dependency 'vcr'
34
- gem.add_development_dependency 'webmock'
35
-
36
- gem.add_development_dependency 'yard'
37
- gem.add_development_dependency 'kramdown' # for YARD rdoc formatting
33
+ gem.add_development_dependency "vcr"
34
+ gem.add_development_dependency "webmock"
38
35
 
36
+ gem.add_development_dependency "yard"
37
+ gem.add_development_dependency "kramdown" # for YARD rdoc formatting
39
38
  end