transloadit 3.0.1 → 3.0.2
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.
- checksums.yaml +4 -4
 - data/.github/workflows/ci.yml +5 -1
 - data/.gitignore +1 -0
 - data/CHANGELOG.md +4 -0
 - data/examples/README.md +7 -7
 - data/examples/basic/assets/APU_Shutdown.mp3 +0 -0
 - data/examples/basic/assets/Computers_are_in_Control.flac +0 -0
 - data/examples/basic/assets/Go_for_Deploy.mp3 +0 -0
 - data/examples/basic/assets/Lookin_At_It.mp3 +0 -0
 - data/examples/basic/assets/cat.jpg +0 -0
 - data/examples/basic/audio-concat-transcoder.rb +1 -1
 - data/examples/basic/audio-transcoder.rb +1 -1
 - data/examples/basic/image-transcoder.rb +1 -1
 - data/examples/basic/main.rb +20 -27
 - data/lib/transloadit/request.rb +2 -2
 - data/lib/transloadit/version.rb +1 -1
 - data/test/fixtures/cassettes/fetch_root.yml +1 -1
 - metadata +7 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: bbcbc1941ade757af1bd9f57068863464f25062415f2b894715992e905528ac7
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 740dd8bcc2311d47fb133ae5c771f05b36835f77f00843bab4d9808d0c4a23e5
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: bb2ff7fae5d6e9a0370c07880123e4a88743b13d163800d7a62b2b859f010dac589600b4a9673d0903b633e04af05ce74027c617550aa11bf0274898576a6d60
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5bebda5ba59fffdd478a82aad4f348bc58feb31b619f58530aebf3fca75313c458c599cf8f435171cd424a9a49185a39ab4d75a77ab0d3502cded2ffe81d0dae
         
     | 
    
        data/.github/workflows/ci.yml
    CHANGED
    
    
    
        data/.gitignore
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,3 +1,7 @@ 
     | 
|
| 
      
 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 
     | 
    
         
            +
             
     | 
| 
       1 
5 
     | 
    
         
             
            ### 3.0.1 / 2024-01-10
         
     | 
| 
       2 
6 
     | 
    
         | 
| 
       3 
7 
     | 
    
         
             
            - Fix `undefined method` errors when handling network exceptions [#67](https://github.com/transloadit/ruby-sdk/pull/67) (@Acconut)
         
     | 
    
        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  
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            -
               
     | 
| 
      
 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 
     | 
    
         
            -
               
     | 
| 
      
 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```, 
     | 
| 
      
 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 
     | 
| 
      
 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 
     | 
    
         
            -
               
     | 
| 
      
 208 
     | 
    
         
            +
              puts 's3 config not set. Skipping s3 storage...'
         
     | 
| 
       209 
209 
     | 
    
         
             
            end
         
     | 
| 
       210 
210 
     | 
    
         | 
| 
       211 
211 
     | 
    
         
             
            assembly = transloadit_client.assembly(steps: steps)
         
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
    
        data/examples/basic/main.rb
    CHANGED
    
    | 
         @@ -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 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            p "fetching image from the cat api..."
         
     | 
| 
      
 6 
     | 
    
         
            +
            puts "starting image transcoding job..."
         
     | 
| 
       9 
7 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
            open(" 
     | 
| 
       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 
     | 
    
         
            -
               
     | 
| 
      
 14 
     | 
    
         
            +
              puts "checking job status..."
         
     | 
| 
       18 
15 
     | 
    
         
             
              response.reload_until_finished!
         
     | 
| 
       19 
16 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
       21 
     | 
    
         
            -
               
     | 
| 
      
 17 
     | 
    
         
            +
              puts response[:message]
         
     | 
| 
      
 18 
     | 
    
         
            +
              puts response[:results]["image"][0]["ssl_url"]
         
     | 
| 
      
 19 
     | 
    
         
            +
              puts "\n"
         
     | 
| 
       22 
20 
     | 
    
         
             
            end
         
     | 
| 
       23 
21 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
            p "fetching soundbite from nasa..."
         
     | 
| 
       26 
     | 
    
         
            -
            p "\n"
         
     | 
| 
      
 22 
     | 
    
         
            +
            puts "starting audio transcoding job..."
         
     | 
| 
       27 
23 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
            open(" 
     | 
| 
       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 
     | 
    
         
            -
               
     | 
| 
      
 30 
     | 
    
         
            +
              puts "checking job status..."
         
     | 
| 
       36 
31 
     | 
    
         
             
              response.reload_until_finished!
         
     | 
| 
       37 
32 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
               
     | 
| 
       39 
     | 
    
         
            -
               
     | 
| 
       40 
     | 
    
         
            -
               
     | 
| 
      
 33 
     | 
    
         
            +
              puts response[:message]
         
     | 
| 
      
 34 
     | 
    
         
            +
              puts response[:results]["mp3"][0]["ssl_url"]
         
     | 
| 
      
 35 
     | 
    
         
            +
              puts "\n"
         
     | 
| 
       41 
36 
     | 
    
         
             
            end
         
     | 
| 
       42 
37 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
            p "fetching 3 soundbites from nasa..."
         
     | 
| 
      
 38 
     | 
    
         
            +
            puts "starting audio concat transcoding job..."
         
     | 
| 
       45 
39 
     | 
    
         | 
| 
       46 
40 
     | 
    
         
             
            files = [
         
     | 
| 
       47 
     | 
    
         
            -
              " 
     | 
| 
       48 
     | 
    
         
            -
              " 
     | 
| 
       49 
     | 
    
         
            -
              " 
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
      
 51 
     | 
    
         
            +
            puts "checking job status..."
         
     | 
| 
       59 
52 
     | 
    
         
             
            response.reload_until_finished!
         
     | 
| 
       60 
53 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
      
 54 
     | 
    
         
            +
            puts response[:message]
         
     | 
| 
      
 55 
     | 
    
         
            +
            puts response[:results]["concat"][0]["ssl_url"]
         
     | 
| 
      
 56 
     | 
    
         
            +
            puts "\n"
         
     | 
    
        data/lib/transloadit/request.rb
    CHANGED
    
    | 
         @@ -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(" 
     | 
| 
      
 19 
     | 
    
         
            +
              HMAC_ALGORITHM = OpenSSL::Digest.new("sha384")
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
              # @return [String] the API endpoint for the request
         
     | 
| 
       22 
22 
     | 
    
         
             
              attr_reader :url
         
     | 
| 
         @@ -203,6 +203,6 @@ class Transloadit::Request 
     | 
|
| 
       203 
203 
     | 
    
         
             
              # @return [String] the HMAC signature for the params
         
     | 
| 
       204 
204 
     | 
    
         
             
              #
         
     | 
| 
       205 
205 
     | 
    
         
             
              def signature(params)
         
     | 
| 
       206 
     | 
    
         
            -
                self.class._hmac(secret, params) if secret.to_s.length > 0
         
     | 
| 
      
 206 
     | 
    
         
            +
                "sha384:" + self.class._hmac(secret, params) if secret.to_s.length > 0
         
     | 
| 
       207 
207 
     | 
    
         
             
              end
         
     | 
| 
       208 
208 
     | 
    
         
             
            end
         
     | 
    
        data/lib/transloadit/version.rb
    CHANGED
    
    
| 
         @@ -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= 
     | 
| 
      
 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. 
     | 
| 
      
 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 
     | 
| 
      
 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
         
     |