Class: SocialButterfly::Services::TwitterService
- Inherits:
-
AbstractService
- Object
- AbstractService
- SocialButterfly::Services::TwitterService
- Defined in:
- lib/social_butterfly/services/twitter_service.rb
Class Method Summary collapse
- .share_button_url(content, service_options = {}) ⇒ Object
- .track(content, service_options = {}) ⇒ Object
Methods inherited from AbstractService
Class Method Details
.share_button_url(content, service_options = {}) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/social_butterfly/services/twitter_service.rb', line 5 def self.(content, ={}) "http://twitter.com/share?" + "url=" + content[:url] + "&text=" + content[:text] + "&via=" + [:via] + "&count=none" end |
.track(content, service_options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/social_butterfly/services/twitter_service.rb', line 13 def self.track(content, ={}) url = "http://urls.api.twitter.com/1/urls/count.json?url=#{content[:url]}" stats = {} result = JSON.parse(open(url).read) if result.present? && result['count'].present? stats[:shares] = result['count'] else stats[:shares] = 0 end stats end |