Class: Firecrawl::Models::CrawlJob
- Inherits:
-
Object
- Object
- Firecrawl::Models::CrawlJob
- Defined in:
- lib/firecrawl/models/crawl_job.rb
Overview
Status and results of a crawl job.
Instance Attribute Summary collapse
-
#completed ⇒ Object
readonly
Returns the value of attribute completed.
-
#credits_used ⇒ Object
readonly
Returns the value of attribute credits_used.
-
#data ⇒ Object
Returns the value of attribute data.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#next_url ⇒ Object
readonly
Returns the value of attribute next_url.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #done? ⇒ Boolean
-
#initialize(raw) ⇒ CrawlJob
constructor
A new instance of CrawlJob.
- #to_s ⇒ Object
Constructor Details
#initialize(raw) ⇒ CrawlJob
Returns a new instance of CrawlJob.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/firecrawl/models/crawl_job.rb', line 11 def initialize(raw) @id = raw["id"] @status = raw["status"] @total = raw["total"].to_i @completed = raw["completed"].to_i @credits_used = raw["creditsUsed"] @expires_at = raw["expiresAt"] @next_url = raw["next"] @data = (raw["data"] || []).map { |d| Document.new(d) } end |
Instance Attribute Details
#completed ⇒ Object (readonly)
Returns the value of attribute completed.
7 8 9 |
# File 'lib/firecrawl/models/crawl_job.rb', line 7 def completed @completed end |
#credits_used ⇒ Object (readonly)
Returns the value of attribute credits_used.
7 8 9 |
# File 'lib/firecrawl/models/crawl_job.rb', line 7 def credits_used @credits_used end |
#data ⇒ Object
Returns the value of attribute data.
9 10 11 |
# File 'lib/firecrawl/models/crawl_job.rb', line 9 def data @data end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
7 8 9 |
# File 'lib/firecrawl/models/crawl_job.rb', line 7 def expires_at @expires_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/firecrawl/models/crawl_job.rb', line 7 def id @id end |
#next_url ⇒ Object (readonly)
Returns the value of attribute next_url.
7 8 9 |
# File 'lib/firecrawl/models/crawl_job.rb', line 7 def next_url @next_url end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/firecrawl/models/crawl_job.rb', line 7 def status @status end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
7 8 9 |
# File 'lib/firecrawl/models/crawl_job.rb', line 7 def total @total end |
Instance Method Details
#done? ⇒ Boolean
22 23 24 |
# File 'lib/firecrawl/models/crawl_job.rb', line 22 def done? %w[completed failed cancelled].include?(status) end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/firecrawl/models/crawl_job.rb', line 26 def to_s "CrawlJob{id=#{id}, status=#{status}, completed=#{completed}/#{total}}" end |