Permalink
Browse files

Fetch YAML response for web hooks

Progress toward #4 (removing multi_json dependency).
  • Loading branch information...
1 parent 1986ba4 commit aa9c792d3397a8f6d608772cf6004f2b0a01b8ee @sferik committed Jul 25, 2011
Showing with 11 additions and 8 deletions.
  1. +2 −2 lib/gems/client.rb
  2. +0 −1 spec/fixtures/web_hooks.json
  3. +4 −0 spec/fixtures/web_hooks.yaml
  4. +5 −5 spec/gems/client_spec.rb
View
@@ -156,8 +156,8 @@ def remove_owner(gem_name, owner)
# @example
# Gems.web_hooks
def web_hooks
- response = get("/api/v1/web_hooks.json")
- MultiJson.decode(response)
+ response = get("/api/v1/web_hooks.yaml")
+ YAML.load(response)
end
# Create a webhook
@@ -1 +0,0 @@
-{"all gems":[{"url":"http://gemwhisperer.heroku.com","failure_count":1}],"rails":[{"url":"http://example.com","failure_count": 0}]}
@@ -0,0 +1,4 @@
+---
+all gems:
+- url: http://example.com
+ failure_count: 0
@@ -223,15 +223,15 @@
describe ".web_hooks" do
before do
- stub_get("/api/v1/web_hooks.json").
- to_return(:body => fixture("web_hooks.json"))
+ stub_get("/api/v1/web_hooks.yaml").
+ to_return(:body => fixture("web_hooks.yaml"))
end
- it "should list the webhooks registered under your account" do
+ it "should list the web hooks registered under your account" do
web_hooks = Gems.web_hooks
- a_get("/api/v1/web_hooks.json").
+ a_get("/api/v1/web_hooks.yaml").
should have_been_made
- web_hooks['rails'].first['url'].should == "http://example.com"
+ web_hooks['all gems'].first['url'].should == "http://example.com"
end
end

0 comments on commit aa9c792

Please sign in to comment.