Module: Exoteric::GooglePlus

Defined in:
lib/exoteric/counters/google_plus.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.idObject



3
4
5
# File 'lib/exoteric/counters/google_plus.rb', line 3

def self.id
  :plusone
end

Instance Method Details

#plusone_countObject



11
12
13
14
15
# File 'lib/exoteric/counters/google_plus.rb', line 11

def plusone_count
  json = '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"' + url + '","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]'
  res = RestClient.post(plusone_url, json, :content_type => :json)
  JSON.parse(res.to_str)[0]['result']['metadata']['globalCounts']['count'].to_i
end

#plusone_urlObject



7
8
9
# File 'lib/exoteric/counters/google_plus.rb', line 7

def plusone_url
  "https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ"
end