Class: LoyalSpider::FetchResult
- Inherits:
-
Object
- Object
- LoyalSpider::FetchResult
- Defined in:
- lib/loyal_spider/ables/fetch_result.rb
Instance Attribute Summary collapse
-
#entities ⇒ Object
Returns the value of attribute entities.
-
#exception ⇒ Object
Returns the value of attribute exception.
-
#fetch_options ⇒ Object
Returns the value of attribute fetch_options.
-
#request ⇒ Object
Returns the value of attribute request.
-
#response ⇒ Object
Returns the value of attribute response.
-
#response_code ⇒ Object
Returns the value of attribute response_code.
-
#response_result ⇒ Object
Returns the value of attribute response_result.
-
#response_status ⇒ Object
Returns the value of attribute response_status.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #fail? ⇒ Boolean
-
#initialize(attrs = {}) ⇒ FetchResult
constructor
A new instance of FetchResult.
- #response_html_doc ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(attrs = {}) ⇒ FetchResult
Returns a new instance of FetchResult.
15 16 17 18 19 |
# File 'lib/loyal_spider/ables/fetch_result.rb', line 15 def initialize attrs={} attrs.each do |key, value| self.send(:"#{key}=", value) end end |
Instance Attribute Details
#entities ⇒ Object
Returns the value of attribute entities.
13 14 15 |
# File 'lib/loyal_spider/ables/fetch_result.rb', line 13 def entities @entities end |
#exception ⇒ Object
Returns the value of attribute exception.
12 13 14 |
# File 'lib/loyal_spider/ables/fetch_result.rb', line 12 def exception @exception end |
#fetch_options ⇒ Object
Returns the value of attribute fetch_options.
10 11 12 |
# File 'lib/loyal_spider/ables/fetch_result.rb', line 10 def @fetch_options end |
#request ⇒ Object
Returns the value of attribute request.
8 9 10 |
# File 'lib/loyal_spider/ables/fetch_result.rb', line 8 def request @request end |
#response ⇒ Object
Returns the value of attribute response.
7 8 9 |
# File 'lib/loyal_spider/ables/fetch_result.rb', line 7 def response @response end |
#response_code ⇒ Object
Returns the value of attribute response_code.
6 7 8 |
# File 'lib/loyal_spider/ables/fetch_result.rb', line 6 def response_code @response_code end |
#response_result ⇒ Object
Returns the value of attribute response_result.
9 10 11 |
# File 'lib/loyal_spider/ables/fetch_result.rb', line 9 def response_result @response_result end |
#response_status ⇒ Object
Returns the value of attribute response_status.
5 6 7 |
# File 'lib/loyal_spider/ables/fetch_result.rb', line 5 def response_status @response_status end |
#url ⇒ Object
Returns the value of attribute url.
11 12 13 |
# File 'lib/loyal_spider/ables/fetch_result.rb', line 11 def url @url end |
Instance Method Details
#fail? ⇒ Boolean
25 26 27 |
# File 'lib/loyal_spider/ables/fetch_result.rb', line 25 def fail? !success? end |
#response_html_doc ⇒ Object
29 30 31 |
# File 'lib/loyal_spider/ables/fetch_result.rb', line 29 def response_html_doc @response_html_doc ||= Nokogiri::HTML.parse(self.response) if self.response end |
#success? ⇒ Boolean
21 22 23 |
# File 'lib/loyal_spider/ables/fetch_result.rb', line 21 def success? self.response_status == :success end |