Class: Assistant::SeoInspectPayload
- Inherits:
-
Object
- Object
- Assistant::SeoInspectPayload
- Defined in:
- app/services/assistant/seo_inspect_payload.rb
Overview
Shapes a Heatwave::Crawler::Result from :inspect mode into the JSON
payload the seo_inspect_url tool returns: technical-SEO fields, render
artifacts, and a small content preview.
Constant Summary collapse
- CONTENT_PREVIEW_CHARS =
Returns max characters for the content preview.
1_500- ARTIFACT_LIMIT =
Returns max artifacts of each type to include.
10
Class Method Summary collapse
-
.call(url, result) ⇒ Hash
The tool payload (nil values stripped).
Instance Method Summary collapse
-
#call ⇒ Hash
The tool payload (nil values stripped).
- #initialize(url, result) ⇒ void constructor
Constructor Details
#initialize(url, result) ⇒ void
26 27 28 29 |
# File 'app/services/assistant/seo_inspect_payload.rb', line 26 def initialize(url, result) @url = url @result = result end |
Class Method Details
.call(url, result) ⇒ Hash
Returns the tool payload (nil values stripped).
18 19 20 |
# File 'app/services/assistant/seo_inspect_payload.rb', line 18 def call(url, result) new(url, result).call end |
Instance Method Details
#call ⇒ Hash
Returns the tool payload (nil values stripped).
32 33 34 35 36 37 38 39 40 |
# File 'app/services/assistant/seo_inspect_payload.rb', line 32 def call { url: url, final_url: result.final_url, status: result.status, retrieval_method: result.tier.to_s, redirect_chain: result.details[:redirect_chain] }.merge(seo_fields).merge(artifact_fields).compact end |