Class: ScrapeUnblocker::PageResult
- Inherits:
-
Object
- Object
- ScrapeUnblocker::PageResult
- Defined in:
- lib/scrapeunblocker/parsed_page.rb
Overview
HTML plus the cookies and proxy that served it (#get_page_with_cookies).
Instance Attribute Summary collapse
-
#cookies ⇒ Object
readonly
Returns the value of attribute cookies.
-
#html ⇒ Object
readonly
Returns the value of attribute html.
-
#proxy ⇒ Object
readonly
Returns the value of attribute proxy.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(html:, cookies:, proxy:, raw:) ⇒ PageResult
constructor
A new instance of PageResult.
Constructor Details
#initialize(html:, cookies:, proxy:, raw:) ⇒ PageResult
Returns a new instance of PageResult.
37 38 39 40 41 42 |
# File 'lib/scrapeunblocker/parsed_page.rb', line 37 def initialize(html:, cookies:, proxy:, raw:) @html = html @cookies = @proxy = proxy @raw = raw end |
Instance Attribute Details
#cookies ⇒ Object (readonly)
Returns the value of attribute cookies.
35 36 37 |
# File 'lib/scrapeunblocker/parsed_page.rb', line 35 def @cookies end |
#html ⇒ Object (readonly)
Returns the value of attribute html.
35 36 37 |
# File 'lib/scrapeunblocker/parsed_page.rb', line 35 def html @html end |
#proxy ⇒ Object (readonly)
Returns the value of attribute proxy.
35 36 37 |
# File 'lib/scrapeunblocker/parsed_page.rb', line 35 def proxy @proxy end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
35 36 37 |
# File 'lib/scrapeunblocker/parsed_page.rb', line 35 def raw @raw end |
Class Method Details
.from_hash(payload) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/scrapeunblocker/parsed_page.rb', line 44 def self.from_hash(payload) new( html: payload["html"] || payload["page_source"] || payload["content"], cookies: payload["cookies"], proxy: payload["proxy"] || payload["proxy_address"], raw: payload ) end |