Class: DmgAndroidApi::Android::SearchQuery

Inherits:
Leaderboard
  • Object
show all
Defined in:
lib/dmg_android_api/android/search_query.rb

Overview

Search query pages are extremely similar to leaderboard pages. Amazingly, this inheritence hack works!

Constant Summary

Constants inherited from Leaderboard

Leaderboard::CATEGORIES, Leaderboard::IDENTIFIERS

Instance Attribute Summary

Attributes inherited from Leaderboard

#category, #hydra, #identifier

Instance Method Summary collapse

Methods inherited from Leaderboard

#enqueue_update, #initialize, parse, parse_editors_choice_page, parse_normal_page, #rank_to_page, #results, #update

Constructor Details

This class inherits a constructor from DmgAndroidApi::Android::Leaderboard

Instance Method Details

#initialze(query, options = {}) ⇒ Object



7
8
9
# File 'lib/dmg_android_api/android/search_query.rb', line 7

def initialze(query, options={})
  super(query, nil, options)
end

#market_urls(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/dmg_android_api/android/search_query.rb', line 11

def market_urls(options={})
  results = []
  min_page = options[:min_page] || 1
  max_page = 9
  (min_page..max_page).each do |page|
    start_val = (page - 1) * 46

    url = "https://play.google.com/store/search?"
    url << "q=#{URI.escape(identifier)}&"
    url << "c=apps&start=#{start_val}&"
    url << "num=46&hl=en"
    
    results << url
  end

  results
end