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 so Stew can use that instead. Stew still works and I am currently working on updating it to use the web api instead. Functionality will probably remain the same but you will need an API key from Steam to use Stew

Information

Stew can access both the Steam Community and the Steam Store. The Community library uses the Steam XML 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.

Create a Steam ID

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

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

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

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

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

or

steam_id = Stew::Community::SteamId.create("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

Will gladly accept pull requests.