lib/share_counter.rb in share_counter-0.2.1 vs lib/share_counter.rb in share_counter-0.2.2

- old
+ new

@@ -25,14 +25,19 @@ end end def self.linkedin url html = make_request "https://www.linkedin.com/countserv/count/share", url: url, callback: "IN.Tags.Share.handleCount" - return JSON.parse(html)['count'] + return JSON.parse(html)['count'] end def self.stumbleupon url html = make_request "http://www.stumbleupon.com/services/1.01/badge.getinfo", url: url + + if not JSON.parse(html)['success'] or not JSON.parse(html)['result']['views'] + return 0 + end + return JSON.parse(html)['result']['views'] end def self.pinterest url html = make_request "http://widgets.pinterest.com/v1/urls/count.json", url: url, source: 6