shrine-transloadit 0.3.0 → 0.4.0
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/README.md +40 -24
- data/lib/shrine/plugins/transloadit.rb +0 -5
- data/shrine-transloadit.gemspec +1 -2
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f6c9f75eb5ae136a186f42f8b3e255b37e75922
|
4
|
+
data.tar.gz: e25b2ed74f6e742c82539a86b8f9814497978947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0279efcd3b9de0a223f258e03cb1689490d9f84225ce43fce35b9b7f8e3cd78514577bdcfe09d40e252b50e69a3135cf0be575ec32e2d6a7dd2217933988598
|
7
|
+
data.tar.gz: bb661843d2b3886a66aaca015d98eb6caef0317b1a6171d3581b008c0d2fbec1f5249ec9671d36b6b8c0ce0447ab98e0bf29a0c912e2ded7014a164a41ae34d8
|
data/README.md
CHANGED
@@ -8,40 +8,41 @@ to various file storage services.
|
|
8
8
|
|
9
9
|
## Setup
|
10
10
|
|
11
|
-
While Transloadit is able to export processed files to [many storage
|
12
|
-
|
13
|
-
|
11
|
+
While Transloadit is able to export processed files to [many storage services],
|
12
|
+
this plugin currently supports only Amazon S3 (just because there are no Shrine
|
13
|
+
integrations written for other services on that list yet). You can just add
|
14
|
+
shrine-transloadit to your current setup:
|
14
15
|
|
15
16
|
```rb
|
17
|
+
gem "shrine"
|
18
|
+
gem "aws-sdk" # for Amazon S3
|
16
19
|
gem "shrine-transloadit"
|
17
|
-
gem "aws-sdk"
|
18
20
|
```
|
19
21
|
|
20
22
|
```rb
|
21
23
|
require "shrine"
|
22
24
|
require "shrine/storage/s3"
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
auth_secret: "your transloadit secret"
|
27
|
-
|
28
|
-
Shrine.storages[:store] = Shrine::Storage::S3.new(
|
29
|
-
access_key_id: "xyz",
|
30
|
-
secret_access_key: "abc",
|
26
|
+
s3_options = {
|
27
|
+
bucket: "my-bucket",
|
31
28
|
region: "my-region",
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
access_key_id: "abc",
|
30
|
+
secret_access_key: "xyz",
|
31
|
+
}
|
35
32
|
|
36
|
-
|
37
|
-
|
38
|
-
Shrine::
|
39
|
-
|
33
|
+
Shrine.storages = {
|
34
|
+
cache: Shrine::Storage::S3.new(prefix: "cache", **s3_options),
|
35
|
+
store: Shrine::Storage::S3.new(prefix: "store", **s3_options),
|
36
|
+
}
|
37
|
+
|
38
|
+
Shrine.plugin :transloadit,
|
39
|
+
auth_key: "your transloadit key",
|
40
|
+
auth_secret: "your transloadit secret"
|
40
41
|
```
|
41
42
|
|
42
|
-
This setup assumes you
|
43
|
-
Transloadit
|
44
|
-
|
43
|
+
This setup assumes you're doing direct S3 uploads, but you can also do [direct
|
44
|
+
uploads to Transloadit], or just use any other `:cache` storage which provides
|
45
|
+
URLs for uploaded files.
|
45
46
|
|
46
47
|
## How it works
|
47
48
|
|
@@ -115,9 +116,22 @@ only want to do some light processing on direct uploads, and without any
|
|
115
116
|
exporting, so that you have better control over your Transloadit bandwidth.
|
116
117
|
|
117
118
|
When direct upload finishes, Transloadit returns information about the uploaded
|
118
|
-
file(s)
|
119
|
-
|
120
|
-
|
119
|
+
file(s), one of which is a temporary URL to the file. You want to save this URL
|
120
|
+
as cached attachment, so that you can display it to the user and use it for
|
121
|
+
further Transloadit processing. You can do that using [shrine-url]:
|
122
|
+
|
123
|
+
```rb
|
124
|
+
gem "shrine-url"
|
125
|
+
```
|
126
|
+
|
127
|
+
```rb
|
128
|
+
require "shrine/storage/url"
|
129
|
+
Shrine.storages[:cache] = Shrine::Storage::Url.new
|
130
|
+
```
|
131
|
+
|
132
|
+
Now when you obtain results from finished direct uploads on the client-side,
|
133
|
+
you need to transform the Transloadit hash into Shrine's uploaded file
|
134
|
+
representation, using the URL as the "id":
|
121
135
|
|
122
136
|
```js
|
123
137
|
{
|
@@ -407,3 +421,5 @@ $ bundle exec rake test
|
|
407
421
|
[templates]: https://transloadit.com/docs/#templates
|
408
422
|
[jQuery plugin]: https://github.com/transloadit/jquery-sdk
|
409
423
|
[demo app]: /demo
|
424
|
+
[direct uploads to Transloadit]: #direct-uploads
|
425
|
+
[shrine-url]: https://github.com/janko-m/shrine-url
|
@@ -21,11 +21,6 @@ class Shrine
|
|
21
21
|
raise Error, "The :auth_key is required for transloadit plugin" if uploader.opts[:transloadit_auth_key].nil?
|
22
22
|
raise Error, "The :auth_secret is required for transloadit plugin" if uploader.opts[:transloadit_auth_secret].nil?
|
23
23
|
|
24
|
-
uploader.storages[:cache] ||= (
|
25
|
-
require "shrine/storage/url"
|
26
|
-
Shrine::Storage::Url.new
|
27
|
-
)
|
28
|
-
|
29
24
|
uploader.opts[:backgrounding_promote] ||= proc { transloadit_process }
|
30
25
|
end
|
31
26
|
|
data/shrine-transloadit.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "shrine-transloadit"
|
3
|
-
gem.version = "0.
|
3
|
+
gem.version = "0.4.0"
|
4
4
|
|
5
5
|
gem.required_ruby_version = ">= 2.1"
|
6
6
|
|
@@ -15,7 +15,6 @@ Gem::Specification.new do |gem|
|
|
15
15
|
|
16
16
|
gem.add_dependency "shrine", "~> 2.1"
|
17
17
|
gem.add_dependency "transloadit", "~> 1.2"
|
18
|
-
gem.add_dependency "shrine-url"
|
19
18
|
|
20
19
|
gem.add_development_dependency "rake"
|
21
20
|
gem.add_development_dependency "minitest"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shrine-transloadit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shrine
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.2'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: shrine-url
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rake
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|