Project

stew

0.0
No commit activity in last 3 years
No release in over 3 years
Accesses the Steam Community API as well as the Store. Can show games for profiles as well as parsed HTML data for applications and sales
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0.8.6
>= 5.1.0
>= 1.5.0
 Project Readme

Stew

Gem Version Code Climate Dependency Status

##Important!

Steam has deprecated their old xml format api. The good news is that they have added the remaining functionality from it to their "real" web api. From version 0.6.0, Stew no longer supports the old, deprecated, api. From this version you need a Steam Web API Key to use Stew

##Information

This is used in production at http://www.gamemagus.com

Stew can access both the Steam Community and the Steam Store. The Community library uses the Steam Web API and should be rather stable. The Store library accesses the Store pages by parsing the HTML. This should be considered unstable and you have to be prepared for missing data in case the store pages change.

###Steam Community The Community part of the API is a work in progress and lacks a lot of the fields expected in for example a Profile. You can however still use it to retrieve the games for a profile and such.

####Before Use You need to retrieve and set your Steam Web API key before using Stew. If you don't have one, then one can be found here: http://steamcommunity.com/dev/apikey

Once you have a key, make Stew use it:

Stew.configure(steam_api_key: YOURKEY)

####Create a Steam ID

steam_id = Stew::Community::SteamId.new("http://steamcommunity.com/profiles/76561197992917668")

You can also use the 64 bit ids. This is equivalent to above:

steam_id = Stew::Community::SteamId.new(76561197992917668)

Finally, you can use vanity names or URLs to create steam_ids like so:

steam_id = Stew::Community::SteamId.new("http://steamcommunity.com/id/eekon20")

or

steam_id = Stew::Community::SteamId.new("eekon20")

Once you have created a Steam ID, you can use it to get information like the Profile, Games and Friends

Profile
steam_id.profile.nickname #=> 'Best baunty EU'
Games
steam_id.games.each {|game| puts game.name}
Friends
steam_id.friends.each {|friend| puts friend.profile.nickname}

Store

Important! The Store library accesses the Store pages by parsing HTML responses. It will give nil values in case the HTML on the store pages change

Create a Store Application

From an App id
app = Stew::Store::StoreClient.new.app(220240)
From an App id in a specific region

A more robust region support, with region identification by country etc, is planned.

app = Stew::Store::StoreClient.new.app(220240, :uk)
From a URL
app = Stew::Store::StoreClient.new.create_app("http://store.steampowered.com/app/220240/")
From a URL with a region
app = Stew::Store::StoreClient.new.create_app("http://store.steampowered.com/app/220240/?cc=uk")

All the examples above will create a Stew::Store::App instance for the game Far Cry 3. You can then access data like so:

app.name #=> "Far Cry 3"

app.score #=> 88 #Metacritic score

app.release_date.to_s #=> "2012-12-04"

app.price #=> Money instance. https://github.com/RubyMoney/money

app.offers #=> AppOffers

app.offers.sale? #=> false

app.indie? #=> false

app.free? #=> false :(

More data is available for apps and app offers. See the code for the specific classes to find out.

Contribute

You will need a Steam Web API key to contribute to this project. The key is set in the spec/config.yml file. See the example Will gladly accept pull requests.