Class: ShareChecker::Providers::Twitter
- Inherits:
-
ShareChecker::Provider
- Object
- ShareChecker::Provider
- ShareChecker::Providers::Twitter
- Defined in:
- lib/share_checker/providers/twitter.rb
Instance Attribute Summary
Attributes inherited from ShareChecker::Provider
Instance Method Summary collapse
-
#parse(response) ⇒ Object
Response sample.
- #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
twttr.receiveCount(href="http://www.mcdonaldseurokids2012.com.ua/challenges/1/works/98">www.mcdonaldseurokids2012.com.ua/challenges/1/works/98/”)
9 10 11 12 13 14 |
# File 'lib/share_checker/providers/twitter.rb', line 9 def parse(response) if response =~ /^twttr.receiveCount\((.+)\)$/i doc = parse_json($1) doc.nil? ? 0 : doc["count"].to_i end end |
#url ⇒ Object
16 17 18 |
# File 'lib/share_checker/providers/twitter.rb', line 16 def url "http://urls.api.twitter.com/1/urls/count.json?callback=twttr.receiveCount&url=" end |