module MovieMasher::AwsHelper

included by all aws service instances

Attributes

__s3[RW]
__s3_resource[RW]
__sqs[RW]

Public Instance Methods

__require_sdk() click to toggle source
# File service/aws/aws_helper.rb, line 50
def __require_sdk
  require 'aws-sdk' unless defined?(Aws)
end
aws_configuration() click to toggle source
# File service/aws/aws_helper.rb, line 11
def aws_configuration
  prefixed_configuration('aws_', configuration)
end
prefixed_configuration(key, hash) click to toggle source
# File service/aws/aws_helper.rb, line 15
def prefixed_configuration(key, hash)
  config = {}
  hash.each do |k, value|
    k_str = k.id2name
    next unless k_str.start_with?(key)
    next if value.to_s.empty?
    k_str[key] = ''
    config[k_str.to_sym] = value
  end
  config
end
s3_client() click to toggle source
# File service/aws/aws_helper.rb, line 27
def s3_client
  __require_sdk
  AwsHelper.__s3 ||= Aws::S3::Client.new(s3_configuration)
end
s3_configuration() click to toggle source
# File service/aws/aws_helper.rb, line 37
def s3_configuration
  aws_configuration.merge(prefixed_configuration('s3_', configuration))
end
s3_resource() click to toggle source
# File service/aws/aws_helper.rb, line 32
def s3_resource
  __require_sdk
  AwsHelper.__s3_resource ||= Aws::S3::Resource.new(s3_configuration)
end
sqs_client() click to toggle source
# File service/aws/aws_helper.rb, line 41
def sqs_client
  __require_sdk
  AwsHelper.__sqs ||= Aws::SQS::Client.new(sqs_configuration)
end
sqs_configuration() click to toggle source
# File service/aws/aws_helper.rb, line 46
def sqs_configuration
  aws_configuration.merge(prefixed_configuration('sqs_', configuration))
end