effective_assets 1.9.9 → 1.9.10
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 +6 -0
- data/app/models/effective/asset.rb +7 -6
- data/app/uploaders/effective_assets_uploader.rb +1 -1
- data/lib/effective_assets/version.rb +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: d9f34cc6c231fc5a0e0fd39376ac231dd7f89423
|
4
|
+
data.tar.gz: 966f600d4f9f57a426436859291b9cfab2507a27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfcc2942bf0a5160758a2cbd542309ed66ebf8e6f52923efe4e59234977d1664b41f4678f7ee26dccd9dc88bb667e25da2e1767c3decf9c130852164edf5ff3d
|
7
|
+
data.tar.gz: ea43db44ef5ec857b4890f4608ae43facc1ef212fba8cf4d291c672ed5f5ec77c9149fa1c21e089e67af190b7acb3989184a05bb50529c98ca0b622594e59cb5
|
data/README.md
CHANGED
@@ -186,6 +186,12 @@ asset.url
|
|
186
186
|
asset.url(:thumb) # See image versions (below)
|
187
187
|
=> "http://aws_bucket.s3.amazonaws.com/assets/1/thumb_my_avatar.png"
|
188
188
|
|
189
|
+
asset.authenticated_url # See image versions (below)
|
190
|
+
=> "http://aws_bucket.s3.amazonaws.com/assets/1/thumb_my_avatar.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-...""
|
191
|
+
|
192
|
+
asset.authenticated_url(:thumb, expire_in: 10.minutes)
|
193
|
+
=> "http://aws_bucket.s3.amazonaws.com/assets/1/thumb_my_avatar.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-...""
|
194
|
+
|
189
195
|
user.photos
|
190
196
|
=> [Effective::Asset<1>, Effective::Asset<2>] # An array of Effective::Asset objects
|
191
197
|
```
|
@@ -137,8 +137,8 @@ module Effective
|
|
137
137
|
self[:extra] || {}
|
138
138
|
end
|
139
139
|
|
140
|
-
def url(version = nil, expire_in
|
141
|
-
aws_acl == EffectiveAssets::AWS_PRIVATE ? authenticated_url(version, expire_in) : public_url(version)
|
140
|
+
def url(version = nil, expire_in: nil)
|
141
|
+
aws_acl == EffectiveAssets::AWS_PRIVATE ? authenticated_url(version, expire_in: expire_in) : public_url(version)
|
142
142
|
end
|
143
143
|
|
144
144
|
def public_url(version = nil)
|
@@ -150,10 +150,11 @@ module Effective
|
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
|
-
def authenticated_url(version = nil, expire_in
|
154
|
-
data.
|
155
|
-
|
156
|
-
|
153
|
+
def authenticated_url(version = nil, expire_in: nil)
|
154
|
+
if data.present?
|
155
|
+
data.aws_authenticated_url_expiration = (expire_in || 60.minutes).to_i
|
156
|
+
(version.present? ? data.send(version).file.try(:authenticated_url) : data.file.try(:authenticated_url))
|
157
|
+
end || '#'
|
157
158
|
end
|
158
159
|
|
159
160
|
def file_name
|
@@ -18,7 +18,7 @@ class EffectiveAssetsUploader < CarrierWave::Uploader::Base
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def aws_authenticated_url_expiration
|
21
|
-
@aws_authenticated_url_expiration || 10.minutes
|
21
|
+
@aws_authenticated_url_expiration || 10.minutes.to_i
|
22
22
|
end
|
23
23
|
|
24
24
|
def aws_authenticated_url_expiration=(expires_in)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|