Class: Virility::Facebook

Inherits:
Strategy show all
Defined in:
lib/virility/strategies/facebook.rb

Constant Summary collapse

BASE_URL =
"https://api.facebook.com/method/links.getStats?urls="

Instance Attribute Summary

Attributes inherited from Strategy

#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

#censusObject



4
5
6
# File 'lib/virility/strategies/facebook.rb', line 4

def census
  self.class.get("#{BASE_URL}#{@url}")
end

#countObject



12
13
14
# File 'lib/virility/strategies/facebook.rb', line 12

def count
  results["total_count"] || 0
end

#outcomeObject



8
9
10
# File 'lib/virility/strategies/facebook.rb', line 8

def outcome
  @response.parsed_response["links_getStats_response"]["link_stat"]
end