lib/share_checker/providers/facebook.rb in share_checker-0.1.1 vs lib/share_checker/providers/facebook.rb in share_checker-0.1.2

- old
+ new

@@ -1,7 +1,5 @@ -require 'nokogiri' - module ShareChecker module Providers class Facebook < Provider # Response sample # @@ -18,11 +16,11 @@ # <commentsbox_count>0</commentsbox_count> # </link_stat> # </links_getStats_response> # def parse(response) - doc = Nokogiri::XML(response) - doc.at("like_count").content.to_i + doc = parse_xml(response) + doc.nil? ? 0 : doc["links_getStats_response"]["link_stat"]["like_count"].to_i end def url "http://api.facebook.com/restserver.php?method=links.getStats&urls=" end