0.0
No commit activity in last 3 years
No release in over 3 years
A wrapper for the Hearthstone API found at hearthstoneapi.com
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 8.2.4, ~> 8.2
~> 10
~> 3.3
~> 2.9
~> 1.8

Runtime

~> 2.0
~> 0.13
~> 1.8
 Project Readme

logo

HearthstoneApi

Gem Version

API Wrapper for hearthstoneapi.com

Installation

Add this line to your application's Gemfile:

gem 'hearthstone_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hearthstone_api

Create a .env file and add your API Key

$ touch .env

In the .env file:

HEARTHSTONE_API_KEY=xxxxxxxxxxxxxxxxxxxx

Endpoints

All endpoints available via hearthstoneapi.com

  1. All Cards
  2. Single Card
  3. Class Cards
  4. Types
  5. Sets
  6. Races
  7. Qualities
  8. Factions
  9. Search
  10. Card Backs
  11. Info

Examples:

All Cards

N.B. Cards come back organized by the set they belong to

HearthstoneApi::Cards.all(attack: 12)

=> {"Basic"=>[],
    "Classic"=>
      [{"cardId"=>"NEW1_030",
        "name"=>"Deathwing",
        "cardSet"=>"Classic",
        "type"=>"Minion",
        "rarity"=>"Legendary",
        "cost"=>10,
        "attack"=>12,
        "health"=>12,
        [...]

Single Card

This endpoint accepts name or card ID

HearthstoneApi::Cards.single("Ysera", locale: "jaJP")

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

HearthstoneApi::Cards.single("EX1_572", locale: "jaJP")

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

Class Cards

HearthstoneApi::Cards.classes("Paladin", cost: 2)

=> [{"cardId"=>"OG_311",
      "name"=>"A Light in the Darkness",
      "cardSet"=>"Whispers of the Old Gods",
      "type"=>"Spell",
      "rarity"=>"Common",
      "cost"=>2,
      "text"=>"<b>Discover</b> a minion.\nGive it +1/+1.",
      [...]

Types

HearthstoneApi::Cards.type("Weapon")

=> [{"cardId"=>"TB_SPT_BossWeapon",
      "name"=>"Armory",
      "cardSet"=>"Tavern Brawl",
      "type"=>"Weapon",
      "cost"=>1,
      "attack"=>0,
      "durability"=>1,
      [...]

Sets

HearthstoneApi::Cards.sets("Blackrock Mountain")

=> [{"cardId"=>"BRMA16_1",
      "name"=>"Atramedes",
      "cardSet"=>"Blackrock Mountain",
      "type"=>"Hero",
      "health"=>30,
      [...]

Races

Mrglglrglglglglglglgl!

HearthstoneApi::Cards.races("Murloc")

=> [{"cardId"=>"PRO_001at",
      "name"=>"Murloc",
      "cardSet"=>"Promotion",
      "type"=>"Minion",
      "cost"=>0,
      "attack"=>1,
      "health"=>1,
      "race"=>"Murloc",
      [...]

Qualities

HearthstoneApi::Cards.qualities("Legendary")

=> [{"cardId"=>"BRMA14_3",
      "name"=>"Arcanotron",
      "cardSet"=>"Blackrock Mountain",
      "type"=>"Minion",
      "rarity"=>"Legendary",
      [...]

Factions

HearthstoneApi::Cards.factions("Horde")

=> [{"cardId"=>"CS2_189",
      "name"=>"Elven Archer",
      "cardSet"=>"Basic",
      "type"=>"Minion",
      "faction"=>"Horde",
      "rarity"=>"Free",
      "cost"=>1,
      "attack"=>1,
      "health"=>1,
      [...]

Search

Returns cards by partial name

N.B. When searching by locale, the search term must be in that language

HearthstoneApi::Cards.search("Onyx")

=> [{"cardId"=>"BRMA17_3",
      "name"=>"Onyxia",
      "cardSet"=>"Blackrock Mountain",
      "type"=>"Hero",
      "health"=>15,
      [...]

HearthstoneApi::Cards.search("イセラ", locale: "jaJP")

=> [{"cardId"=>"LOEA16_15",
      "name"=>"イセラの涙",
      "cardSet"=>"The League of Explorers",
      "type"=>"Spell",
      "cost"=>0,
      "text"=>"このターンの間のみ、マナクリスタル\nを4つ獲得する。",

Card Backs

HearthstoneApi::Cardbacks.all

=> [{"cardBackId"=>"0",
      "name"=>"Classic",
      "description"=>"The only card back you’ll ever need.",
      "source"=>"startup",
      "sourceDescription"=>"Default",
      "enabled"=>true,
      "img"=>
        "http://wow.zamimg.com/images/hearthstone/backs/original/Card_Back_Default.png",
      "imgAnimated"=>
        "http://wow.zamimg.com/images/hearthstone/backs/animated/Card_Back_Default.gif",
      "sortCategory"=>"1",
      "sortOrder"=>"1",
      [...]

Info

HearthstoneApi::Info.all

=> {"patch"=>"5.0.0.12574",
      "classes"=>
        ["Druid",
          "Hunter",
          "Mage",
          "Paladin",
          "Priest",
          "Rogue",
          "Shaman",
          "Warlock",
          "Warrior",
          "Dream"],
      "sets"=>
        ["Basic",
          "Classic",
          "Credits",
          "Naxxramas",
          [...]

Contributing

  1. Fork it ( https://github.com/[my-github-username]/hearthstone_api/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Development

gem build hearthstone_api.gemspec
gem install ./hearthstone_api-1.0.2.gem