Class: AlPapi::Keyword

Inherits:
Object
  • Object
show all
Defined in:
lib/al_papi/keyword.rb

Class Method Summary collapse

Class Method Details

.get(params = {}) ⇒ Object

Get SERP results for keyword already POSTed or in Partner API already. See parameters for what can be passed in.

Parameters:

  • keyword (String)

    Required - The keyword you are ready to get results for.

  • engine (String)

    Optional - Defaults to google

  • locale (String)

    Optional - Defaults to en-us. See Locales for supported locales.

  • rank_date (String)

    Optional - Defaults to today UTC time. Format of YYY-MM-DD ie. 2011-12-28

  • data_format (String)

    Optional - Default is JSON. If you want raw html pass “html” in for data_format



40
41
42
# File 'lib/al_papi/keyword.rb', line 40

def self.get(params = {})
  AlPapi.http.get '/keywords/get', params
end

.post(params = {}, priority = false) ⇒ Object

POST a keyword/engine/locale combination to get SERP for.

Parameters:

  • keyword (String)

    Required - The keyword you are ready to get results for.

  • engine (String)

    Optional - Defaults to google

  • locale (String)

    Optional - Defaults to en-us. See Locales for supported locales.

  • pages_from (String)

    Optional - Defaults is false. Google specific parameter to get results from locale passed in when set to true.

  • callback (String)

    Optional - Default is the callback you have set for your account. Set specific callbacks per request by using this paramerter. A POST is sent to this callback URL when results are returned.



16
17
18
19
# File 'lib/al_papi/keyword.rb', line 16

def self.post(params = {}, priority = false)
  path = priority ? '/keywords/priority' : '/keywords'
  AlPapi.http.post path, params
end

.priority_post(params = {}) ⇒ Object

See post method post for required params



25
26
27
# File 'lib/al_papi/keyword.rb', line 25

def self.priority_post(params = {})
  post params, true
end