Class: Virility::Facebook
- Defined in:
- lib/virility/strategies/facebook.rb
Constant Summary collapse
- BASE_URL =
'https://graph.facebook.com/?fields=share,og_object{engagement,title}&id='.freeze
Instance Attribute Summary
Attributes inherited from Strategy
#http_proxyaddr, #http_proxyport, #original_url, #response, #results, #url
Instance Method Summary collapse
Methods inherited from Strategy
#call_strategy, #collect_results, #get_result, #initialize, #method_missing, #poll, #result_exists?
Methods included from Supporter
#camelize, #encode, #escaped_url, #get_class_string, #symbolize_for_key, #underscore, #url
Constructor Details
This class inherits a constructor from Virility::Strategy
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Virility::Strategy
Instance Method Details
#census ⇒ Object
5 6 7 |
# File 'lib/virility/strategies/facebook.rb', line 5 def census self.class.get("#{BASE_URL}#{@url}", http_proxyaddr: @http_proxyaddr, http_proxyport: @http_proxyport) end |
#count ⇒ Object
17 18 19 |
# File 'lib/virility/strategies/facebook.rb', line 17 def count results.dig('engagement_count') || 0 end |
#outcome ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/virility/strategies/facebook.rb', line 9 def outcome response = @response.parsed_response.dig('share') engagement = @response.parsed_response.dig('og_object', 'engagement') response['engagement_count'] = engagement.dig('count') response['social_sentence'] = engagement.dig('social_sentence') response end |