Class: Neuromancer::Indexer::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/neuromancer/indexer/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
# File 'lib/neuromancer/indexer/configuration.rb', line 12

def initialize
  @region = 'eu-central-1'
end

Instance Attribute Details

#access_key_idObject

Returns the value of attribute access_key_id.



10
11
12
# File 'lib/neuromancer/indexer/configuration.rb', line 10

def access_key_id
  @access_key_id
end

#regionObject

Returns the value of attribute region.



8
9
10
# File 'lib/neuromancer/indexer/configuration.rb', line 8

def region
  @region
end

#secret_access_keyObject

Returns the value of attribute secret_access_key.



10
11
12
# File 'lib/neuromancer/indexer/configuration.rb', line 10

def secret_access_key
  @secret_access_key
end

#sqs_urlObject

Returns the value of attribute sqs_url.



9
10
11
# File 'lib/neuromancer/indexer/configuration.rb', line 9

def sqs_url
  @sqs_url
end

Instance Method Details

#validate!Object

Raises:



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/neuromancer/indexer/configuration.rb', line 16

def validate!
  raise ConfigurationError, '\'region\' cannot be empty' if region.to_s.empty?

  raise ConfigurationError, '\'sqs_url\' cannot be empty' if sqs_url.to_s.empty?

  invalid_protocol = '\'sqs_url\' must be a HTTPS url'
  begin
    raise ConfigurationError, invalid_protocol if URI(sqs_url).scheme != 'https'
  rescue StandardError
    raise ConfigurationError, invalid_protocol
  end
end