Class: SocialButterfly::Services::FacebookService
- Inherits:
-
AbstractService
- Object
- AbstractService
- SocialButterfly::Services::FacebookService
- Defined in:
- lib/social_butterfly/services/facebook_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 |
# File 'lib/social_butterfly/services/facebook_service.rb', line 5 def self.(content, ={}) "https://www.facebook.com/sharer/sharer.php?u=#{content[:url]}" end |
.track(content, service_options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/social_butterfly/services/facebook_service.rb', line 9 def self.track(content, ={}) url = "http://graph.facebook.com/#{content[:url]}" stats = {} result = JSON.parse(open(url).read) if result.present? && result['shares'].present? stats[:shares] = result['shares'] else stats[:shares] = 0 end stats end |