Class: LoyalSpider::FetchResult

Inherits:
Object
  • Object
show all
Defined in:
lib/loyal_spider/ables/fetch_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#entitiesObject

Returns the value of attribute entities.



13
14
15
# File 'lib/loyal_spider/ables/fetch_result.rb', line 13

def entities
  @entities
end

#exceptionObject

Returns the value of attribute exception.



12
13
14
# File 'lib/loyal_spider/ables/fetch_result.rb', line 12

def exception
  @exception
end

#fetch_optionsObject

Returns the value of attribute fetch_options.



10
11
12
# File 'lib/loyal_spider/ables/fetch_result.rb', line 10

def fetch_options
  @fetch_options
end

#requestObject

Returns the value of attribute request.



8
9
10
# File 'lib/loyal_spider/ables/fetch_result.rb', line 8

def request
  @request
end

#responseObject

Returns the value of attribute response.



7
8
9
# File 'lib/loyal_spider/ables/fetch_result.rb', line 7

def response
  @response
end

#response_codeObject

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_resultObject

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_statusObject

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

#urlObject

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

Returns:

  • (Boolean)


25
26
27
# File 'lib/loyal_spider/ables/fetch_result.rb', line 25

def fail?
  !success?
end

#response_html_docObject



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

Returns:

  • (Boolean)


21
22
23
# File 'lib/loyal_spider/ables/fetch_result.rb', line 21

def success?
  self.response_status == :success
end