Skip to content
Browse files

Remove hashie dependency

Progress toward #4.
  • Loading branch information...
1 parent c852933 commit bad804b1081732cea6bdf6350be60e1590278e9c @sferik committed
Showing with 14 additions and 16 deletions.
  1. +0 −1 gems.gemspec
  2. +3 −3 lib/gems/client.rb
  3. +0 −1 lib/gems/connection.rb
  4. +11 −11 spec/gems/client_spec.rb
View
1 gems.gemspec
@@ -11,7 +11,6 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'yard', '~> 0.7'
gem.add_runtime_dependency 'faraday', '~> 0.6.1'
gem.add_runtime_dependency 'faraday_middleware', '~> 0.6.5'
- gem.add_runtime_dependency 'hashie', '~> 1.0.0'
gem.add_runtime_dependency 'multi_json', '~> 1.0.3'
gem.add_runtime_dependency 'multi_xml', '~> 0.2.2'
View
6 lib/gems/client.rb
@@ -58,7 +58,7 @@ def versions(gem_name)
# @example
# Gems.downloads 'coulda', '0.6.3', Date.today - 30, Date.today
def downloads(gem_name, gem_version=nil, from=nil, to=Date.today)
- gem_version ||= info(gem_name).version
+ gem_version ||= info(gem_name)['version']
if from
get("/api/v1/versions/#{gem_name}-#{gem_version}/downloads/search", {:from => from.to_s, :to => to.to_s}, :json)
else
@@ -183,7 +183,7 @@ def fire_web_hook(gem_name, url)
# @example
# Gems.yank("gemcutter", "0.2.1", {:platform => "x86-darwin-10"})
def yank(gem_name, gem_version=nil, options={})
- gem_version ||= info(gem_name).version
+ gem_version ||= info(gem_name)['version']
delete("/api/v1/gems/yank", options.merge(:gem_name => gem_name, :version => gem_version), :raw)
end
@@ -197,7 +197,7 @@ def yank(gem_name, gem_version=nil, options={})
# @example
# Gems.unyank("gemcutter", "0.2.1", {:platform => "x86-darwin-10"})
def unyank(gem_name, gem_version=nil, options={})
- gem_version ||= info(gem_name).version
+ gem_version ||= info(gem_name)['version']
put("/api/v1/gems/unyank", options.merge(:gem_name => gem_name, :version => gem_version), :raw)
end
end
View
1 lib/gems/connection.rb
@@ -15,7 +15,6 @@ def connection(format=format)
connection = Faraday.new(options) do |connection|
connection.use Faraday::Request::UrlEncoded
- connection.use Faraday::Response::Mashify
case format.to_s.downcase
when 'json'
connection.use Faraday::Response::ParseJson
View
22 spec/gems/client_spec.rb
@@ -18,7 +18,7 @@
info = Gems.info 'rails'
a_get("/api/v1/gems/rails.#{format}").
should have_been_made
- info.name.should == 'rails'
+ info['name'].should == 'rails'
end
end
end
@@ -39,7 +39,7 @@
a_get("/api/v1/search.#{format}").
with(:query => {"query" => "cucumber"}).
should have_been_made
- search.first.name.should == 'cucumber'
+ search.first['name'].should == 'cucumber'
end
end
end
@@ -55,7 +55,7 @@
versions = Gems.versions 'coulda'
a_get("/api/v1/versions/coulda.json").
should have_been_made
- versions.first.number.should == '0.6.3'
+ versions.first['number'].should == '0.6.3'
end
end
@@ -72,7 +72,7 @@
downloads = Gems.downloads 'coulda'
a_get("/api/v1/versions/coulda-3.0.9/downloads.json").
should have_been_made
- downloads["2011-06-22"].should == 8
+ downloads['2011-06-22'].should == 8
end
end
@@ -86,7 +86,7 @@
downloads = Gems.downloads 'coulda', '0.6.3'
a_get("/api/v1/versions/coulda-0.6.3/downloads.json").
should have_been_made
- downloads["2011-06-22"].should == 8
+ downloads['2011-06-22'].should == 8
end
end
@@ -102,7 +102,7 @@
a_get("/api/v1/versions/coulda-0.6.3/downloads/search.json").
with(:query => {"from" => "2011-01-01", "to" => Date.today.to_s}).
should have_been_made
- downloads["2011-06-22"].should == 8
+ downloads['2011-06-22'].should == 8
end
end
@@ -118,7 +118,7 @@
a_get("/api/v1/versions/coulda-0.6.3/downloads/search.json").
with(:query => {"from" => "2011-01-01", "to" => "2011-06-28"}).
should have_been_made
- downloads["2011-06-22"].should == 8
+ downloads['2011-06-22'].should == 8
end
end
end
@@ -135,7 +135,7 @@
a_get("/api/v1/dependencies").
with(:query => {"gems" => "rails,thor"}).
should have_been_made
- dependencies.first.number.should == "3.0.9"
+ dependencies.first[:number].should == "3.0.9"
end
end
@@ -170,7 +170,7 @@
gems = Gems.gems
a_get("/api/v1/gems.#{format}").
should have_been_made
- gems.first.name.should == "congress"
+ gems.first['name'].should == "congress"
end
end
end
@@ -189,7 +189,7 @@
owners = Gems.owners("gems")
a_get("/api/v1/gems/gems/owners.#{format}").
should have_been_made
- owners.first.email.should == "sferik@gmail.com"
+ owners.first['email'].should == "sferik@gmail.com"
end
end
end
@@ -237,7 +237,7 @@
web_hooks = Gems.web_hooks
a_get("/api/v1/web_hooks.json").
should have_been_made
- web_hooks.rails.first.url.should == "http://example.com"
+ web_hooks['rails'].first['url'].should == "http://example.com"
end
end

0 comments on commit bad804b

Please sign in to comment.
Something went wrong with that request. Please try again.