cognac 0.2.0 → 0.2.1
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/lib/cognac/signature.rb +17 -6
- data/lib/cognac/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: 207d954bfd2b94304506da7862d0e549cdd39341
|
|
4
|
+
data.tar.gz: 3fe7b945a003b6534fd42b0a6ac429abf2d2ff2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: debbcb6a0033e0dd5f52a173774614ef5a1023afa4f4e7007800db61a48d9785738fc41e97851b6e6b1fc3abd3d5e86bda70b4ab04445c9f142aeaaee41de94d
|
|
7
|
+
data.tar.gz: 8f03fbadc42188cd810095f54b287b8c687fb9e5d3590a153cc9d5f131e1ca35662731ebfee16d3cd5eaf27c360cbc1900b35906438985fb40d7033b55dd64d4
|
data/lib/cognac/signature.rb
CHANGED
|
@@ -38,6 +38,14 @@ module Cognac
|
|
|
38
38
|
HTTP_PUT = "PUT"
|
|
39
39
|
|
|
40
40
|
def initialize(options = {})
|
|
41
|
+
if Cognac.secret_access_key.nil?
|
|
42
|
+
raise 'AWS Secret access key is not initialized. Refer README.md at https://bitbucket.org/bparanj/cognac'
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
if Cognac.aws_access_key.nil?
|
|
46
|
+
raise 'AWS access key is not initialized. Refer README.md at https://bitbucket.org/bparanj/cognac'
|
|
47
|
+
end
|
|
48
|
+
|
|
41
49
|
@secret_access_key = Cognac.secret_access_key
|
|
42
50
|
@aws_access_key = Cognac.aws_access_key
|
|
43
51
|
@options = options
|
|
@@ -83,12 +91,15 @@ module Cognac
|
|
|
83
91
|
# This is called in the controller and passed in to the build_s3_upload_url method as a parameter
|
|
84
92
|
# Hide this method
|
|
85
93
|
def generate_options_for_build_s3_upload_url(file_name, content_type)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
if Cognac.aws_s3_bucket.nil?
|
|
95
|
+
raise 'AWS S3 Bucket is not initialized. Refer README.md at https://bitbucket.org/bparanj/cognac'
|
|
96
|
+
end
|
|
97
|
+
{
|
|
98
|
+
http_verb: HTTP_PUT,
|
|
99
|
+
date: 1.hours.from_now.to_i,
|
|
100
|
+
resource: "/#{Cognac.aws_s3_bucket}/#{file_name}",
|
|
101
|
+
content_type: content_type
|
|
102
|
+
}
|
|
92
103
|
end
|
|
93
104
|
|
|
94
105
|
private
|
data/lib/cognac/version.rb
CHANGED