Sha256: 1b8028e95adc6d8d13559118671cba2a9788fbc310648b1f8cea6a73dd0645e3

Contents?: true

Size: 865 Bytes

Versions: 4

Compression:

Stored size: 865 Bytes

Contents

module MarketBot
  module Android

    # Search query pages are extremely similar to leaderboard pages.
    # Amazingly, this inheritence hack works!
    class SearchQuery < MarketBot::Android::Leaderboard
      def initialize(query, options={})
        super(query, nil, options)
      end

      def market_urls(options={})
        results = []

        min_page = options[:min_page] || 1
        max_page = options[:max_page] || 25
        country  = options[:country]  || 'us'

        (min_page..max_page).each do |page|
          start_val = (page - 1) * 24

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

          results << url
        end

        results
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
market_bot-0.17.0 lib/market_bot/android/search_query.rb
market_bot-0.16.0 lib/market_bot/android/search_query.rb
market_bot-0.15.1 lib/market_bot/android/search_query.rb
market_bot-0.15.0 lib/market_bot/android/search_query.rb