anaconda 0.9.10 → 0.10.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.markdown +8 -1
- data/lib/anaconda/anaconda.rb +1 -1
- data/lib/anaconda/anaconda_for.rb +11 -0
- data/lib/anaconda/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 830e53717f29f2229e104f5fedbe270bf7ae0fec
|
4
|
+
data.tar.gz: 744677a55ffeb7cfe4f8ff5590aa67b2eb6f5031
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9287ef9d60d71561104edb806c5f571a0729fb55831286e21a287e191402d932fab6d135645f00f3c6233cf27a7dcf7eb8749f221f7251249001c3010b66852f
|
7
|
+
data.tar.gz: 1d31ca5e855d8a361752685e2b0add17ca3faddb2c4a2913d95607d86935f7c5ac4b9380dafb8da85226b9bad7fb64b973bf4ddd03517c47c71b534569fdf841
|
data/README.markdown
CHANGED
@@ -149,9 +149,16 @@ We highly recommend the `figaro` gem [https://github.com/laserlemon/figaro](http
|
|
149
149
|
* :asset_type
|
150
150
|
* :asset_url
|
151
151
|
|
152
|
-
The magic
|
152
|
+
The magic methods are asset_url and asset_download_url.
|
153
|
+
|
154
|
+
`asset_url` will return a signed S3 URL if the file is stored with an ACL of `private` and will return a non-signed URL if the file is stored with public access.
|
155
|
+
|
156
|
+
`asset_download_url` will return a signed S3 URL with content-disposition set to attachment so the file will be downloaded instead of opened in the browser.
|
153
157
|
|
154
158
|
## Changelog
|
159
|
+
* 0.10.0
|
160
|
+
* Add `download_url` magic method that uses content-disposition to force the browser to download the URL. This is a signed AWS url that is only valid for 1 hour
|
161
|
+
|
155
162
|
* 0.9.10
|
156
163
|
* Fix bug when attribute had more than one underscore
|
157
164
|
|
data/lib/anaconda/anaconda.rb
CHANGED
@@ -55,6 +55,8 @@ module Anaconda
|
|
55
55
|
case checking_method
|
56
56
|
when :url
|
57
57
|
anaconda_url(checking_column)
|
58
|
+
when :download_url
|
59
|
+
anaconda_download_url(checking_column)
|
58
60
|
else
|
59
61
|
super
|
60
62
|
end
|
@@ -77,6 +79,15 @@ module Anaconda
|
|
77
79
|
end
|
78
80
|
end
|
79
81
|
|
82
|
+
def anaconda_download_url(column_name)
|
83
|
+
return nil unless send("#{column_name}_file_path").present?
|
84
|
+
|
85
|
+
options = {query: {"response-content-disposition" => "attachment;"}}
|
86
|
+
aws = Fog::Storage.new({:provider => 'AWS', :aws_access_key_id => Anaconda.aws[:aws_access_key], :aws_secret_access_key => Anaconda.aws[:aws_secret_key]})
|
87
|
+
aws.get_object_https_url(Anaconda.aws[:aws_bucket], send("#{column_name}_file_path"), 1.hour.from_now, options)
|
88
|
+
|
89
|
+
end
|
90
|
+
|
80
91
|
def anaconda_protocol(column_name)
|
81
92
|
case self.anaconda_options[column_name.to_sym][:protocol]
|
82
93
|
when :auto
|
data/lib/anaconda/version.rb
CHANGED