Skip to content

Commit

Permalink
Remove hashie dependency
Browse files Browse the repository at this point in the history
Progress toward #4.
  • Loading branch information
sferik committed Jul 2, 2011
1 parent c852933 commit bad804b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
1 change: 0 additions & 1 deletion gems.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
6 changes: 3 additions & 3 deletions lib/gems/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/gems/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions spec/gems/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -189,7 +189,7 @@
owners = Gems.owners("gems")
a_get("/api/v1/gems/gems/owners.#{format}").
should have_been_made
owners.first.email.should == "[email protected]"
owners.first['email'].should == "[email protected]"
end
end
end
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit bad804b

Please sign in to comment.