Module: LetterOpenerWebS3

Defined in:
lib/letter_opener_web_s3.rb,
lib/letter_opener_web_s3/version.rb

Defined Under Namespace

Modules: LetterExtension, MessageExtension Classes: S3ConfigError, S3CredentialsError

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.bucketObject

Raises:



37
38
39
40
41
42
43
44
45
# File 'lib/letter_opener_web_s3.rb', line 37

def bucket
  raise S3ConfigError if !s3_config.is_a?(Hash) ||
      (s3_config.keys & [:region, :bucket_name, :access_key_id, :secret_access_key]).size != 4
  return @bucket if @bucket
  @s3 = Aws::S3::Resource.new s3_config.slice(:region, :access_key_id, :secret_access_key)
  credentials = @s3.client.config.credentials
  raise S3CredentialsError unless credentials
  @bucket = @s3.bucket s3_config[:bucket_name]
end

.configure {|_self| ... } ⇒ Object

Sets up an S3 backend

Yields:

  • (_self)

Yield Parameters:

See Also:



33
34
35
# File 'lib/letter_opener_web_s3.rb', line 33

def configure
  yield self
end