Class: ShareChecker::Providers::Facebook
- Inherits:
-
ShareChecker::Provider
- Object
- ShareChecker::Provider
- ShareChecker::Providers::Facebook
- Defined in:
- lib/share_checker/providers/facebook.rb
Instance Attribute Summary
Attributes inherited from ShareChecker::Provider
Instance Method Summary collapse
-
#parse(response) ⇒ Object
Response sample <links_getStats_response list=“true”> <link_stat> <url>www.mcdonaldseurokids2012.com.ua/challenges/1/works/98</url> <normalized_url>www.mcdonaldseurokids2012.com.ua/challenges/1/works/98</normalized_url> <share_count>36</share_count> <like_count>406</like_count> <comment_count>0</comment_count> <total_count>442</total_count> <click_count>0</click_count> <comments_fbid>10150218116270823</comments_fbid> <commentsbox_count>0</commentsbox_count> </link_stat> </links_getStats_response>.
- #url ⇒ Object
Methods inherited from ShareChecker::Provider
#check, get, #initialize, #method_missing, #parse_json, #parse_xml
Constructor Details
This class inherits a constructor from ShareChecker::Provider
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ShareChecker::Provider
Instance Method Details
#parse(response) ⇒ Object
Response sample
<links_getStats_response list=“true”>
<link_stat>
<url>http://www.mcdonaldseurokids2012.com.ua/challenges/1/works/98</url>
<normalized_url>http://www.mcdonaldseurokids2012.com.ua/challenges/1/works/98</normalized_url>
<share_count>36</share_count>
<like_count>406</like_count>
<comment_count>0</comment_count>
<total_count>442</total_count>
<click_count>0</click_count>
<comments_fbid>10150218116270823</comments_fbid>
<commentsbox_count>0</commentsbox_count>
</link_stat>
</links_getStats_response>
22 23 24 25 26 |
# File 'lib/share_checker/providers/facebook.rb', line 22 def parse(response) doc = ::Nokogiri::XML(response) node = doc.at("like_count") node.nil? ? 0 : node.content.to_i end |
#url ⇒ Object
28 29 30 |
# File 'lib/share_checker/providers/facebook.rb', line 28 def url "http://api.facebook.com/restserver.php?method=links.getStats&urls=" end |