Sha256: ddfac5a0b54bb8b7425ed97b34aaf262eb73da7ffb9c596adfad010763b7396a

Contents?: true

Size: 620 Bytes

Versions: 2

Compression:

Stored size: 620 Bytes

Contents

module Virility
  class Facebook < Strategy
    BASE_URL = "https://api.facebook.com/method/links.getStats?urls="
    def census
      self.class.get("#{BASE_URL}#{@url}")
    end

    def outcome
      @response.parsed_response["links_getStats_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["links_getStats_response"].nil? and !@response.parsed_response["links_getStats_response"]["link_stat"].nil?
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
virility-0.3.1 lib/virility/strategies/facebook.rb
virility-0.3.0 lib/virility/strategies/facebook.rb