gems 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -1
- data/README.md +1 -1
- data/lib/gems/client.rb +1 -1
- data/lib/gems/connection.rb +7 -1
- data/lib/gems/version.rb +1 -1
- data/spec/gems/client_spec.rb +2 -2
- data/spec/helper.rb +2 -2
- metadata +2 -2
data/Gemfile
CHANGED
data/README.md
CHANGED
data/lib/gems/client.rb
CHANGED
@@ -25,7 +25,7 @@ module Gems
|
|
25
25
|
# @example
|
26
26
|
# Gems.search 'cucumber'
|
27
27
|
def search(query, options={})
|
28
|
-
get("/api/v1/
|
28
|
+
get("/api/v1/search.json", options.merge(:query => query))
|
29
29
|
end
|
30
30
|
|
31
31
|
# Returns an array of gem version details
|
data/lib/gems/connection.rb
CHANGED
@@ -5,7 +5,13 @@ module Gems
|
|
5
5
|
private
|
6
6
|
|
7
7
|
def connection
|
8
|
-
|
8
|
+
options = {
|
9
|
+
:headers => {'Accept' => 'application/json'},
|
10
|
+
:ssl => {:verify => false},
|
11
|
+
:url => 'https://rubygems.org',
|
12
|
+
}
|
13
|
+
|
14
|
+
Faraday.new(options) do |connection|
|
9
15
|
connection.use Faraday::Request::UrlEncoded
|
10
16
|
connection.use Faraday::Response::RaiseError
|
11
17
|
connection.use Faraday::Response::Rashify
|
data/lib/gems/version.rb
CHANGED
data/spec/gems/client_spec.rb
CHANGED
@@ -19,12 +19,12 @@ describe Gems::Client do
|
|
19
19
|
|
20
20
|
describe "#search" do
|
21
21
|
before do
|
22
|
-
stub_get("/api/v1/
|
22
|
+
stub_get("/api/v1/search.json?query=cucumber").to_return(:body => fixture("search.json"))
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should return an array of active gems that match the query" do
|
26
26
|
search = @client.search 'cucumber'
|
27
|
-
a_get("/api/v1/
|
27
|
+
a_get("/api/v1/search.json?query=cucumber").should have_been_made
|
28
28
|
search.first.name.should == 'cucumber'
|
29
29
|
end
|
30
30
|
end
|
data/spec/helper.rb
CHANGED
@@ -7,11 +7,11 @@ require 'rspec'
|
|
7
7
|
require 'webmock/rspec'
|
8
8
|
|
9
9
|
def a_get(path)
|
10
|
-
a_request(:get, '
|
10
|
+
a_request(:get, 'https://rubygems.org' + path)
|
11
11
|
end
|
12
12
|
|
13
13
|
def stub_get(path)
|
14
|
-
stub_request(:get, '
|
14
|
+
stub_request(:get, 'https://rubygems.org' + path)
|
15
15
|
end
|
16
16
|
|
17
17
|
def fixture_path
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gems
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Erik Michaels-Ober
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-30 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ZenTest
|