Module: Steam::Apps

Defined in:
lib/steam-api/steam/apps.rb

Overview

A Ruby DSL for communicating with the Apps portion of the Steam Web API.

Class Method Summary collapse

Class Method Details

.clientObject

Since:

  • 1.0.0



43
44
45
# File 'lib/steam-api/steam/apps.rb', line 43

def self.client
  build_client 'ISteamApps'
end

.get_allHash

Get Steam Applications

Returns:

  • (Hash)

    A list of objects containing the title and app ID of each program available in the store.

See Also:

Since:

  • 1.0.0



10
11
12
13
14
15
# File 'lib/steam-api/steam/apps.rb', line 10

def self.get_all
  response = client.get('GetApplist/v2')
                   .parse_key('applist')
                   .parse_key('apps')
  response
end

.get_servers(addr: nil, api_version: 'v1') ⇒ Hash

Get Servers at Address

Parameters:

  • addr (String) (defaults to: nil)

    IP or IP:queryport to list

Returns:

  • (Hash)

    A hash containing the API response

See Also:

Since:

  • 1.0.0



21
22
23
24
25
26
27
# File 'lib/steam-api/steam/apps.rb', line 21

def self.get_servers(addr: nil, api_version: 'v1')
  response = client.get "GetServersAtAddress/#{api_version}",
                        params: { addr: ERB::Util.url_encode(addr) }
  response = response.parse_key('response')
  response.check_success
  response.parse_key('servers')
end

.up_to_date(appid: nil, version: 'v1', api_version: 'v1') ⇒ Hash

Check if a given version of an App is current

Parameters:

  • appid (Fixnum) (defaults to: nil)

    AppID of game

  • version (Fixnum) (defaults to: 'v1')

    The installed version of the game

Returns:

  • (Hash)

    A hash containing the API response

See Also:

Since:

  • 1.0.0



34
35
36
37
38
39
40
41
# File 'lib/steam-api/steam/apps.rb', line 34

def self.up_to_date(appid: nil, version: 'v1', api_version: 'v1')
  response = client.get "UpToDateCheck/#{api_version}",
                        params: { appid: appid, version: version }
  response = response.parse_key('response')
  response.check_success
  response.delete('success')
  response
end