effective_assets 1.9.9 → 1.9.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a5ec4c3fd08df8fd4fa4746c988c05a71bbeeb7
4
- data.tar.gz: 2790762d8b17b592c521799b6ff6ae80fe9322f7
3
+ metadata.gz: d9f34cc6c231fc5a0e0fd39376ac231dd7f89423
4
+ data.tar.gz: 966f600d4f9f57a426436859291b9cfab2507a27
5
5
  SHA512:
6
- metadata.gz: db6ff9491afe90ff7c22103317cbeae96327537ec82c39765a02ef218b6e67191556bfbc40d483e016d63f0ab467583bdd5048fed13cbfa3663bc9aa0bd8d3d0
7
- data.tar.gz: 42a04fdcf8d9b682aa869ee976e0ace7f76e8674c8ee5fc3388b498c865c3fa0aafce4775910adb89839edbe7713d0440c247a44f5c345ac67334674eff8c39c
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 = nil)
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 = 60.minutes)
154
- data.aws_authenticated_url_expiration = expire_in
155
- url = (version.present? ? data.send(version).file.try(:authenticated_url) : data.file.try(:authenticated_url))
156
- url || '#'
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)
@@ -1,3 +1,3 @@
1
1
  module EffectiveAssets
2
- VERSION = '1.9.9'.freeze
2
+ VERSION = '1.9.10'.freeze
3
3
  end
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.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-08-18 00:00:00.000000000 Z
11
+ date: 2017-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails