Class: Aquatone::Collectors::Gtr

Inherits:
Aquatone::Collector show all
Defined in:
lib/aquatone/collectors/gtr.rb

Constant Summary collapse

BASE_URI =
"https://www.google.com/transparencyreport/api/v3/httpsreport/ct/certsearch"
DEFAULT_PAGES_TO_PROCESS =
30.freeze

Constants inherited from Aquatone::Collector

Aquatone::Collector::DEFAULT_PRIORITY

Instance Attribute Summary

Attributes inherited from Aquatone::Collector

#domain, #hosts

Instance Method Summary collapse

Methods inherited from Aquatone::Collector

cli_options, descendants, #execute!, #initialize, meta, meta=, priority, sluggified_name

Constructor Details

This class inherits a constructor from Aquatone::Collector

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/aquatone/collectors/gtr.rb', line 17

def run
  token = nil
  pages_to_process.times do
    response = parse_response(request_page(token))
    hosts    = response.first[1].map { |a| a[1] }.uniq
    hosts.each do |host|
      add_host(host) if valid_host?(host)
    end
    _, token, _, current_page, total_pages = response.first.last
    break if token.nil? || current_page == total_pages
  end
end