Class: Heatwave::Crawler::Tiers::OxylabsBase
- Inherits:
-
Object
- Object
- Heatwave::Crawler::Tiers::OxylabsBase
- Defined in:
- app/services/heatwave/crawler/tiers/oxylabs_base.rb
Overview
Shared plumbing for the Oxylabs-backed tiers (datacenter render,
residential render, Amazon presets): client construction with the
Policy DI seam, the Retailer::DailyCostGuard pre-flight (a fatal
outcome — never escalate to a pricier tier when the budget is gone),
and response unwrapping.
All Oxylabs traffic keeps flowing through Retailer::OxylabsApi so the
budget guard and submit throttling remain the single choke point.
Subclasses implement #tier_name and #payload (or override
#attempt_fetch entirely, as the Amazon preset tier does).
Direct Known Subclasses
Constant Summary collapse
- OXYLABS_TIMEOUT =
120
Instance Method Summary collapse
- #applies_to?(_url) ⇒ Boolean
- #attempt(url) ⇒ Heatwave::Crawler::FetchOutcome
-
#initialize(policy) ⇒ OxylabsBase
constructor
A new instance of OxylabsBase.
Constructor Details
#initialize(policy) ⇒ OxylabsBase
Returns a new instance of OxylabsBase.
20 21 22 |
# File 'app/services/heatwave/crawler/tiers/oxylabs_base.rb', line 20 def initialize(policy) @policy = policy end |
Instance Method Details
#applies_to?(_url) ⇒ Boolean
24 |
# File 'app/services/heatwave/crawler/tiers/oxylabs_base.rb', line 24 def applies_to?(_url) = true |
#attempt(url) ⇒ Heatwave::Crawler::FetchOutcome
28 29 30 |
# File 'app/services/heatwave/crawler/tiers/oxylabs_base.rb', line 28 def attempt(url) with_tier_errors(url) { attempt_fetch(url) } end |