Class: SteamStoreParser::BaseClient

Inherits:
Object
  • Object
show all
Defined in:
lib/steam-store-parser/base-client.rb

Constant Summary collapse

BASE_URL =
'http://store.steampowered.com/search/?'
GAMES_ONLY =

to filter games only

'&category1=998'

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ BaseClient

Returns a new instance of BaseClient.

Raises:

  • (ArgumentError)


7
8
9
10
# File 'lib/steam-store-parser/base-client.rb', line 7

def initialize(params)
  raise ArgumentError unless params.is_a? Hash
  @url = build_url(params)
end

Instance Method Details

#home_pageString

Returns the HTML source of the page.

Returns:

  • (String)

    the HTML source of the page



18
19
20
# File 'lib/steam-store-parser/base-client.rb', line 18

def home_page
  page(1)
end

#page(page) ⇒ String

Returns Webpage.

Returns:

  • (String)

    Webpage



13
14
15
# File 'lib/steam-store-parser/base-client.rb', line 13

def page(page)
  RestClient.get "#{@url}&page=#{page}"
end