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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69e426ccc7c2a724b60027cf34434b191c1eadc8
4
- data.tar.gz: d2a161c47f4b9d9af11dc8aaa02f698a4b3d8a10
3
+ metadata.gz: 207d954bfd2b94304506da7862d0e549cdd39341
4
+ data.tar.gz: 3fe7b945a003b6534fd42b0a6ac429abf2d2ff2a
5
5
  SHA512:
6
- metadata.gz: 2cff56b051bf47e4c84c5d7be25a404dc60801fda1e45d3988ea4fa7c55ae29dd52d3bf716073038d6bb79f8786b89247e34ce9f3394e32b20ed58e0d37d48f9
7
- data.tar.gz: 41c06c0c4252e30948b327ac9efbcca69c6765d65b548b4ec0bba05cfd436b5f61b410cda1d62ec506e55b9afabfb5a177cd34a6253cb984f7fb82f1bffdeefb
6
+ metadata.gz: debbcb6a0033e0dd5f52a173774614ef5a1023afa4f4e7007800db61a48d9785738fc41e97851b6e6b1fc3abd3d5e86bda70b4ab04445c9f142aeaaee41de94d
7
+ data.tar.gz: 8f03fbadc42188cd810095f54b287b8c687fb9e5d3590a153cc9d5f131e1ca35662731ebfee16d3cd5eaf27c360cbc1900b35906438985fb40d7033b55dd64d4
@@ -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
- http_verb: HTTP_PUT,
88
- date: 1.hours.from_now.to_i,
89
- resource: "/#{Cognac.aws_s3_bucket}/#{file_name}",
90
- content_type: content_type
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
@@ -1,3 +1,3 @@
1
1
  module Cognac
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cognac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bala Paranj