shrine-imgix 0.3.1 → 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 +8 -5
- data/lib/shrine/storage/imgix.rb +4 -1
- data/shrine-imgix.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 077f2403f448cca03b52cf8e1f07b6915366f557
|
|
4
|
+
data.tar.gz: 72e3f20d5fdd812118dcfd9aea342df7130c0d88
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 905d474af4adbbd70b153fbecf3bcbd479c46f7b8e970c4002ca422b2ba16d3dce2ea2bcfd025ca4df6539b44f340b284a841b2f2047d8713e72ec983a34fd71
|
|
7
|
+
data.tar.gz: ec78d945b2506971686faf734139ecbb2bf761681c361d61c09433e29dc6364df9d964541018d7bd3ad6ef45c1a9f1a4b85a8541017c52314ac7ee52cd4a9463
|
data/README.md
CHANGED
|
@@ -24,16 +24,19 @@ require "shrine/storage/s3"
|
|
|
24
24
|
|
|
25
25
|
imgix = Shrine::Storage::Imgix.new(
|
|
26
26
|
storage: Shrine::Storage::S3.new(**s3_options),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
include_prefix: true, # set to false if you have prefix configured in Imgix source
|
|
28
|
+
api_key: "xzy123", #
|
|
29
|
+
host: "my-subdomain.imgix.net", # Imgix::Client options
|
|
30
|
+
secure_url_token: "abc123", # optional #
|
|
30
31
|
)
|
|
31
32
|
|
|
32
33
|
Shrine.storages[:store] = imgix
|
|
33
34
|
```
|
|
34
35
|
|
|
35
|
-
All options other than `:storage` are used for
|
|
36
|
-
|
|
36
|
+
All options other than `:storage` and `:include_prefix` are used for
|
|
37
|
+
instantiating an `Imgix::Client`, see the [imgix] gem for information about all
|
|
38
|
+
possible options. The `:include_prefix` option decides whether the `#prefix`
|
|
39
|
+
of the underlying storage will be included in the generated Imgix URLs.
|
|
37
40
|
|
|
38
41
|
All storage actions are forwarded to the main storage, and deleted files are
|
|
39
42
|
automatically purged from Imgix. The only method that the Imgix storage
|
data/lib/shrine/storage/imgix.rb
CHANGED
|
@@ -12,10 +12,11 @@ class Shrine
|
|
|
12
12
|
# We initialize the Imgix client, and save the storage. We additionally
|
|
13
13
|
# save the token as well, because `Imgix::Client` doesn't provide a
|
|
14
14
|
# reader for the token.
|
|
15
|
-
def initialize(storage:, **options)
|
|
15
|
+
def initialize(storage:, include_prefix: false, **options)
|
|
16
16
|
@client = ::Imgix::Client.new(options)
|
|
17
17
|
@api_key = options.fetch(:api_key)
|
|
18
18
|
@storage = storage
|
|
19
|
+
@include_prefix = include_prefix
|
|
19
20
|
|
|
20
21
|
instance_eval do
|
|
21
22
|
# Purges the file from the source storage after moving it.
|
|
@@ -65,6 +66,8 @@ class Shrine
|
|
|
65
66
|
#
|
|
66
67
|
# [reference]: https://www.imgix.com/docs/reference
|
|
67
68
|
def url(id, **options)
|
|
69
|
+
id = [*@storage.prefix, id].join("/") if @include_prefix
|
|
70
|
+
|
|
68
71
|
client.path(id).to_url(**options)
|
|
69
72
|
end
|
|
70
73
|
|
data/shrine-imgix.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shrine-imgix
|
|
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: 2017-04-
|
|
11
|
+
date: 2017-04-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: shrine
|