Skip to content

Commit

Permalink
Remove JSON dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Aug 28, 2011
1 parent 5e76439 commit 13394a7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
1 change: 0 additions & 1 deletion gems.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Gem::Specification.new do |gem|
gem.homepage = 'https://github.com/rubygems/gems'
gem.name = 'gems'
gem.require_paths = ['lib']
gem.required_ruby_version = '>= 1.9'
gem.summary = gem.description
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
gem.version = Gems::VERSION
Expand Down
5 changes: 2 additions & 3 deletions lib/gems/client.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'date'
require 'gems/configuration'
require 'gems/request'
require 'json'
require 'yaml'

module Gems
Expand Down Expand Up @@ -48,8 +47,8 @@ def search(query)
# @example
# Gems.versions 'coulda'
def versions(gem_name)
response = get("/api/v1/versions/#{gem_name}.json")
JSON.parse(response)
response = get("/api/v1/versions/#{gem_name}.yaml")
YAML.load(response)
end

# Returns the total number of downloads for a particular gem
Expand Down
1 change: 0 additions & 1 deletion spec/fixtures/coulda.json

This file was deleted.

17 changes: 17 additions & 0 deletions spec/fixtures/script_helpers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- built_at: "2011-07-11T07:00:00Z"
number: 0.1.0
prerelease: false
authors: Mike Stone
description: A Rails 3 gem that allows easy inlining of css and JavaScript
summary: Script Helpers
downloads_count: 0
platform: ruby
- built_at: "2011-07-11T07:00:00Z"
number: 0.0.1
prerelease: false
authors: Mike Stone
description: A Rails 3 gem that allows easy inlining of css and JavaScript
summary: Script Helpers
downloads_count: 0
platform: ruby
10 changes: 5 additions & 5 deletions spec/gems/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@

describe ".versions" do
before do
stub_get("/api/v1/versions/coulda.json").
to_return(:body => fixture("coulda.json"))
stub_get("/api/v1/versions/script_helpers.yaml").
to_return(:body => fixture("script_helpers.yaml"))
end

it "should return an array of gem version details" do
versions = Gems.versions 'coulda'
a_get("/api/v1/versions/coulda.json").
versions = Gems.versions 'script_helpers'
a_get("/api/v1/versions/script_helpers.yaml").
should have_been_made
versions.first['number'].should == '0.6.3'
versions.first['number'].should == '0.1.0'
end
end

Expand Down

0 comments on commit 13394a7

Please sign in to comment.