Class: Popularity::RedditResult

Inherits:
RedditPost show all
Defined in:
lib/popularity/networks/reddit_post.rb

Instance Attribute Summary

Attributes inherited from Crawler

#url

Instance Method Summary collapse

Methods inherited from RedditPost

#as_json, #comments, #name, #score, #total

Methods inherited from Crawler

#async_done?, #host, #name, #request_url, #response, #response_json, #to_json

Constructor Details

#initialize(url, r) ⇒ RedditResult

A stubbed out version of a RedditPost so RedditShare can stub in the json response it already has



52
53
54
55
56
57
# File 'lib/popularity/networks/reddit_post.rb', line 52

def initialize(url, r)
  super(url)
  @response = r

  self
end

Instance Method Details

#fetchObject



67
68
69
# File 'lib/popularity/networks/reddit_post.rb', line 67

def fetch
  false
end

#fetch_asyncObject



71
72
73
# File 'lib/popularity/networks/reddit_post.rb', line 71

def fetch_async
  false
end

#has_response?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/popularity/networks/reddit_post.rb', line 59

def has_response?
  true
end

#valid?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/popularity/networks/reddit_post.rb', line 63

def valid?
  URI.parse(@url).host
end