Class: Chkex::Source::One

Inherits:
Base
  • Object
show all
Defined in:
lib/chkex/sources/one.rb

Instance Attribute Summary

Attributes inherited from Base

#results

Instance Method Summary collapse

Methods inherited from Base

#strip

Constructor Details

#initialize(source) ⇒ One

Returns a new instance of One.



4
5
6
# File 'lib/chkex/sources/one.rb', line 4

def initialize(source)
  super(source)
end

Instance Method Details

#processObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/chkex/sources/one.rb', line 8

def process
  result = DomainInfo.new(@source)

  unless result.error.nil?
    @results[:errors][result.error] = [] unless @results[:errors].key?(result.error)
    @results[:errors][result.error].push(domain: result.url)
  end

  return if result.expires_on.nil?

  expiry_date = Date.parse(result.expires_on.strftime('%Y-%m-%d'))
  diff = expiry_date.mjd - @now.mjd

  @results[:success][diff] = [] unless @results[:success].key?(diff)
  @results[:success][diff].push(expiry: expiry_date, domain: result.url)
end