Class: InternetSecurityEvent::X509Status

Inherits:
Object
  • Object
show all
Defined in:
lib/internet_security_event/x509_status.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(object) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/internet_security_event/x509_status.rb', line 7

def self.build(object)
  obj = if object.is_a?(OpenSSL::X509::Certificate)
          X509CertificateStatus.new(object)
        elsif object.is_a?(OpenSSL::X509::CRL)
          X509CertificateRevocationListStatus.new(object)
        end
  obj.to_e
end

Instance Method Details

#renewal_durationObject



24
25
26
# File 'lib/internet_security_event/x509_status.rb', line 24

def renewal_duration
  [validity_duration / 3, 90.days].min
end

#to_eObject



16
17
18
19
20
21
22
# File 'lib/internet_security_event/x509_status.rb', line 16

def to_e
  {
    state:       state,
    description: description,
    metric:      metric,
  }
end