Class: StatusCat::Checkers::ActionMailer

Inherits:
Base
  • Object
show all
Defined in:
lib/status_cat/checkers/action_mailer.rb

Constant Summary

Constants inherited from Base

Base::FORMAT

Instance Attribute Summary

Attributes inherited from Base

#status, #value

Instance Method Summary collapse

Methods inherited from Base

class_to_name, #name, #to_s

Constructor Details

#initializeActionMailer

Returns a new instance of ActionMailer.



5
6
7
8
9
# File 'lib/status_cat/checkers/action_mailer.rb', line 5

def initialize
  @value = "#{address}:#{port}"
  return if ::ActionMailer::Base.delivery_method == :test
  @status = fail_on_exception { test }
end

Instance Method Details

#addressObject



22
23
24
# File 'lib/status_cat/checkers/action_mailer.rb', line 22

def address
  return config[:address]
end

#authenticationObject



26
27
28
# File 'lib/status_cat/checkers/action_mailer.rb', line 26

def authentication
  return config[:authentication]
end

#configObject



18
19
20
# File 'lib/status_cat/checkers/action_mailer.rb', line 18

def config
  @config ||= ::ActionMailer::Base.smtp_settings
end

#domainObject



30
31
32
# File 'lib/status_cat/checkers/action_mailer.rb', line 30

def domain
  return config[:domain]
end

#passwordObject



34
35
36
# File 'lib/status_cat/checkers/action_mailer.rb', line 34

def password
  return config[:password]
end

#portObject



38
39
40
# File 'lib/status_cat/checkers/action_mailer.rb', line 38

def port
  return config[:port]
end

#testObject



11
12
13
14
15
16
# File 'lib/status_cat/checkers/action_mailer.rb', line 11

def test
  Net::SMTP.start(address, port, domain, user_name, password, authentication) do |smtp|
    smtp.helo(domain)
  end
  return nil
end

#user_nameObject



42
43
44
# File 'lib/status_cat/checkers/action_mailer.rb', line 42

def user_name
  return config[:user_name]
end