Class: AwsTickwork::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/aws_tickwork/engine.rb

Defined Under Namespace

Classes: ValidationError

Class Method Summary collapse

Class Method Details

.clear!Object



40
41
42
43
44
45
# File 'lib/aws_tickwork/engine.rb', line 40

def self.clear!
  self.https_only = false
  self.enable_authenticate = true
  self.http_username = nil
  self.http_password = nil
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



18
19
20
21
# File 'lib/aws_tickwork/engine.rb', line 18

def self.setup(&block)
  yield self
  validate_config(self)
end

.validate_config(config) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/aws_tickwork/engine.rb', line 23

def self.validate_config(config)
  unless http_password.present? == http_username.present?
    raise AwsTickwork::Engine::ValidationError.new 'http_password requires http_user, and visa versa'
  end
  if http_username.present? && !https_only
    raise AwsTickwork::Engine::ValidationError.new 'use only https with authentication or else the password is sent in the clear'
  end
end