Sha256: 1fbc87cd098f2ffd5e34c6029ba0ee646af472ff162923f2d32e265d696415e1

Contents?: true

Size: 742 Bytes

Versions: 5

Compression:

Stored size: 742 Bytes

Contents

module Virility
  class Facebook < Strategy
    BASE_URL = "https://api.facebook.com/method/fql.query?query=SELECT+share_count%2C+like_count%2C+comment_count%2C+total_count%2C+commentsbox_count%2C+click_count+FROM+link_stat+WHERE+url%3D"

    def census
      self.class.get("#{BASE_URL}%22#{@url}%22")
    end
    
    def outcome
			@response.parsed_response["fql_query_response"]["link_stat"]
    end

    def count
      results["total_count"] || 0
    end
    
  private
  
    def valid_response_test
      @response.respond_to?(:parsed_response) and @response.parsed_response.is_a?(Hash) and !@response.parsed_response["fql_query_response"].nil? and !@response.parsed_response["fql_query_response"]["link_stat"].nil?
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
virility-0.2.0 lib/virility/strategies/facebook.rb
virility-0.1.4 lib/virility/strategies/facebook.rb
virility-0.1.3 lib/virility/strategies/facebook.rb
virility-0.1.2 lib/virility/strategies/facebook.rb
virility-0.1.1 lib/virility/strategies/facebook.rb