Class: SQS::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/sqs/config.rb

Overview

SQS::Config stores your AWS access_key and secret_access_key. These attributes raise exceptions if they are checked but have not been set.

Constant Summary collapse

@@access_key =
nil
@@secret_access_key =
nil

Class Method Summary collapse

Class Method Details

.access_keyObject

Raises:

  • (ArgumentError)


15
16
17
18
# File 'lib/sqs/config.rb', line 15

def self.access_key
  raise ArgumentError, "No access key defined!" if @@access_key.nil?
  return @@access_key
end

.parse(yaml_hash) ⇒ Object

Load configuration from a YAML::load-generated hash



26
27
28
29
# File 'lib/sqs/config.rb', line 26

def self.parse yaml_hash
  self.access_key = yaml_hash['access_key'] unless yaml_hash['access_key'].nil? || yaml_hash['access_key'].empty?
  self.secret_access_key = yaml_hash['secret_access_key'] unless yaml_hash['secret_access_key'].nil? || yaml_hash['secret_access_key'].empty?
end

.secret_access_keyObject

Raises:

  • (ArgumentError)


20
21
22
23
# File 'lib/sqs/config.rb', line 20

def self.secret_access_key
  raise ArgumentError, "No secret access key defined!" if @@secret_access_key.nil?
  return @@secret_access_key
end