Class: ScraperGooglePlay::Category

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

Instance Method Summary collapse

Methods inherited from Base

#exist?, #list_packname_with_page

Constructor Details

#initialize(category_name) ⇒ Category



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

def initialize(category_name)
  @category_name = category_name.upcase
  @agent = Mechanize.new

unless exist?("#{ScraperGooglePlay::CATEGORYURL}#{@category_name}")
  @page = nil
else 
  @page = @agent.get("#{ScraperGooglePlay::CATEGORYURL}#{@category_name}")
end
end

Instance Method Details

#all_appObject



14
15
16
17
# File 'lib/scraper_google_play/category.rb', line 14

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

#topgrossingObject



31
32
33
34
35
# File 'lib/scraper_google_play/category.rb', line 31

def topgrossing
  return nil unless @page
  sub_page = @agent.get("#{ScraperGooglePlay::CATEGORYURL}#{@category_name}/collection/topgrossing")
  list_packname_with_page(sub_page)
end

#topselling_freeObject



25
26
27
28
29
# File 'lib/scraper_google_play/category.rb', line 25

def topselling_free
  return nil unless @page
  sub_page = @agent.get("#{ScraperGooglePlay::CATEGORYURL}#{@category_name}/collection/topselling_free")
  list_packname_with_page(sub_page)
end

#topselling_new_freeObject



43
44
45
46
47
# File 'lib/scraper_google_play/category.rb', line 43

def topselling_new_free
  return nil unless @page
  sub_page = @agent.get("#{ScraperGooglePlay::CATEGORYURL}#{@category_name}/collection/topselling_new_free")
  list_packname_with_page(sub_page)
end

#topselling_new_paidObject



37
38
39
40
41
# File 'lib/scraper_google_play/category.rb', line 37

def topselling_new_paid
  return nil unless @page
  sub_page = @agent.get("#{ScraperGooglePlay::CATEGORYURL}#{@category_name}/collection/topselling_new_paid")
  list_packname_with_page(sub_page)
end

#topselling_paidObject



19
20
21
22
23
# File 'lib/scraper_google_play/category.rb', line 19

def topselling_paid
  return nil unless @page
  sub_page = @agent.get("#{ScraperGooglePlay::CATEGORYURL}#{@category_name}/collection/topselling_paid")
  list_packname_with_page(sub_page)
end