Class: Checkson::Check::Certificate

Inherits:
Base
  • Object
show all
Defined in:
lib/checkson/checks/certificate.rb

Instance Attribute Summary

Attributes inherited from Base

#messages, #status

Instance Method Summary collapse

Methods inherited from Base

#failed?, #ok?

Constructor Details

#initialize(opts = {}) ⇒ Certificate

Returns a new instance of Certificate.



6
7
8
9
10
# File 'lib/checkson/checks/certificate.rb', line 6

def initialize(opts = {})
  @opts = (@opts || {}).merge(opts)
  @opts[:port] ||= 443
  super()
end

Instance Method Details

#checkObject

Raises:

  • (ArgumentError)


12
13
14
15
16
# File 'lib/checkson/checks/certificate.rb', line 12

def check
  raise ArgumentError, 'No options given' unless @opts[:domain] && @opts[:port] || @opts[:certfile] || @opts[:leftdays]

  @opts[:domain] ? http_check : file_check
end