Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add recipe API
  • Loading branch information
Brandon Tilley committed Dec 19, 2011
1 parent 0f8abff commit d5c40f5
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/battlenet.rb
Expand Up @@ -5,6 +5,7 @@
require 'battlenet/modules/realm'
require 'battlenet/modules/auction'
require 'battlenet/modules/item'
require 'battlenet/modules/recipe'
require 'battlenet/modules/quest'
require 'battlenet/modules/arena'
require 'battlenet/modules/data'
Expand All @@ -17,6 +18,7 @@ class Battlenet
include Battlenet::Realm
include Battlenet::Auction
include Battlenet::Item
include Battlenet::Recipe
include Battlenet::Quest
include Battlenet::Arena
include Battlenet::Data
Expand Down
7 changes: 7 additions & 0 deletions lib/battlenet/modules/recipe.rb
@@ -0,0 +1,7 @@
class Battlenet
module Recipe
def recipe(id, options = {})
get "/recipe/#{id}", options
end
end
end
28 changes: 28 additions & 0 deletions spec/fixtures/cassettes/recipe.yml
@@ -0,0 +1,28 @@
---
- !ruby/struct:VCR::HTTPInteraction
request: !ruby/struct:VCR::Request
method: :get
uri: http://us.battle.net:80/api/wow/recipe/33994
body:
headers:
response: !ruby/struct:VCR::Response
status: !ruby/struct:VCR::ResponseStatus
code: 200
message: OK
headers:
date:
- Mon, 19 Dec 2011 17:47:30 GMT
server:
- Apache
x-frame-options:
- SAMEORIGIN
content-language:
- en-US
content-length:
- '112'
vary:
- Accept-Encoding
content-type:
- application/json;charset=utf-8
body: ! '{"id":33994,"name":"Enchant Gloves - Precise Strikes","profession":"Enchanting","icon":"spell_holy_greaterheal"}'
http_version: '1.1'
14 changes: 14 additions & 0 deletions spec/integration/recipe_spec.rb
@@ -0,0 +1,14 @@
require 'spec_helper'
require 'battlenet'

describe Battlenet::Recipe do
let(:api) { Battlenet.new }

it "fetches recipe data" do
VCR.use_cassette('recipe') do
recipe = api.recipe '33994'
recipe['name'].should == "Enchant Gloves - Precise Strikes"
recipe['profession'].should == "Enchanting"
end
end
end

0 comments on commit d5c40f5

Please sign in to comment.