Module: Steam::News

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

Overview

A Ruby DSL for communicating with the Steam Web API.

Class Method Summary collapse

Class Method Details

.clientObject

Since:

  • 1.0.0



28
29
30
# File 'lib/steam-api/steam/news.rb', line 28

def self.client
  build_client 'ISteamNews'
end

.get(appid, params: {}) ⇒ Hash

Get News for App

Parameters:

  • params (Hash) (defaults to: {})

    Parameters to pass to the API

Options Hash (params:):

  • :appid (String)

    The application ID for the Steam Game.

  • :key (String)

    Steam Api Key

  • :count (Fixnum)

    How many news enties you want to get returned. (Optional)

  • :maxlength (Fixnum)

    Maximum length of each news entry. (Optional)

  • :enddate (Fixnum)

    Unix timestamp, returns posts before this date. (Optional)

  • :feeds (String)

    Commma-seperated list of feed names to return news for. (Optional)

Returns:

  • (Hash)

    A hash object of the latest news items for a game specified by its appID.

See Also:

Since:

  • 1.0.0



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

def self.get(appid, params: {})
  params[:appid] = appid
  client.get('GetNewsForApp/v2', params: params)
        .parse_key('appnews')
        .parse_key('newsitems')
end