class Popularity::RedditShare
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
Popularity::Crawler::new
# File lib/popularity/networks/reddit_share.rb, line 6 def initialize(*args) super(*args) posts_json = response_json["data"]["children"] posts_json.each do |child| new_json = response_json.clone new_json["data"]["children"] = [child] url = "http://reddit.com#{child["data"]["permalink"]}" post = RedditResult.new(url, JSON.dump([new_json])) self.add_result(post) end self end
Public Instance Methods
name()
click to toggle source
# File lib/popularity/networks/reddit_share.rb, line 26 def name "reddit" end
posts()
click to toggle source
# File lib/popularity/networks/reddit_share.rb, line 22 def posts @results.size rescue 0 end
request_url()
click to toggle source
# File lib/popularity/networks/reddit_share.rb, line 30 def request_url "http://www.reddit.com/r/search/search.json?q=url:#{@url}" end