class Sistrix::Domain::Social::Overview

Attributes

credits[R]
facebook[R]
googleplus[R]
twitter[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/sistrix/domain/social/overview.rb, line 12
def initialize(options = {})
  @options = {
    'domain' => nil,
    'api_key' => Sistrix.config.api_key,
  }.merge(options)

  if Sistrix.config.proxy
    RestClient.proxy = Sistrix.config.proxy
  end
end

Public Instance Methods

call(options = {}) click to toggle source
# File lib/sistrix/domain/social/overview.rb, line 23
def call(options = {})
  data = fetch(options)

  @credits    = data.xpath('//credits').first['used'].to_i
  @twitter    = data.search('/response/answer/votes[@network="twitter"]').first['value'].to_i
  @facebook   = data.search('/response/answer/votes[@network="facebook"]').first['value'].to_i
  @googleplus = data.search('/response/answer/votes[@network="googleplus"]').first['value'].to_i

  self
end