transloadit-rails 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +3 -0
- data/LICENSE +1 -1
- data/README.md +46 -40
- data/lib/templates/transloadit/transloadit.yml +2 -2
- data/lib/transloadit/rails/version.rb +1 -1
- data/lib/transloadit/rspec/request_spec_helper.rb +2 -2
- data/transloadit-rails.gemspec +2 -2
- metadata +7 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a5465ec8511fb1f87cb094eec15a805b43b2ccf5e3a9bb13d80cab549bf2d6e0
|
4
|
+
data.tar.gz: b0776286a6bcb7957f0f8fc704616f1ce5b143582fd32cb6de41ddafed43fbd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea0e365469f83efc42a1de4e9c2a489f80c170b28c2a49a7ed1f8b0cb8a43b637b58b2f2b7803fb485f140f729e5ae5add8dc3c29ffda3d9a41cdddddc1cb6f1
|
7
|
+
data.tar.gz: 0037fc481dc8272cef796a60739ef5d17f7b4a6e80211d7fbcc82f734f1e64300c12e0ae752544b473f5ab0d9ee4149238bd29cfbf0946c14f801a7a22737921
|
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2021 Transloadit Ltd.
|
4
4
|
|
5
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
6
|
|
data/README.md
CHANGED
@@ -1,17 +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
|
-
you to automate uploading files through the Transloadit REST API.
|
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.
|
11
10
|
|
12
|
-
This
|
13
|
-
|
14
|
-
|
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).*
|
15
14
|
|
16
15
|
## Install
|
17
16
|
|
@@ -19,19 +18,16 @@ instead.
|
|
19
18
|
$ gem install transloadit-rails
|
20
19
|
```
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
To get started, you need to add the 'transloadit-rails' gem to your Rails
|
25
|
-
project's Gemfile.
|
21
|
+
or add the `transloadit-rails` Gem to your Rails project's `Gemfile` and update your bundle.
|
26
22
|
|
27
23
|
```bash
|
28
24
|
$ echo "gem 'transloadit-rails'" >> Gemfile
|
25
|
+
$ bundle install
|
29
26
|
```
|
30
27
|
|
31
|
-
|
28
|
+
After installation you need to run the `transloadit:install` generator to complete the setup.
|
32
29
|
|
33
30
|
```bash
|
34
|
-
$ bundle install
|
35
31
|
$ rails g transloadit:install
|
36
32
|
```
|
37
33
|
|
@@ -44,13 +40,13 @@ the upload forms.
|
|
44
40
|
|
45
41
|
```yaml
|
46
42
|
auth:
|
47
|
-
key : '
|
48
|
-
secret : '
|
43
|
+
key : 'TRANSLOADIT_KEY'
|
44
|
+
secret : 'TRANSLOADIT_SECRET' # optional, but highly recommended
|
49
45
|
duration: 1800 # 30 minute validity period for signed upload forms
|
50
46
|
|
51
47
|
templates:
|
52
48
|
# template identified by template_id
|
53
|
-
s3_store: '
|
49
|
+
s3_store: 'YOUR_TEMPLATE_ID'
|
54
50
|
|
55
51
|
# template defined inline
|
56
52
|
image_resize:
|
@@ -73,42 +69,28 @@ exactly in order to be used.
|
|
73
69
|
```yaml
|
74
70
|
development:
|
75
71
|
auth:
|
76
|
-
key : '
|
72
|
+
key : 'TRANSLOADIT_KEY'
|
77
73
|
...
|
78
74
|
|
79
75
|
templates:
|
80
|
-
s3_store: '
|
76
|
+
s3_store: 'YOUR_TEMPLATE_ID'
|
81
77
|
...
|
82
78
|
|
83
79
|
production:
|
84
80
|
auth:
|
85
|
-
key : '
|
81
|
+
key : 'TRANSLOADIT_KEY'
|
86
82
|
...
|
87
83
|
|
88
84
|
templates:
|
89
|
-
s3_store: '
|
90
|
-
...
|
91
|
-
```
|
92
|
-
|
93
|
-
## Support IE6 or jQuery < 1.9
|
94
|
-
|
95
|
-
If you have to support IE6 and use a jQuery version below 1.9, you have to change
|
96
|
-
the jquery_sdk_version in the config to 'v1.0.0':
|
97
|
-
|
98
|
-
```yaml
|
99
|
-
production:
|
100
|
-
jquery_sdk_version: 'v1.0.0'
|
101
|
-
auth:
|
85
|
+
s3_store: 'YOUR_TEMPLATE_ID'
|
102
86
|
...
|
103
87
|
```
|
104
88
|
|
105
89
|
## Usage
|
106
90
|
|
107
|
-
Refer to the
|
108
|
-
and loads the [Transloadit jQuery plugin](https://github.com/transloadit/jquery-sdk).
|
109
|
-
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.
|
110
92
|
|
111
|
-
```
|
93
|
+
```html
|
112
94
|
<%= form_for :upload, :html => { :id => 'upload' } do |form| %>
|
113
95
|
<%= transloadit :s3_store %>
|
114
96
|
<%= form.label :file, 'File to upload' %>
|
@@ -116,11 +98,16 @@ It also uses JavaScript to ensure your form is encoded as `multipart/form-data`.
|
|
116
98
|
<%= form.submit %>
|
117
99
|
<% end %>
|
118
100
|
|
101
|
+
<%= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' %>
|
119
102
|
<%= transloadit_jquerify :upload %>
|
120
103
|
```
|
121
104
|
|
122
|
-
|
123
|
-
|
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
|
124
111
|
|
125
112
|
```ruby
|
126
113
|
class YourController
|
@@ -128,7 +115,10 @@ class YourController
|
|
128
115
|
end
|
129
116
|
```
|
130
117
|
|
131
|
-
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.
|
132
122
|
|
133
123
|
## Tutorial
|
134
124
|
|
@@ -255,6 +245,10 @@ Then go to http://localhost:3000/uploads/new, and upload an image. If you did
|
|
255
245
|
everything right, you should see the uploaded and resized file as soon as the
|
256
246
|
upload finishes.
|
257
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
|
+
|
258
252
|
## Testing
|
259
253
|
|
260
254
|
### RSpec request specs
|
@@ -301,6 +295,18 @@ if you need support for older Ruby versions.
|
|
301
295
|
|
302
296
|
Testing against these versions is performed automatically by [Travis CI](https://travis-ci.org/transloadit/rails-sdk).
|
303
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
|
+
|
304
310
|
## License
|
305
311
|
|
306
312
|
MIT, see [LICENSE](LICENSE)
|
@@ -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: '
|
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: '
|
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
|
@@ -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
|
data/transloadit-rails.gemspec
CHANGED
@@ -17,9 +17,9 @@ Gem::Specification.new do |gem|
|
|
17
17
|
|
18
18
|
gem.required_rubygems_version = '>= 2.1.0'
|
19
19
|
gem.required_ruby_version = '>= 2.1.0'
|
20
|
-
gem.rubyforge_project = 'transloadit-rails'
|
21
20
|
|
22
|
-
|
21
|
+
gem_ignored_files = `git ls-files examples`.split("\n")
|
22
|
+
gem.files = `git ls-files`.split("\n") - gem_ignored_files
|
23
23
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
24
24
|
gem.require_paths = %w{ lib }
|
25
25
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transloadit-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Touset
|
8
8
|
- Robin Mehner
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: transloadit
|
@@ -150,7 +150,7 @@ homepage: http://github.com/transloadit/rails-sdk/
|
|
150
150
|
licenses:
|
151
151
|
- MIT
|
152
152
|
metadata: {}
|
153
|
-
post_install_message:
|
153
|
+
post_install_message:
|
154
154
|
rdoc_options: []
|
155
155
|
require_paths:
|
156
156
|
- lib
|
@@ -165,12 +165,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 2.1.0
|
167
167
|
requirements: []
|
168
|
-
|
169
|
-
|
170
|
-
signing_key:
|
168
|
+
rubygems_version: 3.2.3
|
169
|
+
signing_key:
|
171
170
|
specification_version: 4
|
172
171
|
summary: Official Rails gem for Transloadit
|
173
|
-
test_files:
|
174
|
-
- test/generators/transloadit/test_install_generator.rb
|
175
|
-
- test/test_helper.rb
|
176
|
-
has_rdoc:
|
172
|
+
test_files: []
|