Class: Firecrawl::Models::MonitorTarget

Inherits:
Object
  • Object
show all
Defined in:
lib/firecrawl/models/monitor.rb

Overview

A scrape, crawl, or search target stored on a monitor.

Targets are forwarded to the API verbatim, so callers may also pass plain Hashes with camelCase keys. This class is a convenience for building well-formed target payloads (and is what #to_h emits).

Search targets (+type: "search"+) use the queries, search_window, include_domains, exclude_domains, and max_results fields.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ MonitorTarget

Returns a new instance of MonitorTarget.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/firecrawl/models/monitor.rb', line 18

def initialize(data)
  @id = data["id"]
  @type = data["type"]
  @urls = data["urls"]
  @url = data["url"]
  @scrape_options = data["scrapeOptions"]
  @crawl_options = data["crawlOptions"]
  # search target fields
  @queries = data["queries"]
  @search_window = data["searchWindow"]
  @include_domains = data["includeDomains"]
  @exclude_domains = data["excludeDomains"]
  @max_results = data["maxResults"]
end

Instance Attribute Details

#crawl_optionsObject (readonly)

Returns the value of attribute crawl_options.



14
15
16
# File 'lib/firecrawl/models/monitor.rb', line 14

def crawl_options
  @crawl_options
end

#exclude_domainsObject (readonly)

Returns the value of attribute exclude_domains.



14
15
16
# File 'lib/firecrawl/models/monitor.rb', line 14

def exclude_domains
  @exclude_domains
end

#idObject (readonly)

Returns the value of attribute id.



14
15
16
# File 'lib/firecrawl/models/monitor.rb', line 14

def id
  @id
end

#include_domainsObject (readonly)

Returns the value of attribute include_domains.



14
15
16
# File 'lib/firecrawl/models/monitor.rb', line 14

def include_domains
  @include_domains
end

#max_resultsObject (readonly)

Returns the value of attribute max_results.



14
15
16
# File 'lib/firecrawl/models/monitor.rb', line 14

def max_results
  @max_results
end

#queriesObject (readonly)

Returns the value of attribute queries.



14
15
16
# File 'lib/firecrawl/models/monitor.rb', line 14

def queries
  @queries
end

#scrape_optionsObject (readonly)

Returns the value of attribute scrape_options.



14
15
16
# File 'lib/firecrawl/models/monitor.rb', line 14

def scrape_options
  @scrape_options
end

#search_windowObject (readonly)

Returns the value of attribute search_window.



14
15
16
# File 'lib/firecrawl/models/monitor.rb', line 14

def search_window
  @search_window
end

#typeObject (readonly)

Returns the value of attribute type.



14
15
16
# File 'lib/firecrawl/models/monitor.rb', line 14

def type
  @type
end

#urlObject (readonly)

Returns the value of attribute url.



14
15
16
# File 'lib/firecrawl/models/monitor.rb', line 14

def url
  @url
end

#urlsObject (readonly)

Returns the value of attribute urls.



14
15
16
# File 'lib/firecrawl/models/monitor.rb', line 14

def urls
  @urls
end

Instance Method Details

#to_hObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/firecrawl/models/monitor.rb', line 33

def to_h
  {
    "id" => @id,
    "type" => @type,
    "urls" => @urls,
    "url" => @url,
    "scrapeOptions" => @scrape_options,
    "crawlOptions" => @crawl_options,
    "queries" => @queries,
    "searchWindow" => @search_window,
    "includeDomains" => @include_domains,
    "excludeDomains" => @exclude_domains,
    "maxResults" => @max_results,
  }.compact
end