Class: ScraperGooglePlay::Search

Inherits:
Base
  • Object
show all
Defined in:
lib/scraper_google_play/search.rb

Instance Method Summary collapse

Methods inherited from Base

#exist?, #list_packname_with_page

Constructor Details

#initialize(keyword) ⇒ Search

Returns a new instance of Search.



3
4
5
6
7
8
9
10
# File 'lib/scraper_google_play/search.rb', line 3

def initialize(keyword)
  @agent = Mechanize.new
  @query = {
      c: "apps",
      q: keyword
    }.to_query
  @page = @agent.get("#{ScraperGooglePlay::SEARCHURL}?#{@query}")
end

Instance Method Details

#appsObject



12
13
14
15
# File 'lib/scraper_google_play/search.rb', line 12

def apps
  return nil unless @page
  list_packname_with_page(@page)
end