Class: Crawlscope::StructuredData::Audit

Inherits:
Object
  • Object
show all
Defined in:
lib/crawlscope/structured_data/audit.rb

Defined Under Namespace

Classes: Entry, Result

Instance Method Summary collapse

Constructor Details

#initialize(schema_registry:, renderer:, timeout_seconds:, browser_factory: nil, network_idle_timeout_seconds: Configuration::DEFAULT_BROWSER_NETWORK_IDLE_TIMEOUT_SECONDS, scroll_page: Configuration::DEFAULT_BROWSER_SCROLL_PAGE) ⇒ Audit

Returns a new instance of Audit.



30
31
32
33
34
35
36
37
# File 'lib/crawlscope/structured_data/audit.rb', line 30

def initialize(schema_registry:, renderer:, timeout_seconds:, browser_factory: nil, network_idle_timeout_seconds: Configuration::DEFAULT_BROWSER_NETWORK_IDLE_TIMEOUT_SECONDS, scroll_page: Configuration::DEFAULT_BROWSER_SCROLL_PAGE)
  @schema_registry = schema_registry
  @renderer = renderer.to_sym
  @timeout_seconds = timeout_seconds
  @browser_factory = browser_factory
  @network_idle_timeout_seconds = network_idle_timeout_seconds
  @scroll_page = scroll_page
end

Instance Method Details

#call(urls:) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/crawlscope/structured_data/audit.rb', line 39

def call(urls:)
  fetcher = build_fetcher(urls)
  entries = urls.map { |url| validate_url(url, fetcher) }

  Result.new(entries: entries)
ensure
  fetcher&.close
end