transloadit-rails 1.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +15 -20
- data/CHANGELOG.md +85 -0
- data/LICENSE +9 -0
- data/README.md +65 -39
- data/gemfiles/4.0.gemfile +1 -1
- data/gemfiles/4.1.gemfile +4 -0
- data/gemfiles/4.2.gemfile +4 -0
- data/gemfiles/5.0.gemfile +4 -0
- data/lib/generators/transloadit/install_generator.rb +2 -2
- data/lib/templates/transloadit/transloadit.yml +2 -2
- data/lib/transloadit/rails/engine.rb +19 -6
- data/lib/transloadit/rails/params_decoder.rb +5 -1
- data/lib/transloadit/rails/version.rb +1 -1
- data/lib/transloadit/rails/view_helper.rb +6 -2
- data/lib/transloadit/rspec/request_spec_helper.rb +2 -2
- data/test/generators/transloadit/test_install_generator.rb +6 -5
- data/test/test_helper.rb +0 -5
- data/transloadit-rails.gemspec +10 -6
- metadata +42 -56
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a5465ec8511fb1f87cb094eec15a805b43b2ccf5e3a9bb13d80cab549bf2d6e0
|
4
|
+
data.tar.gz: b0776286a6bcb7957f0f8fc704616f1ce5b143582fd32cb6de41ddafed43fbd7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ea0e365469f83efc42a1de4e9c2a489f80c170b28c2a49a7ed1f8b0cb8a43b637b58b2f2b7803fb485f140f729e5ae5add8dc3c29ffda3d9a41cdddddc1cb6f1
|
7
|
+
data.tar.gz: 0037fc481dc8272cef796a60739ef5d17f7b4a6e80211d7fbcc82f734f1e64300c12e0ae752544b473f5ab0d9ee4149238bd29cfbf0946c14f801a7a22737921
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,14 +1,11 @@
|
|
1
|
+
sudo: false
|
1
2
|
language: ruby
|
2
3
|
rvm:
|
3
|
-
-
|
4
|
-
-
|
5
|
-
-
|
6
|
-
-
|
7
|
-
-
|
8
|
-
- rbx-18mode
|
9
|
-
- rbx-19mode
|
10
|
-
- jruby-18mode
|
11
|
-
- jruby-19mode
|
4
|
+
- 2.1.0
|
5
|
+
- 2.2.0
|
6
|
+
- 2.3.0
|
7
|
+
- rbx-2
|
8
|
+
- jruby-9.0.0.0
|
12
9
|
script: "bundle exec rake test"
|
13
10
|
|
14
11
|
gemfile:
|
@@ -16,16 +13,14 @@ gemfile:
|
|
16
13
|
- gemfiles/3.1.gemfile
|
17
14
|
- gemfiles/3.2.gemfile
|
18
15
|
- gemfiles/4.0.gemfile
|
16
|
+
- gemfiles/4.1.gemfile
|
17
|
+
- gemfiles/4.2.gemfile
|
19
18
|
|
20
19
|
matrix:
|
21
|
-
|
22
|
-
- rvm:
|
23
|
-
|
24
|
-
- rvm:
|
25
|
-
gemfile: gemfiles/
|
26
|
-
- rvm:
|
27
|
-
gemfile: gemfiles/
|
28
|
-
- rvm: ree
|
29
|
-
gemfile: gemfiles/4.0.gemfile
|
30
|
-
- rvm: 1.9.2
|
31
|
-
gemfile: gemfiles/4.0.gemfile
|
20
|
+
allow_failures:
|
21
|
+
- rvm: rbx-2
|
22
|
+
include:
|
23
|
+
- rvm: 2.2.2
|
24
|
+
gemfile: gemfiles/5.0.gemfile
|
25
|
+
- rvm: 2.3.0
|
26
|
+
gemfile: gemfiles/5.0.gemfile
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
### 3.0.0 / 2021-02-12
|
2
|
+
* Update default jQuery version to v3
|
3
|
+
|
4
|
+
### 2.0.0 / 2016-12-03 ###
|
5
|
+
|
6
|
+
* Drop support for EOL'd Ruby 1.9.x and Ruby 2.0, please use version 1.2.0 if you need support for older
|
7
|
+
Ruby versions.
|
8
|
+
* Fix compatibility to Ruby >=2.1 and Rails 5 (thanks @einzige)
|
9
|
+
|
10
|
+
### 1.2.0 / 2016-03-27 ###
|
11
|
+
|
12
|
+
* Allow to pass `max_size` to the helper (thanks @avokhmin)
|
13
|
+
|
14
|
+
### 1.1.2 / 2015-12-15 ###
|
15
|
+
|
16
|
+
* Allow `onFileSelect` callback (thanks @netonion)
|
17
|
+
|
18
|
+
### 1.1.1 / 2013-09-15 ###
|
19
|
+
|
20
|
+
* MIT license
|
21
|
+
* Bumped transloadit dependency to >= 1.1.1
|
22
|
+
|
23
|
+
### 1.1.0 / 2013-03-16 ###
|
24
|
+
|
25
|
+
* Switch to Kramdown for RDoc formatting
|
26
|
+
* Support jRuby 1.8/1.9 and MRI 2.0.0 too
|
27
|
+
* Support for Rails 4.x
|
28
|
+
* Dropped support for Ruby 1.8.6
|
29
|
+
* Better generator & documentation for environment specific configuration (thanks @samullen)
|
30
|
+
|
31
|
+
### 1.0.8 / 2012-11-11 ###
|
32
|
+
|
33
|
+
* allow configuration per environment (thanks @samullen)
|
34
|
+
|
35
|
+
### 1.0.7 / 2012-07-09 ###
|
36
|
+
|
37
|
+
* Integrated RSpec helper (thanks @jstirk)
|
38
|
+
|
39
|
+
### 1.0.6 / 2012-04-13 ###
|
40
|
+
|
41
|
+
* Documentation fixes
|
42
|
+
* Don't sign requests when no secret is provided
|
43
|
+
|
44
|
+
### 1.0.5 / 2012-04-09 ###
|
45
|
+
|
46
|
+
* fix deprecation warning on Rails 3.2 by removing use of ActiveSupport::Memoizable
|
47
|
+
|
48
|
+
### 1.0.4 / 2012-02-23 ###
|
49
|
+
|
50
|
+
* Don't encode known callbacks to JSON
|
51
|
+
|
52
|
+
### 1.0.3 / 2011-11-15 ###
|
53
|
+
|
54
|
+
* Allow ERB in config files
|
55
|
+
|
56
|
+
### 1.0.2 / 2011-09-23 ###
|
57
|
+
|
58
|
+
* Fix default configuration template
|
59
|
+
* Bump dependency to transloadit gem to 1.0.2
|
60
|
+
* Allow duration to be configurable
|
61
|
+
|
62
|
+
### 1.0.1 / 2011-09-19 ###
|
63
|
+
|
64
|
+
* Use jQuery instead of $ to prevent problems with other libraries
|
65
|
+
* fixed "uninitialized constant Transloadit::Rails::ViewHelper"
|
66
|
+
|
67
|
+
### 1.0.0 / 2011-06-09 ###
|
68
|
+
|
69
|
+
* Fix View Helper
|
70
|
+
* Some optimizations for jQuery initialization
|
71
|
+
* Explicit including of the params decoder module instead of automatic magic
|
72
|
+
* Depend on railties, not Rails
|
73
|
+
|
74
|
+
### 0.9.2 / 2011-04-26 ###
|
75
|
+
|
76
|
+
* Automatically translate Transloadit API JSON
|
77
|
+
|
78
|
+
### 0.9.1 / 2011-04-19 ###
|
79
|
+
|
80
|
+
* Lazy-load configuration
|
81
|
+
* better error messages
|
82
|
+
|
83
|
+
### 0.9.0 / 2011-04-13 ###
|
84
|
+
|
85
|
+
* Initial release
|
data/LICENSE
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Transloadit Ltd.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
[![Build Status](https://travis-ci.org/transloadit/rails-sdk.png?branch=master)](https://travis-ci.org/transloadit/rails-sdk)
|
2
2
|
|
3
|
-
|
3
|
+
## rails-sdk
|
4
4
|
|
5
|
-
|
5
|
+
A **Rails** Integration for [Transloadit](https://transloadit.com)'s file uploading and encoding service
|
6
6
|
|
7
|
-
##
|
7
|
+
## Intro
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
[Transloadit](https://transloadit.com) is a service that helps you handle file uploads, resize, crop and watermark your images, make GIFs, transcode your videos, extract thumbnails, generate audio waveforms, and so much more. In short, [Transloadit](https://transloadit.com) is the Swiss Army Knife for your files.
|
10
|
+
|
11
|
+
This is a **Rails** SDK to make it easy to talk to the [Transloadit](https://transloadit.com) REST API.
|
12
|
+
|
13
|
+
*This gem provides browser integration. If you're looking to integrate Transloadit from your own serverside Ruby code checkout the [ruby-sdk](https://github.com/transloadit/ruby-sdk).*
|
11
14
|
|
12
15
|
## Install
|
13
16
|
|
@@ -15,19 +18,16 @@ you to automate uploading files through the Transloadit REST API.
|
|
15
18
|
$ gem install transloadit-rails
|
16
19
|
```
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
To get started, you need to add the 'transloadit-rails' gem to your Rails
|
21
|
-
project's Gemfile.
|
21
|
+
or add the `transloadit-rails` Gem to your Rails project's `Gemfile` and update your bundle.
|
22
22
|
|
23
23
|
```bash
|
24
24
|
$ echo "gem 'transloadit-rails'" >> Gemfile
|
25
|
+
$ bundle install
|
25
26
|
```
|
26
27
|
|
27
|
-
|
28
|
+
After installation you need to run the `transloadit:install` generator to complete the setup.
|
28
29
|
|
29
30
|
```bash
|
30
|
-
$ bundle install
|
31
31
|
$ rails g transloadit:install
|
32
32
|
```
|
33
33
|
|
@@ -40,14 +40,14 @@ the upload forms.
|
|
40
40
|
|
41
41
|
```yaml
|
42
42
|
auth:
|
43
|
-
key : '
|
44
|
-
secret : '
|
43
|
+
key : 'TRANSLOADIT_KEY'
|
44
|
+
secret : 'TRANSLOADIT_SECRET' # optional, but highly recommended
|
45
45
|
duration: 1800 # 30 minute validity period for signed upload forms
|
46
46
|
|
47
47
|
templates:
|
48
48
|
# template identified by template_id
|
49
|
-
s3_store: '
|
50
|
-
|
49
|
+
s3_store: 'YOUR_TEMPLATE_ID'
|
50
|
+
|
51
51
|
# template defined inline
|
52
52
|
image_resize:
|
53
53
|
steps:
|
@@ -69,42 +69,28 @@ exactly in order to be used.
|
|
69
69
|
```yaml
|
70
70
|
development:
|
71
71
|
auth:
|
72
|
-
key : '
|
72
|
+
key : 'TRANSLOADIT_KEY'
|
73
73
|
...
|
74
74
|
|
75
75
|
templates:
|
76
|
-
s3_store: '
|
76
|
+
s3_store: 'YOUR_TEMPLATE_ID'
|
77
77
|
...
|
78
78
|
|
79
79
|
production:
|
80
80
|
auth:
|
81
|
-
key : '
|
81
|
+
key : 'TRANSLOADIT_KEY'
|
82
82
|
...
|
83
83
|
|
84
84
|
templates:
|
85
|
-
s3_store: '
|
86
|
-
...
|
87
|
-
```
|
88
|
-
|
89
|
-
## Support IE6 or jQuery < 1.9
|
90
|
-
|
91
|
-
If you have to support IE6 and use a jQuery version below 1.9, you have to change
|
92
|
-
the jquery_sdk_version in the config to 'v1.0.0':
|
93
|
-
|
94
|
-
```yaml
|
95
|
-
production:
|
96
|
-
jquery_sdk_version: 'v1.0.0'
|
97
|
-
auth:
|
85
|
+
s3_store: 'YOUR_TEMPLATE_ID'
|
98
86
|
...
|
99
87
|
```
|
100
88
|
|
101
89
|
## Usage
|
102
90
|
|
103
|
-
Refer to the
|
104
|
-
and loads the [Transloadit jQuery plugin](https://github.com/transloadit/jquery-sdk).
|
105
|
-
It also uses JavaScript to ensure your form is encoded as `multipart/form-data`.
|
91
|
+
Refer to the <dfn>Templates</dfn> (which you have set in the [config](https://github.com/transloadit/rails-sdk/#configuration)) with the `transloadit` helper.
|
106
92
|
|
107
|
-
```
|
93
|
+
```html
|
108
94
|
<%= form_for :upload, :html => { :id => 'upload' } do |form| %>
|
109
95
|
<%= transloadit :s3_store %>
|
110
96
|
<%= form.label :file, 'File to upload' %>
|
@@ -112,11 +98,16 @@ It also uses JavaScript to ensure your form is encoded as `multipart/form-data`.
|
|
112
98
|
<%= form.submit %>
|
113
99
|
<% end %>
|
114
100
|
|
101
|
+
<%= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' %>
|
115
102
|
<%= transloadit_jquerify :upload %>
|
116
103
|
```
|
117
104
|
|
118
|
-
|
119
|
-
|
105
|
+
This requires jQuery, and loads the [Transloadit jQuery plugin](https://github.com/transloadit/jquery-sdk/). Be sure to exclude the `<%= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' %>` tag if you already have jQuery loaded.
|
106
|
+
|
107
|
+
JavaScript also ensures your form is encoded as `multipart/form-data`.
|
108
|
+
|
109
|
+
If you want to use the automatic `transloadit` parameter decoding, you have to include
|
110
|
+
the `Transloadit::Rails::ParamsDecoder` module into your controller
|
120
111
|
|
121
112
|
```ruby
|
122
113
|
class YourController
|
@@ -124,7 +115,10 @@ class YourController
|
|
124
115
|
end
|
125
116
|
```
|
126
117
|
|
127
|
-
that way the param[:transloadit] is automatically decoded for you, if it exists
|
118
|
+
that way the `param[:transloadit]` is automatically decoded for you, if it exists
|
119
|
+
|
120
|
+
**Note** Since it's still very young, the Transloadit Rails SDK does not include batteries for it yet, but
|
121
|
+
if you're looking for a jQuery-less integration, check out [Uppy](https://transloadit.com/docs/#uppy), our next-gen file uploader for the web.
|
128
122
|
|
129
123
|
## Tutorial
|
130
124
|
|
@@ -200,7 +194,7 @@ Alright, time to create our upload form. In order to do that, please open
|
|
200
194
|
`app/views/uploads/new.html.erb`, and put the following code in:
|
201
195
|
|
202
196
|
```erb
|
203
|
-
<%= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/1.
|
197
|
+
<%= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' %>
|
204
198
|
|
205
199
|
<h1>Upload an image</h1>
|
206
200
|
<%= form_for Upload.new, :html => { :id => 'upload' } do |form| %>
|
@@ -251,6 +245,10 @@ Then go to http://localhost:3000/uploads/new, and upload an image. If you did
|
|
251
245
|
everything right, you should see the uploaded and resized file as soon as the
|
252
246
|
upload finishes.
|
253
247
|
|
248
|
+
## Example
|
249
|
+
|
250
|
+
An example rails application following the [tutorial above](https://github.com/transloadit/rails-sdk/#tutorial) can be found in the [examples](https://github.com/transloadit/rails-sdk/tree/master/examples) directory.
|
251
|
+
|
254
252
|
## Testing
|
255
253
|
|
256
254
|
### RSpec request specs
|
@@ -284,3 +282,31 @@ def example_json
|
|
284
282
|
"{ ... JSON content from a real POST ... }"
|
285
283
|
end
|
286
284
|
```
|
285
|
+
|
286
|
+
## Compatibility
|
287
|
+
|
288
|
+
At a minimum, this gem should work on MRI 2.3.0, 2.2.0, 2.1.0, Rubinius, and JRuby.
|
289
|
+
It may also work on older ruby versions, but support for those Rubies is not guaranteed.
|
290
|
+
If it doesn't work on one of the officially supported Rubies, please file a bug report.
|
291
|
+
Compatibility patches for other Rubies are welcome.
|
292
|
+
|
293
|
+
Support for EOL'd Ruby 1.9.x and Ruby 2.0 has been dropped, please use version 1.2.0
|
294
|
+
if you need support for older Ruby versions.
|
295
|
+
|
296
|
+
Testing against these versions is performed automatically by [Travis CI](https://travis-ci.org/transloadit/rails-sdk).
|
297
|
+
|
298
|
+
### Support IE6 or jQuery < 1.9
|
299
|
+
|
300
|
+
If you have to support IE6 and use a jQuery version below 1.9, you have to change
|
301
|
+
the jquery_sdk_version in the config to 'v1.0.0':
|
302
|
+
|
303
|
+
```yaml
|
304
|
+
production:
|
305
|
+
jquery_sdk_version: 'v1.0.0'
|
306
|
+
auth:
|
307
|
+
...
|
308
|
+
```
|
309
|
+
|
310
|
+
## License
|
311
|
+
|
312
|
+
MIT, see [LICENSE](LICENSE)
|
data/gemfiles/4.0.gemfile
CHANGED
@@ -3,9 +3,9 @@ require 'rails/generators'
|
|
3
3
|
|
4
4
|
class Transloadit::Generators::InstallGenerator < Rails::Generators::Base
|
5
5
|
source_root File.expand_path('../../../templates/transloadit', __FILE__)
|
6
|
-
|
6
|
+
|
7
7
|
desc %{Installs an empty Transloadit config file}
|
8
|
-
|
8
|
+
|
9
9
|
def copy_configuration
|
10
10
|
template 'transloadit.yml', 'config/transloadit.yml'
|
11
11
|
end
|
@@ -3,7 +3,7 @@ development:
|
|
3
3
|
# https://transloadit.com/blog/2013/02/transloadit-javascript-plugin-and-jquery-1-9
|
4
4
|
# defaults to latest
|
5
5
|
# use "v1.0.0" if you need IE6 support (using jQuery < 1.9)
|
6
|
-
jquery_sdk_version: 'latest'
|
6
|
+
jquery_sdk_version: 'v3-latest'
|
7
7
|
auth:
|
8
8
|
key : 'YOUR_KEY'
|
9
9
|
secret : 'YOUR_SECRET' # this is optional, but highly recommended, https://transloadit.com/docs/authentication
|
@@ -26,7 +26,7 @@ production:
|
|
26
26
|
# https://transloadit.com/blog/2013/02/transloadit-javascript-plugin-and-jquery-1-9
|
27
27
|
# defaults to latest
|
28
28
|
# use "v1.0.0" if you need IE6 support (using jQuery < 1.9)
|
29
|
-
jquery_sdk_version: 'latest'
|
29
|
+
jquery_sdk_version: 'v3-latest'
|
30
30
|
auth:
|
31
31
|
key : 'YOUR_KEY'
|
32
32
|
secret : 'YOUR_SECRET' # this is optional, but highly recommended, https://transloadit.com/docs/authentication
|
@@ -45,25 +45,38 @@ class Transloadit
|
|
45
45
|
#
|
46
46
|
# Returns the Transloadit authentication object.
|
47
47
|
#
|
48
|
-
|
48
|
+
# options - The Hash options used to refine the auth params (default: {}):
|
49
|
+
# :max_size - The Integer maximum size an upload can have in bytes (optional).
|
50
|
+
def self.transloadit(options = {})
|
49
51
|
Transloadit.new(
|
50
52
|
:key => self.configuration['auth']['key'],
|
51
53
|
:secret => self.configuration['auth']['secret'],
|
52
54
|
:duration => self.configuration['auth']['duration'],
|
53
|
-
:max_size => self.configuration['auth']['max_size']
|
55
|
+
:max_size => options[:max_size] || self.configuration['auth']['max_size']
|
54
56
|
)
|
55
57
|
end
|
56
58
|
|
57
59
|
#
|
58
60
|
# Creates an assembly for the named template.
|
59
61
|
#
|
62
|
+
# name - The String or Symbol template name.
|
63
|
+
# options - The Hash options used to refine the Assembly (default: {}):
|
64
|
+
# :steps - The Hash with Assembly Steps (optional).
|
65
|
+
# :max_size - The Integer maximum size an upload can have in bytes (optional).
|
60
66
|
def self.template(name, options = {})
|
67
|
+
transloadit = self.transloadit(
|
68
|
+
:max_size => options.delete(:max_size)
|
69
|
+
)
|
70
|
+
|
61
71
|
template = self.configuration['templates'].try(:fetch, name.to_s)
|
72
|
+
assembly_options = case template
|
73
|
+
when String
|
74
|
+
{ :template_id => template }.merge(options)
|
75
|
+
when Hash
|
76
|
+
template.merge(options)
|
77
|
+
end
|
62
78
|
|
63
|
-
|
64
|
-
when String then { :template_id => template }.merge(options)
|
65
|
-
when Hash then template .merge(options)
|
66
|
-
end
|
79
|
+
transloadit.assembly(assembly_options)
|
67
80
|
end
|
68
81
|
|
69
82
|
#
|
@@ -4,7 +4,11 @@ module Transloadit::Rails::ParamsDecoder
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
included do
|
7
|
-
|
7
|
+
if respond_to?(:before_action)
|
8
|
+
before_action :decode_transloadit_json
|
9
|
+
else
|
10
|
+
before_filter :decode_transloadit_json
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
14
|
def decode_transloadit_json
|
@@ -5,6 +5,10 @@ module Transloadit::Rails::ViewHelper
|
|
5
5
|
# Inserts hidden fields specifying and signing the template for Transloadit
|
6
6
|
# to process.
|
7
7
|
#
|
8
|
+
# template - The String or Symbol template name.
|
9
|
+
# options - The Hash options used to refine the Assembly (default: {}):
|
10
|
+
# :steps - The Hash with Assembly Steps (optional).
|
11
|
+
# :max_size - The Integer maximum size an upload can have in bytes (optional).
|
8
12
|
def transloadit(template, options = {})
|
9
13
|
params = Transloadit::Rails::Engine.template(template, options).to_json
|
10
14
|
fields = hidden_field_tag(:params, params, :id => nil)
|
@@ -22,7 +26,7 @@ module Transloadit::Rails::ViewHelper
|
|
22
26
|
# marked with an encoding type of `multipart/form-data`.
|
23
27
|
#
|
24
28
|
def transloadit_jquerify(id, options = {})
|
25
|
-
version = Transloadit::Rails::Engine.configuration['jquery_sdk_version'] || 'latest'
|
29
|
+
version = Transloadit::Rails::Engine.configuration['jquery_sdk_version'] || 'v2-latest'
|
26
30
|
|
27
31
|
javascript_tag %{
|
28
32
|
jQuery(function($) {
|
@@ -41,7 +45,7 @@ module Transloadit::Rails::ViewHelper
|
|
41
45
|
|
42
46
|
def options_to_json(options)
|
43
47
|
callbacks = [
|
44
|
-
:onstart, :onprogress, :onupload, :onresult, :oncancel, :onerror, :onsuccess
|
48
|
+
:onstart, :onfileselect, :onprogress, :onupload, :onresult, :oncancel, :onerror, :onsuccess
|
45
49
|
]
|
46
50
|
|
47
51
|
js_options = options.map do |key, val|
|
@@ -16,8 +16,8 @@ class Transloadit
|
|
16
16
|
ActiveSupport::JSON.decode params_json
|
17
17
|
)
|
18
18
|
|
19
|
-
controller.
|
20
|
-
controller.
|
19
|
+
allow_any_instance_of(controller).to receive(:transloadit?).and_return(true)
|
20
|
+
allow_any_instance_of(controller).to receive(:transloadit_params).and_return(hash)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -1,23 +1,24 @@
|
|
1
|
+
require 'action_controller'
|
1
2
|
require 'test_helper'
|
2
3
|
|
3
4
|
class InstallGeneratorTest < Rails::Generators::TestCase
|
4
5
|
tests Transloadit::Generators::InstallGenerator
|
5
6
|
destination File.expand_path('../../../tmp', __FILE__)
|
6
|
-
|
7
|
+
|
7
8
|
setup do
|
8
9
|
prepare_destination
|
9
10
|
end
|
10
|
-
|
11
|
+
|
11
12
|
test 'the Transloadit config file is installed' do
|
12
13
|
run_generator
|
13
|
-
|
14
|
+
|
14
15
|
assert_file 'config/transloadit.yml' do |contents|
|
15
16
|
assert_match /auth/, contents
|
16
17
|
assert_match /templates/, contents
|
17
18
|
end
|
18
19
|
end
|
19
|
-
|
20
|
+
|
20
21
|
test 'the namespace is transloadit:install' do
|
21
22
|
assert_equal 'transloadit:install', generator_class.namespace
|
22
23
|
end
|
23
|
-
end
|
24
|
+
end
|
data/test/test_helper.rb
CHANGED
data/transloadit-rails.gemspec
CHANGED
@@ -10,23 +10,27 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.authors = ['Stephen Touset', 'Robin Mehner']
|
11
11
|
gem.email = ['stephen@touset.org', 'robin@coding-robin.de']
|
12
12
|
gem.homepage = 'http://github.com/transloadit/rails-sdk/'
|
13
|
+
gem.license = 'MIT'
|
13
14
|
|
14
15
|
gem.summary = 'Official Rails gem for Transloadit'
|
15
16
|
gem.description = 'The transloadit-rails gem allows you to automate uploading files through the Transloadit REST API'
|
16
17
|
|
17
|
-
gem.required_rubygems_version = '>= 1.
|
18
|
-
gem.
|
18
|
+
gem.required_rubygems_version = '>= 2.1.0'
|
19
|
+
gem.required_ruby_version = '>= 2.1.0'
|
19
20
|
|
20
|
-
|
21
|
+
gem_ignored_files = `git ls-files examples`.split("\n")
|
22
|
+
gem.files = `git ls-files`.split("\n") - gem_ignored_files
|
21
23
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
24
|
gem.require_paths = %w{ lib }
|
23
25
|
|
24
|
-
gem.
|
26
|
+
gem.license = 'MIT'
|
27
|
+
|
28
|
+
gem.add_dependency 'transloadit', '>= 1.1.1'
|
25
29
|
gem.add_dependency 'railties', '>= 3'
|
30
|
+
gem.add_dependency 'mime-types'
|
26
31
|
|
27
32
|
gem.add_development_dependency 'rake'
|
28
|
-
gem.add_development_dependency '
|
29
|
-
gem.add_development_dependency 'simplecov'
|
33
|
+
gem.add_development_dependency 'test-unit'
|
30
34
|
|
31
35
|
gem.add_development_dependency 'yard'
|
32
36
|
gem.add_development_dependency 'kramdown' # for YARD rdoc formatting
|
metadata
CHANGED
@@ -1,127 +1,112 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transloadit-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 3.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Stephen Touset
|
9
8
|
- Robin Mehner
|
10
|
-
autorequire:
|
9
|
+
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2021-02-15 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: transloadit
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - ">="
|
21
19
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
20
|
+
version: 1.1.1
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - ">="
|
29
26
|
- !ruby/object:Gem::Version
|
30
|
-
version: 1.
|
27
|
+
version: 1.1.1
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: railties
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - ">="
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: '3'
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - ">="
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: '3'
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
43
|
+
name: mime-types
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
|
-
- -
|
46
|
+
- - ">="
|
53
47
|
- !ruby/object:Gem::Version
|
54
48
|
version: '0'
|
55
|
-
type: :
|
49
|
+
type: :runtime
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
|
-
- -
|
53
|
+
- - ">="
|
61
54
|
- !ruby/object:Gem::Version
|
62
55
|
version: '0'
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
|
-
name:
|
57
|
+
name: rake
|
65
58
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
59
|
requirements:
|
68
|
-
- -
|
60
|
+
- - ">="
|
69
61
|
- !ruby/object:Gem::Version
|
70
62
|
version: '0'
|
71
63
|
type: :development
|
72
64
|
prerelease: false
|
73
65
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
66
|
requirements:
|
76
|
-
- -
|
67
|
+
- - ">="
|
77
68
|
- !ruby/object:Gem::Version
|
78
69
|
version: '0'
|
79
70
|
- !ruby/object:Gem::Dependency
|
80
|
-
name:
|
71
|
+
name: test-unit
|
81
72
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
73
|
requirements:
|
84
|
-
- -
|
74
|
+
- - ">="
|
85
75
|
- !ruby/object:Gem::Version
|
86
76
|
version: '0'
|
87
77
|
type: :development
|
88
78
|
prerelease: false
|
89
79
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
80
|
requirements:
|
92
|
-
- -
|
81
|
+
- - ">="
|
93
82
|
- !ruby/object:Gem::Version
|
94
83
|
version: '0'
|
95
84
|
- !ruby/object:Gem::Dependency
|
96
85
|
name: yard
|
97
86
|
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
87
|
requirements:
|
100
|
-
- -
|
88
|
+
- - ">="
|
101
89
|
- !ruby/object:Gem::Version
|
102
90
|
version: '0'
|
103
91
|
type: :development
|
104
92
|
prerelease: false
|
105
93
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
94
|
requirements:
|
108
|
-
- -
|
95
|
+
- - ">="
|
109
96
|
- !ruby/object:Gem::Version
|
110
97
|
version: '0'
|
111
98
|
- !ruby/object:Gem::Dependency
|
112
99
|
name: kramdown
|
113
100
|
requirement: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
101
|
requirements:
|
116
|
-
- -
|
102
|
+
- - ">="
|
117
103
|
- !ruby/object:Gem::Version
|
118
104
|
version: '0'
|
119
105
|
type: :development
|
120
106
|
prerelease: false
|
121
107
|
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
108
|
requirements:
|
124
|
-
- -
|
109
|
+
- - ">="
|
125
110
|
- !ruby/object:Gem::Version
|
126
111
|
version: '0'
|
127
112
|
description: The transloadit-rails gem allows you to automate uploading files through
|
@@ -133,15 +118,20 @@ executables: []
|
|
133
118
|
extensions: []
|
134
119
|
extra_rdoc_files: []
|
135
120
|
files:
|
136
|
-
- .gitignore
|
137
|
-
- .travis.yml
|
121
|
+
- ".gitignore"
|
122
|
+
- ".travis.yml"
|
123
|
+
- CHANGELOG.md
|
138
124
|
- Gemfile
|
125
|
+
- LICENSE
|
139
126
|
- README.md
|
140
127
|
- Rakefile
|
141
128
|
- gemfiles/3.0.gemfile
|
142
129
|
- gemfiles/3.1.gemfile
|
143
130
|
- gemfiles/3.2.gemfile
|
144
131
|
- gemfiles/4.0.gemfile
|
132
|
+
- gemfiles/4.1.gemfile
|
133
|
+
- gemfiles/4.2.gemfile
|
134
|
+
- gemfiles/5.0.gemfile
|
145
135
|
- lib/generators/transloadit/install_generator.rb
|
146
136
|
- lib/templates/transloadit/transloadit.yml
|
147
137
|
- lib/transloadit-rails.rb
|
@@ -157,30 +147,26 @@ files:
|
|
157
147
|
- test/test_helper.rb
|
158
148
|
- transloadit-rails.gemspec
|
159
149
|
homepage: http://github.com/transloadit/rails-sdk/
|
160
|
-
licenses:
|
161
|
-
|
150
|
+
licenses:
|
151
|
+
- MIT
|
152
|
+
metadata: {}
|
153
|
+
post_install_message:
|
162
154
|
rdoc_options: []
|
163
155
|
require_paths:
|
164
156
|
- lib
|
165
157
|
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
-
none: false
|
167
158
|
requirements:
|
168
|
-
- -
|
159
|
+
- - ">="
|
169
160
|
- !ruby/object:Gem::Version
|
170
|
-
version:
|
161
|
+
version: 2.1.0
|
171
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
|
-
none: false
|
173
163
|
requirements:
|
174
|
-
- -
|
164
|
+
- - ">="
|
175
165
|
- !ruby/object:Gem::Version
|
176
|
-
version: 1.
|
166
|
+
version: 2.1.0
|
177
167
|
requirements: []
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
specification_version: 3
|
168
|
+
rubygems_version: 3.2.3
|
169
|
+
signing_key:
|
170
|
+
specification_version: 4
|
182
171
|
summary: Official Rails gem for Transloadit
|
183
|
-
test_files:
|
184
|
-
- test/generators/transloadit/test_install_generator.rb
|
185
|
-
- test/test_helper.rb
|
186
|
-
has_rdoc:
|
172
|
+
test_files: []
|