Bryan Mytko

Software and stuff.

Hearthstone API

May 06, 2016

I recently published an API wrapper gem for http://hearthstoneapi.com, which is a public API on Mashape that contains data on all Hearthstone cards, even including the most recent release "Whispers of the Old Gods".

The source code is available Github.

Installation is pretty easy. You just add this line to your application's Gemfile:

1
gem 'hearthstone_api'

Then, get an API key from mashape.com and set it as an environment variable (using the dotenv gem is acceptable):

1
HEARTHSTONE_API_KEY=xxxxxxxxxxxxxxxxxxxx

Usage is super simple, just call the method associated with the API you want and pass any valid options described in the documentation:

1
2
3
4
5
6
7
8
9
10
HearthstoneApi::Card.single("Ysera", locale: "jaJP")

    => [{"cardId"=>"EX1_572",
             "name"=>"イセラ",
             "cardSet"=>"Classic",
             "type"=>"Minion",
             "faction"=>"Neutral",
             "rarity"=>"Legendary",
             "cost"=>9,
             [...]

A full list of all the available endpoints can be found in the documentation.

Feel free to file issues, give feedback or even contribute. I made this project for fun but it would be interesting to know what projects use it.


Extracting API Pie

July 17, 2015

Apipie (github) is an amazing Rails engine that lets you document your APIs in the code using Apipie's DSL. It's super simple to set up -- just install the gem and st...
[Read More]