transloadit 3.0.0 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0001e9da3cd516d632f1f64b19e3c1a543b3fcb8b3d595ef357b1378be78575
4
- data.tar.gz: c835af092c5046f590b6cd57570ee10b12aef5b8679da544f61217f5a349a8c1
3
+ metadata.gz: bbcbc1941ade757af1bd9f57068863464f25062415f2b894715992e905528ac7
4
+ data.tar.gz: 740dd8bcc2311d47fb133ae5c771f05b36835f77f00843bab4d9808d0c4a23e5
5
5
  SHA512:
6
- metadata.gz: 179ec53008ed5bd7525a422bd3bdb6fe69ef4b665cb6fdfd1c6490ceb91ce9452c965ee5476a51494e144f1d8f02fda5344121763a0a0ea2bfaf0315b48633b4
7
- data.tar.gz: 9b599ab52a8d44016cd4e9dcaf954fd845a4ae881f1c85b4efcb1d1a867e006eb433cd3b09333cbafa8f03f7ef8860ae3cd7668f72ce2415cb3cdb7256a1a3d8
6
+ metadata.gz: bb2ff7fae5d6e9a0370c07880123e4a88743b13d163800d7a62b2b859f010dac589600b4a9673d0903b633e04af05ce74027c617550aa11bf0274898576a6d60
7
+ data.tar.gz: 5bebda5ba59fffdd478a82aad4f348bc58feb31b619f58530aebf3fca75313c458c599cf8f435171cd424a9a49185a39ab4d75a77ab0d3502cded2ffe81d0dae
@@ -1,5 +1,9 @@
1
1
  name: CI
2
- on: push
2
+ on:
3
+ push:
4
+ branches: [ main ]
5
+ pull_request:
6
+ branches: [ main ]
3
7
  jobs:
4
8
  ci:
5
9
  runs-on: ubuntu-latest
data/.gitignore CHANGED
@@ -12,3 +12,4 @@ pkg
12
12
  transloadit-*.gem
13
13
 
14
14
  .DS_Store
15
+ env.sh
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 3.0.2 / 2024-03-01
2
+
3
+ - Upgrade signature algorithm to more secure SHA-384 [#69](https://github.com/transloadit/ruby-sdk/pull/69) (@aduh95)
4
+
5
+ ### 3.0.1 / 2024-01-10
6
+
7
+ - Fix `undefined method` errors when handling network exceptions [#67](https://github.com/transloadit/ruby-sdk/pull/67) (@Acconut)
8
+
1
9
  ### 3.0.0 / 2024-01-10
2
10
 
3
11
  - BREAKING: Drop support for EOL'd Ruby 2.x
data/examples/README.md CHANGED
@@ -40,8 +40,8 @@ utilizing our credentials that we set in environment variables.
40
40
  ### First example
41
41
 
42
42
  In the [first example](https://github.com/transloadit/ruby-sdk/blob/main/examples/basic/image-transcoder.rb)
43
- that gets played, we fetch an image from the cat api, optimize it using the Transloadit `/image/optimize` robot, and then optionally
44
- stores it in s3 if the s3 credentials are set.
43
+ that gets played, we load an image, optimize it using the Transloadit `/image/optimize` robot, and then optionally
44
+ store it in s3 if the s3 credentials are set.
45
45
 
46
46
  There are only two steps:
47
47
 
@@ -65,7 +65,7 @@ begin
65
65
 
66
66
  steps.push(store)
67
67
  rescue KeyError => e
68
- p 's3 config not set. Skipping s3 storage...'
68
+ puts 's3 config not set. Skipping s3 storage...'
69
69
  end
70
70
 
71
71
  ```
@@ -119,7 +119,7 @@ begin
119
119
 
120
120
  steps.push(store)
121
121
  rescue KeyError => e
122
- p 's3 config not set. Skipping s3 storage...'
122
+ puts 's3 config not set. Skipping s3 storage...'
123
123
  end
124
124
  ```
125
125
 
@@ -175,10 +175,10 @@ concat = transloadit_client.step('concat', '/audio/concat', {
175
175
 
176
176
  Taking a look at the `concat` step, we see a different usage of the `use` parameter
177
177
  than we have seen in previous examples. We are effectively able to define the ordering of the
178
- concatenation by specifying the ```name```, `as` and `fields` parameters.
178
+ concatenation by specifying the ```name```, `as` and `fields` parameters.
179
179
 
180
180
  In this example, we have set the name for each to `:original`, specifying that the input
181
- at index `i` should be the input file defined at index `i`.
181
+ at index `i` should be the input file defined at index `i`.
182
182
 
183
183
  It is equally important to specify the `as` parameter. This simple parameter tells the assembly
184
184
  the ordering.
@@ -205,7 +205,7 @@ begin
205
205
 
206
206
  steps.push(store)
207
207
  rescue KeyError => e
208
- p 's3 config not set. Skipping s3 storage...'
208
+ puts 's3 config not set. Skipping s3 storage...'
209
209
  end
210
210
 
211
211
  assembly = transloadit_client.assembly(steps: steps)
Binary file
@@ -27,7 +27,7 @@ class AudioConcatTranscoder < MediaTranscoder
27
27
 
28
28
  steps.push(store)
29
29
  rescue KeyError
30
- p "s3 config not set. Skipping s3 storage..."
30
+ puts "s3 config not set. Skipping s3 storage..."
31
31
  end
32
32
 
33
33
  assembly = transloadit_client.assembly(steps: steps)
@@ -30,7 +30,7 @@ class AudioTranscoder < MediaTranscoder
30
30
 
31
31
  steps.push(store)
32
32
  rescue KeyError
33
- p "s3 config not set. Skipping s3 storage..."
33
+ puts "s3 config not set. Skipping s3 storage..."
34
34
  end
35
35
 
36
36
  assembly = transloadit_client.assembly(steps: steps)
@@ -23,7 +23,7 @@ class ImageTranscoder < MediaTranscoder
23
23
 
24
24
  steps.push(store)
25
25
  rescue KeyError
26
- p "s3 config not set. Skipping s3 storage..."
26
+ puts "s3 config not set. Skipping s3 storage..."
27
27
  end
28
28
 
29
29
  assembly = transloadit_client.assembly(steps: steps)
@@ -1,63 +1,56 @@
1
- require "open-uri"
2
1
  require_relative "media-transcoder"
3
2
  require_relative "image-transcoder"
4
3
  require_relative "audio-transcoder"
5
4
  require_relative "audio-concat-transcoder"
6
5
 
7
- p "starting image transcoding job..."
8
- p "fetching image from the cat api..."
6
+ puts "starting image transcoding job..."
9
7
 
10
- open("http://thecatapi.com/api/images/get") do |f|
11
- p "starting transcoding job..."
8
+ File.open("#{__dir__}/assets/cat.jpg") do |f|
12
9
  image_transcoder = ImageTranscoder.new
13
10
  response = image_transcoder.transcode!(f)
14
11
 
15
12
  # if you are using rails one thing you can do would be to start an ActiveJob process that recursively
16
13
  # checks on the status of the assembly until it is finished
17
- p "checking job status..."
14
+ puts "checking job status..."
18
15
  response.reload_until_finished!
19
16
 
20
- p response[:message]
21
- p response[:results]["image"][0]["url"]
17
+ puts response[:message]
18
+ puts response[:results]["image"][0]["ssl_url"]
19
+ puts "\n"
22
20
  end
23
21
 
24
- p "starting audio transcoding job..."
25
- p "fetching soundbite from nasa..."
26
- p "\n"
22
+ puts "starting audio transcoding job..."
27
23
 
28
- open("https://www.nasa.gov/640379main_Computers_are_in_Control.m4r") do |f|
29
- p "starting transcoding job..."
24
+ File.open("#{__dir__}/assets/Computers_are_in_Control.flac") do |f|
30
25
  audio_transcoder = AudioTranscoder.new
31
26
  response = audio_transcoder.transcode!(f)
32
27
 
33
28
  # if you are using rails one thing you can do would be to start an ActiveJob process that recursively
34
29
  # checks on the status of the assembly until it is finished
35
- p "checking job status..."
30
+ puts "checking job status..."
36
31
  response.reload_until_finished!
37
32
 
38
- p response[:message]
39
- p response[:results]["mp3"][0]["url"]
40
- p "\n"
33
+ puts response[:message]
34
+ puts response[:results]["mp3"][0]["ssl_url"]
35
+ puts "\n"
41
36
  end
42
37
 
43
- p "starting audio concat transcoding job..."
44
- p "fetching 3 soundbites from nasa..."
38
+ puts "starting audio concat transcoding job..."
45
39
 
46
40
  files = [
47
- "https://www.nasa.gov/mp3/640148main_APU%20Shutdown.mp3",
48
- "https://www.nasa.gov/mp3/640164main_Go%20for%20Deploy.mp3",
49
- "https://www.nasa.gov/mp3/640165main_Lookin%20At%20It.mp3"
41
+ "#{__dir__}/assets/APU_Shutdown.mp3",
42
+ "#{__dir__}/assets/Go_for_Deploy.mp3",
43
+ "#{__dir__}/assets/Lookin_At_It.mp3"
50
44
  ]
51
45
 
52
- p "starting transcoding job..."
53
46
  audio_concat_transcoder = AudioConcatTranscoder.new
54
47
  response = audio_concat_transcoder.transcode!(files)
55
48
 
56
49
  # if you are using rails one thing you can do would be to start an ActiveJob process that recursively
57
50
  # checks on the status of the assembly until it is finished
58
- p "checking job status..."
51
+ puts "checking job status..."
59
52
  response.reload_until_finished!
60
53
 
61
- p response[:message]
62
- p response[:results]["concat"][0]["url"]
63
- p "\n"
54
+ puts response[:message]
55
+ puts response[:results]["concat"][0]["ssl_url"]
56
+ puts "\n"
@@ -16,7 +16,7 @@ class Transloadit::Request
16
16
  API_HEADERS = {"Transloadit-Client" => "ruby-sdk:#{Transloadit::VERSION}"}
17
17
 
18
18
  # The HMAC algorithm used for calculation request signatures.
19
- HMAC_ALGORITHM = OpenSSL::Digest.new("sha1")
19
+ HMAC_ALGORITHM = OpenSSL::Digest.new("sha384")
20
20
 
21
21
  # @return [String] the API endpoint for the request
22
22
  attr_reader :url
@@ -187,6 +187,11 @@ class Transloadit::Request
187
187
  def request!(&request)
188
188
  Transloadit::Response.new yield
189
189
  rescue RestClient::Exception => e
190
+ # The response attribute can be nil, for example for RestClient::Exceptions::OpenTimeout exceptions.
191
+ # Then, we cannot convert them into a Transloadit::Response, so instead we raise them again for
192
+ # the user to be visible.
193
+ # See https://github.com/transloadit/ruby-sdk/issues/53
194
+ raise e if e.response.nil?
190
195
  Transloadit::Response.new e.response
191
196
  end
192
197
 
@@ -198,6 +203,6 @@ class Transloadit::Request
198
203
  # @return [String] the HMAC signature for the params
199
204
  #
200
205
  def signature(params)
201
- self.class._hmac(secret, params) if secret.to_s.length > 0
206
+ "sha384:" + self.class._hmac(secret, params) if secret.to_s.length > 0
202
207
  end
203
208
  end
@@ -1,3 +1,3 @@
1
1
  class Transloadit
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.2"
3
3
  end
@@ -72,7 +72,7 @@ http_interactions:
72
72
  recorded_at: Fri, 08 Mar 2013 15:13:10 GMT
73
73
  - request:
74
74
  method: get
75
- uri: https://api2.transloadit.com/?params=%7B%22params%22:%7B%22foo%22:%22bar%22%7D%7D&signature=78f291e3038e3eeb82d9f79e11a68fe7b858ee97
75
+ uri: https://api2.transloadit.com/?params=%7B%22params%22:%7B%22foo%22:%22bar%22%7D%7D&signature=sha384:edccc99aef8cb46e087e17093fbcd6a2316e2fbe31dc0842c4af87a52808d0736d94a3bd5774deca2c215b53804ca572
76
76
  body:
77
77
  encoding: US-ASCII
78
78
  string: ''
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: 3.0.0
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Touset
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-01-10 00:00:00.000000000 Z
12
+ date: 2024-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -183,6 +183,11 @@ files:
183
183
  - README.md
184
184
  - Rakefile
185
185
  - examples/README.md
186
+ - examples/basic/assets/APU_Shutdown.mp3
187
+ - examples/basic/assets/Computers_are_in_Control.flac
188
+ - examples/basic/assets/Go_for_Deploy.mp3
189
+ - examples/basic/assets/Lookin_At_It.mp3
190
+ - examples/basic/assets/cat.jpg
186
191
  - examples/basic/audio-concat-transcoder.rb
187
192
  - examples/basic/audio-transcoder.rb
188
193
  - examples/basic/image-transcoder.rb