Class: ShareCount::Google

Inherits:
Base
  • Object
show all
Defined in:
lib/share_count/google.rb

Constant Summary collapse

URL =
'https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ'

Constants inherited from Base

Base::DEFAULT_OPEN_TIMEOUT, Base::DEFAULT_TIMEOUT

Instance Attribute Summary

Attributes inherited from Base

#checked_url

Instance Method Summary collapse

Methods inherited from Base

config=, #initialize, #shares

Methods included from StringHelper

#to_camel_case, #to_underscore

Constructor Details

This class inherits a constructor from ShareCount::Base

Instance Method Details

#shares!Object



5
6
7
8
9
# File 'lib/share_count/google.rb', line 5

def shares!
  response = post(URL, JSON.dump(params), { content_type: :json, accept: :json })

  JSON.parse(response)[0]['result']['metadata']['globalCounts']['count'].to_i
end