gems 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +0 -1
- data/README.md +3 -3
- data/lib/gems/client.rb +59 -41
- data/lib/gems/connection.rb +2 -0
- data/lib/gems/request.rb +1 -1
- data/lib/gems/version.rb +1 -1
- data/spec/fixtures/add_web_hook +1 -0
- data/spec/fixtures/fire_web_hook +1 -0
- data/spec/fixtures/owners.yaml +2 -0
- data/spec/fixtures/remove_web_hook +1 -0
- data/spec/gems/client_spec.rb +203 -140
- metadata +201 -193
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -69,13 +69,13 @@ Usage Examples
|
|
69
69
|
puts Gems.web_hooks
|
70
70
|
|
71
71
|
# Add a webhook
|
72
|
-
Gems.add_web_hook 'rails', 'http://example.com'
|
72
|
+
Gems.add_web_hook 'rails', 'http://example.com'
|
73
73
|
|
74
74
|
# Remove a webhook
|
75
|
-
Gems.remove_web_hook 'rails', 'http://example.com'
|
75
|
+
Gems.remove_web_hook 'rails', 'http://example.com'
|
76
76
|
|
77
77
|
# Test fire a webhook.
|
78
|
-
Gems.fire_web_hook 'rails', 'http://example.com'
|
78
|
+
Gems.fire_web_hook 'rails', 'http://example.com'
|
79
79
|
|
80
80
|
# Submit a gem to RubyGems.org
|
81
81
|
Gems.push File.new 'gemcutter-0.2.1.gem' [TODO]
|
data/lib/gems/client.rb
CHANGED
@@ -18,12 +18,12 @@ module Gems
|
|
18
18
|
|
19
19
|
# Returns some basic information about the given gem
|
20
20
|
#
|
21
|
-
# @param
|
21
|
+
# @param gem_name [String] The name of a gem.
|
22
22
|
# @return [Hashie::Mash]
|
23
23
|
# @example
|
24
24
|
# Gems.info 'rails'
|
25
|
-
def info(
|
26
|
-
response = get("/api/v1/gems/#{
|
25
|
+
def info(gem_name)
|
26
|
+
response = get("/api/v1/gems/#{gem_name}")
|
27
27
|
format.to_s.downcase == 'xml' ? response['rubygem'] : response
|
28
28
|
end
|
29
29
|
|
@@ -40,28 +40,28 @@ module Gems
|
|
40
40
|
|
41
41
|
# Returns an array of gem version details
|
42
42
|
#
|
43
|
-
# @param
|
43
|
+
# @param gem_name [String] The name of a gem.
|
44
44
|
# @return [Hashie::Mash]
|
45
45
|
# @example
|
46
46
|
# Gems.versions 'coulda'
|
47
|
-
def versions(
|
48
|
-
get("/api/v1/versions/#{
|
47
|
+
def versions(gem_name)
|
48
|
+
get("/api/v1/versions/#{gem_name}", {}, :json)
|
49
49
|
end
|
50
50
|
|
51
51
|
# Returns the number of downloads by day for a particular gem version
|
52
52
|
#
|
53
|
-
# @param
|
54
|
-
# @param
|
53
|
+
# @param gem_name [String] The name of a gem.
|
54
|
+
# @param gem_version [String] The version of a gem.
|
55
55
|
# @param from [Date] Search start date.
|
56
56
|
# @param to [Date] Search end date.
|
57
57
|
# @return [Hashie::Mash]
|
58
58
|
# @example
|
59
59
|
# Gems.downloads 'coulda', '0.6.3', Date.today - 30, Date.today
|
60
|
-
def downloads(
|
60
|
+
def downloads(gem_name, gem_version, from=nil, to=Date.today)
|
61
61
|
if from
|
62
|
-
get("/api/v1/versions/#{
|
62
|
+
get("/api/v1/versions/#{gem_name}-#{gem_version}/downloads/search", {:from => from.to_s, :to => to.to_s}, :json)
|
63
63
|
else
|
64
|
-
get("/api/v1/versions/#{
|
64
|
+
get("/api/v1/versions/#{gem_name}-#{gem_version}/downloads", {}, :json)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -92,9 +92,6 @@ module Gems
|
|
92
92
|
#
|
93
93
|
# @return [Array]
|
94
94
|
# @example
|
95
|
-
# Gems.configure do |config|
|
96
|
-
# config.key = '701243f217cdf23b1370c7b66b65ca97'
|
97
|
-
# end
|
98
95
|
# Gems.gems
|
99
96
|
def gems
|
100
97
|
response = get("/api/v1/gems")
|
@@ -103,55 +100,76 @@ module Gems
|
|
103
100
|
|
104
101
|
# View all owners of a gem that you own
|
105
102
|
#
|
106
|
-
# @param
|
103
|
+
# @param gem_name [String] The name of a gem.
|
107
104
|
# @return [Array]
|
108
105
|
# @example
|
109
|
-
# Gems.configure do |config|
|
110
|
-
# config.key = '701243f217cdf23b1370c7b66b65ca97'
|
111
|
-
# end
|
112
106
|
# Gems.owners('gemcutter')
|
113
|
-
def owners(
|
114
|
-
get("/api/v1/gems/#{
|
107
|
+
def owners(gem_name)
|
108
|
+
get("/api/v1/gems/#{gem_name}/owners")
|
109
|
+
end
|
110
|
+
|
111
|
+
# Add an owner to a RubyGem you own, giving that user permission to manage it
|
112
|
+
#
|
113
|
+
# @param gem_name [String] The name of a gem.
|
114
|
+
# @param owner [String] The email address of the user you want to add.
|
115
|
+
# @return [String]
|
116
|
+
# @example
|
117
|
+
# Gems.add_owner("gemcutter", "josh@technicalpickles.com")
|
118
|
+
def add_owner(gem_name, owner)
|
119
|
+
post("/api/v1/gems/#{gem_name}/owners", {:email => owner}, :raw)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Remove a user's permission to manage a RubyGem you own
|
123
|
+
#
|
124
|
+
# @param gem_name [String] The name of a gem.
|
125
|
+
# @param owner [String] The email address of the user you want to remove.
|
126
|
+
# @return [String]
|
127
|
+
# @example
|
128
|
+
# Gems.remove_owner("gemcutter", "josh@technicalpickles.com")
|
129
|
+
def remove_owner(gem_name, owner)
|
130
|
+
delete("/api/v1/gems/#{gem_name}/owners", {:email => owner}, :raw)
|
115
131
|
end
|
116
132
|
|
117
133
|
# List the webhooks registered under your account
|
118
134
|
#
|
119
135
|
# @return [Hashie::Mash]
|
120
136
|
# @example
|
121
|
-
# Gems.configure do |config|
|
122
|
-
# config.key = '701243f217cdf23b1370c7b66b65ca97'
|
123
|
-
# end
|
124
137
|
# Gems.web_hooks
|
125
138
|
def web_hooks
|
126
139
|
get("/api/v1/web_hooks", {}, :json)
|
127
140
|
end
|
128
141
|
|
129
|
-
#
|
142
|
+
# Create a webhook
|
130
143
|
#
|
131
|
-
# @param
|
132
|
-
# @param
|
144
|
+
# @param gem_name [String] The name of a gem. Specify "*" to add the hook to all your gems.
|
145
|
+
# @param url [String] The URL of the web hook.
|
133
146
|
# @return [String]
|
134
147
|
# @example
|
135
|
-
# Gems.
|
136
|
-
|
137
|
-
|
138
|
-
# Gems.add_owner("gemcutter", "josh@technicalpickles.com")
|
139
|
-
def add_owner(gem, owner)
|
140
|
-
post("/api/v1/gems/#{gem}/owners", {:email => owner}, :raw)
|
148
|
+
# Gems.add_web_hook("rails", "http://example.com")
|
149
|
+
def add_web_hook(gem_name, url)
|
150
|
+
post("/api/v1/web_hooks", {:gem_name => gem_name, :url => url}, :raw)
|
141
151
|
end
|
142
152
|
|
143
|
-
# Remove a
|
153
|
+
# Remove a webhook
|
144
154
|
#
|
145
|
-
# @param
|
146
|
-
# @param
|
155
|
+
# @param gem_name [String] The name of a gem. Specify "*" to remove the hook from all your gems.
|
156
|
+
# @param url [String] The URL of the web hook.
|
147
157
|
# @return [String]
|
148
158
|
# @example
|
149
|
-
# Gems.
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
159
|
+
# Gems.remove_web_hook("rails", "http://example.com")
|
160
|
+
def remove_web_hook(gem_name, url)
|
161
|
+
delete("/api/v1/web_hooks/remove", {:gem_name => gem_name, :url => url}, :raw)
|
162
|
+
end
|
163
|
+
|
164
|
+
# Test fire a webhook
|
165
|
+
#
|
166
|
+
# @param gem_name [String] The name of a gem. Specify "*" to fire the hook for all your gems.
|
167
|
+
# @param url [String] The URL of the web hook.
|
168
|
+
# @return [String]
|
169
|
+
# @example
|
170
|
+
# Gems.fire_web_hook("rails", "http://example.com")
|
171
|
+
def fire_web_hook(gem_name, url)
|
172
|
+
post("/api/v1/web_hooks/fire", {:gem_name => gem_name, :url => url}, :raw)
|
155
173
|
end
|
156
174
|
end
|
157
175
|
end
|
data/lib/gems/connection.rb
CHANGED
@@ -23,6 +23,8 @@ module Gems
|
|
23
23
|
connection.use Faraday::Response::ParseMarshal
|
24
24
|
when 'xml'
|
25
25
|
connection.use Faraday::Response::ParseXml
|
26
|
+
when 'yaml'
|
27
|
+
connection.use Faraday::Response::ParseYaml
|
26
28
|
end
|
27
29
|
connection.use Faraday::Response::RaiseError
|
28
30
|
connection.adapter Faraday.default_adapter
|
data/lib/gems/request.rb
CHANGED
data/lib/gems/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
Successfully created webhook for all gems to http://example.com
|
@@ -0,0 +1 @@
|
|
1
|
+
Successfully deployed webhook for gemcutter to http://example.com
|
@@ -0,0 +1 @@
|
|
1
|
+
Successfully removed webhook for all gems to http://example.com
|
data/spec/gems/client_spec.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
describe Gems::Client do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
config.password = 'schwwwwing'
|
12
|
-
end
|
13
|
-
end
|
4
|
+
before do
|
5
|
+
Gems.configure do |config|
|
6
|
+
config.key = '701243f217cdf23b1370c7b66b65ca97'
|
7
|
+
config.username = 'nick@gemcutter.org'
|
8
|
+
config.password = 'schwwwwing'
|
9
|
+
end
|
10
|
+
end
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
after do
|
13
|
+
Gems.reset
|
14
|
+
end
|
18
15
|
|
19
|
-
|
16
|
+
describe ".info" do
|
17
|
+
%w(json xml).each do |format|
|
18
|
+
context "with format #{format}" do
|
20
19
|
before do
|
20
|
+
Gems.format = format
|
21
21
|
stub_get("/api/v1/gems/rails.#{format}").
|
22
22
|
to_return(:body => fixture("rails.#{format}"))
|
23
23
|
end
|
@@ -29,9 +29,14 @@ describe Gems::Client do
|
|
29
29
|
info.name.should == 'rails'
|
30
30
|
end
|
31
31
|
end
|
32
|
+
end
|
33
|
+
end
|
32
34
|
|
33
|
-
|
35
|
+
describe ".search" do
|
36
|
+
%w(json xml).each do |format|
|
37
|
+
context "with format #{format}" do
|
34
38
|
before do
|
39
|
+
Gems.format = format
|
35
40
|
stub_get("/api/v1/search.#{format}").
|
36
41
|
with(:query => {"query" => "cucumber"}).
|
37
42
|
to_return(:body => fixture("search.#{format}"))
|
@@ -45,101 +50,106 @@ describe Gems::Client do
|
|
45
50
|
search.first.name.should == 'cucumber'
|
46
51
|
end
|
47
52
|
end
|
53
|
+
end
|
54
|
+
end
|
48
55
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
56
|
+
describe ".versions" do
|
57
|
+
before do
|
58
|
+
stub_get("/api/v1/versions/coulda.json").
|
59
|
+
to_return(:body => fixture("coulda.json"))
|
60
|
+
end
|
54
61
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
62
|
+
it "should return an array of gem version details" do
|
63
|
+
versions = Gems.versions 'coulda'
|
64
|
+
a_get("/api/v1/versions/coulda.json").
|
65
|
+
should have_been_made
|
66
|
+
versions.first.number.should == '0.6.3'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe ".downloads" do
|
71
|
+
context "with no dates specified" do
|
72
|
+
before do
|
73
|
+
stub_get("/api/v1/versions/coulda-0.6.3/downloads.json").
|
74
|
+
to_return(:body => fixture("downloads.json"))
|
61
75
|
end
|
62
76
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
it "should return the number of downloads by day for a particular gem version" do
|
71
|
-
downloads = Gems.downloads 'coulda', '0.6.3'
|
72
|
-
a_get("/api/v1/versions/coulda-0.6.3/downloads.json").
|
73
|
-
should have_been_made
|
74
|
-
downloads["2011-06-22"].should == 8
|
75
|
-
end
|
76
|
-
end
|
77
|
+
it "should return the number of downloads by day for a particular gem version" do
|
78
|
+
downloads = Gems.downloads 'coulda', '0.6.3'
|
79
|
+
a_get("/api/v1/versions/coulda-0.6.3/downloads.json").
|
80
|
+
should have_been_made
|
81
|
+
downloads["2011-06-22"].should == 8
|
82
|
+
end
|
83
|
+
end
|
77
84
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
it "should return the number of downloads by day for a particular gem version" do
|
86
|
-
downloads = Gems.downloads 'coulda', '0.6.3', Date.parse('2011-01-01')
|
87
|
-
a_get("/api/v1/versions/coulda-0.6.3/downloads/search.json").
|
88
|
-
with(:query => {"from" => "2011-01-01", "to" => Date.today.to_s}).
|
89
|
-
should have_been_made
|
90
|
-
downloads["2011-06-22"].should == 8
|
91
|
-
end
|
92
|
-
end
|
85
|
+
context "with from date specified" do
|
86
|
+
before do
|
87
|
+
stub_get("/api/v1/versions/coulda-0.6.3/downloads/search.json").
|
88
|
+
with(:query => {"from" => "2011-01-01", "to" => Date.today.to_s}).
|
89
|
+
to_return(:body => fixture("downloads.json"))
|
90
|
+
end
|
93
91
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
it "should return the number of downloads by day for a particular gem version" do
|
102
|
-
downloads = Gems.downloads 'coulda', '0.6.3', Date.parse('2011-01-01'), Date.parse('2011-06-28')
|
103
|
-
a_get("/api/v1/versions/coulda-0.6.3/downloads/search.json").
|
104
|
-
with(:query => {"from" => "2011-01-01", "to" => "2011-06-28"}).
|
105
|
-
should have_been_made
|
106
|
-
downloads["2011-06-22"].should == 8
|
107
|
-
end
|
108
|
-
end
|
92
|
+
it "should return the number of downloads by day for a particular gem version" do
|
93
|
+
downloads = Gems.downloads 'coulda', '0.6.3', Date.parse('2011-01-01')
|
94
|
+
a_get("/api/v1/versions/coulda-0.6.3/downloads/search.json").
|
95
|
+
with(:query => {"from" => "2011-01-01", "to" => Date.today.to_s}).
|
96
|
+
should have_been_made
|
97
|
+
downloads["2011-06-22"].should == 8
|
109
98
|
end
|
99
|
+
end
|
110
100
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
101
|
+
context "with from and to dates specified" do
|
102
|
+
before do
|
103
|
+
stub_get("/api/v1/versions/coulda-0.6.3/downloads/search.json").
|
104
|
+
with(:query => {"from" => "2011-01-01", "to" => "2011-06-28"}).
|
105
|
+
to_return(:body => fixture("downloads.json"))
|
106
|
+
end
|
117
107
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
end
|
108
|
+
it "should return the number of downloads by day for a particular gem version" do
|
109
|
+
downloads = Gems.downloads 'coulda', '0.6.3', Date.parse('2011-01-01'), Date.parse('2011-06-28')
|
110
|
+
a_get("/api/v1/versions/coulda-0.6.3/downloads/search.json").
|
111
|
+
with(:query => {"from" => "2011-01-01", "to" => "2011-06-28"}).
|
112
|
+
should have_been_made
|
113
|
+
downloads["2011-06-22"].should == 8
|
125
114
|
end
|
115
|
+
end
|
116
|
+
end
|
126
117
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
118
|
+
describe ".dependencies" do
|
119
|
+
before do
|
120
|
+
stub_get("/api/v1/dependencies").
|
121
|
+
with(:query => {"gems" => "rails,thor"}).
|
122
|
+
to_return(:body => fixture("dependencies"))
|
123
|
+
end
|
132
124
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
125
|
+
it "should return an array of hashes for all versions of given gems" do
|
126
|
+
dependencies = Gems.dependencies 'rails', 'thor'
|
127
|
+
a_get("/api/v1/dependencies").
|
128
|
+
with(:query => {"gems" => "rails,thor"}).
|
129
|
+
should have_been_made
|
130
|
+
dependencies.first.number.should == "3.0.9"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
describe ".api_key" do
|
135
|
+
before do
|
136
|
+
stub_get("/api/v1/api_key").
|
137
|
+
to_return(:body => fixture("api_key"))
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should retrieve an API key" do
|
141
|
+
api_key = Gems.api_key
|
142
|
+
a_get("/api/v1/api_key").
|
143
|
+
should have_been_made
|
144
|
+
api_key.should == "701243f217cdf23b1370c7b66b65ca97"
|
145
|
+
end
|
146
|
+
end
|
140
147
|
|
141
|
-
|
148
|
+
describe ".gems" do
|
149
|
+
%w(json xml).each do |format|
|
150
|
+
context "with format #{format}" do
|
142
151
|
before do
|
152
|
+
Gems.format = format
|
143
153
|
stub_get("/api/v1/gems.#{format}").
|
144
154
|
to_return(:body => fixture("gems.#{format}"))
|
145
155
|
end
|
@@ -151,66 +161,119 @@ describe Gems::Client do
|
|
151
161
|
gems.first.name.should == "congress"
|
152
162
|
end
|
153
163
|
end
|
164
|
+
end
|
165
|
+
end
|
154
166
|
|
155
|
-
|
167
|
+
describe ".owners" do
|
168
|
+
%w(json yaml).each do |format|
|
169
|
+
context "with format #{format}" do
|
156
170
|
before do
|
157
|
-
|
158
|
-
|
171
|
+
Gems.format = format
|
172
|
+
stub_get("/api/v1/gems/gems/owners.#{format}").
|
173
|
+
to_return(:body => fixture("owners.#{format}"))
|
159
174
|
end
|
160
175
|
|
161
176
|
it "should list all owners of a gem" do
|
162
177
|
owners = Gems.owners("gems")
|
163
|
-
a_get("/api/v1/gems/gems/owners
|
178
|
+
a_get("/api/v1/gems/gems/owners.#{format}").
|
164
179
|
should have_been_made
|
165
180
|
owners.first.email.should == "sferik@gmail.com"
|
166
181
|
end
|
167
182
|
end
|
183
|
+
end
|
184
|
+
end
|
168
185
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
186
|
+
describe ".add_owner" do
|
187
|
+
before do
|
188
|
+
stub_post("/api/v1/gems/gems/owners").
|
189
|
+
with(:body => {:email => "sferik@gmail.com"}).
|
190
|
+
to_return(:body => fixture("add_owner.json"))
|
191
|
+
end
|
174
192
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
193
|
+
it "should add an owner to a RubyGem" do
|
194
|
+
owner = Gems.add_owner("gems", "sferik@gmail.com")
|
195
|
+
a_post("/api/v1/gems/gems/owners").
|
196
|
+
with(:body => {:email => "sferik@gmail.com"}).
|
197
|
+
should have_been_made
|
198
|
+
owner.should == "Owner added successfully."
|
199
|
+
end
|
200
|
+
end
|
182
201
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
202
|
+
describe ".remove_owner" do
|
203
|
+
before do
|
204
|
+
stub_delete("/api/v1/gems/gems/owners").
|
205
|
+
with(:query => {:email => "sferik@gmail.com"}).
|
206
|
+
to_return(:body => fixture("remove_owner.json"))
|
207
|
+
end
|
189
208
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
209
|
+
it "should remove an owner from a RubyGem" do
|
210
|
+
owner = Gems.remove_owner("gems", "sferik@gmail.com")
|
211
|
+
a_delete("/api/v1/gems/gems/owners").
|
212
|
+
with(:query => {:email => "sferik@gmail.com"}).
|
213
|
+
should have_been_made
|
214
|
+
owner.should == "Owner removed successfully."
|
215
|
+
end
|
216
|
+
end
|
198
217
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
end
|
218
|
+
describe ".web_hooks" do
|
219
|
+
before do
|
220
|
+
stub_get("/api/v1/web_hooks.json").
|
221
|
+
to_return(:body => fixture("web_hooks.json"))
|
222
|
+
end
|
205
223
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
224
|
+
it "should list the webhooks registered under your account" do
|
225
|
+
web_hooks = Gems.web_hooks
|
226
|
+
a_get("/api/v1/web_hooks.json").
|
227
|
+
should have_been_made
|
228
|
+
web_hooks.rails.first.url.should == "http://example.com"
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
describe ".add_web_hook" do
|
233
|
+
before do
|
234
|
+
stub_post("/api/v1/web_hooks").
|
235
|
+
with(:body => {:gem_name => "*", :url => "http://example.com"}).
|
236
|
+
to_return(:body => fixture("add_web_hook"))
|
237
|
+
end
|
238
|
+
|
239
|
+
it "should add a web hook" do
|
240
|
+
add_web_hook = Gems.add_web_hook("*", "http://example.com")
|
241
|
+
a_post("/api/v1/web_hooks").
|
242
|
+
with(:body => {:gem_name => "*", :url => "http://example.com"}).
|
243
|
+
should have_been_made
|
244
|
+
add_web_hook.should == "Successfully created webhook for all gems to http://example.com"
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
describe ".remove_web_hook" do
|
249
|
+
before do
|
250
|
+
stub_delete("/api/v1/web_hooks/remove").
|
251
|
+
with(:query => {:gem_name => "*", :url => "http://example.com"}).
|
252
|
+
to_return(:body => fixture("remove_web_hook"))
|
253
|
+
end
|
254
|
+
|
255
|
+
it "should remove a web hook" do
|
256
|
+
remove_web_hook = Gems.remove_web_hook("*", "http://example.com")
|
257
|
+
a_delete("/api/v1/web_hooks/remove").
|
258
|
+
with(:query => {:gem_name => "*", :url => "http://example.com"}).
|
259
|
+
should have_been_made
|
260
|
+
remove_web_hook.should == "Successfully removed webhook for all gems to http://example.com"
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
describe ".fire_web_hook" do
|
265
|
+
before do
|
266
|
+
stub_post("/api/v1/web_hooks/fire").
|
267
|
+
with(:body => {:gem_name => "*", :url => "http://example.com"}).
|
268
|
+
to_return(:body => fixture("fire_web_hook"))
|
269
|
+
end
|
270
|
+
|
271
|
+
it "should fire a web hook" do
|
272
|
+
fire_web_hook = Gems.fire_web_hook("*", "http://example.com")
|
273
|
+
a_post("/api/v1/web_hooks/fire").
|
274
|
+
with(:body => {:gem_name => "*", :url => "http://example.com"}).
|
275
|
+
should have_been_made
|
276
|
+
fire_web_hook.should == "Successfully deployed webhook for gemcutter to http://example.com"
|
214
277
|
end
|
215
278
|
end
|
216
279
|
end
|
metadata
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
name: gems
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.8
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
- Erik Michaels-Ober
|
8
|
+
- Erik Michaels-Ober
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
@@ -13,141 +13,141 @@ cert_chain: []
|
|
13
13
|
date: 2011-07-01 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
- !ruby/object:Gem::Dependency
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
- !ruby/object:Gem::Dependency
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
- !ruby/object:Gem::Dependency
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: ZenTest
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "4.5"
|
25
|
+
type: :development
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: maruku
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ~>
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0.6"
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rake
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0.9"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rspec
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ~>
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "2.6"
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: simplecov
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0.4"
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: webmock
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ~>
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "1.6"
|
80
|
+
type: :development
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: yard
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ~>
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: "0.7"
|
91
|
+
type: :development
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: faraday
|
95
|
+
prerelease: false
|
96
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.6.1
|
102
|
+
type: :runtime
|
103
|
+
version_requirements: *id008
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: faraday_middleware
|
106
|
+
prerelease: false
|
107
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ~>
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 0.6.5
|
113
|
+
type: :runtime
|
114
|
+
version_requirements: *id009
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: hashie
|
117
|
+
prerelease: false
|
118
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ~>
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 1.0.0
|
124
|
+
type: :runtime
|
125
|
+
version_requirements: *id010
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: multi_json
|
128
|
+
prerelease: false
|
129
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ~>
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 1.0.3
|
135
|
+
type: :runtime
|
136
|
+
version_requirements: *id011
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: multi_xml
|
139
|
+
prerelease: false
|
140
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
141
|
+
none: false
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.2.2
|
146
|
+
type: :runtime
|
147
|
+
version_requirements: *id012
|
148
148
|
description: Ruby wrapper for the RubyGems.org API
|
149
149
|
email:
|
150
|
-
- sferik@gmail.com
|
150
|
+
- sferik@gmail.com
|
151
151
|
executables: []
|
152
152
|
|
153
153
|
extensions: []
|
@@ -155,39 +155,43 @@ extensions: []
|
|
155
155
|
extra_rdoc_files: []
|
156
156
|
|
157
157
|
files:
|
158
|
-
- .gemtest
|
159
|
-
- .gitignore
|
160
|
-
- .rspec
|
161
|
-
- .travis.yml
|
162
|
-
- .yardopts
|
163
|
-
- Gemfile
|
164
|
-
- LICENSE.md
|
165
|
-
- README.md
|
166
|
-
- Rakefile
|
167
|
-
- gems.gemspec
|
168
|
-
- lib/gems.rb
|
169
|
-
- lib/gems/client.rb
|
170
|
-
- lib/gems/configuration.rb
|
171
|
-
- lib/gems/connection.rb
|
172
|
-
- lib/gems/request.rb
|
173
|
-
- lib/gems/version.rb
|
174
|
-
- spec/fixtures/add_owner.json
|
175
|
-
- spec/fixtures/
|
176
|
-
- spec/fixtures/
|
177
|
-
- spec/fixtures/
|
178
|
-
- spec/fixtures/
|
179
|
-
- spec/fixtures/
|
180
|
-
- spec/fixtures/
|
181
|
-
- spec/fixtures/
|
182
|
-
- spec/fixtures/
|
183
|
-
- spec/fixtures/
|
184
|
-
- spec/fixtures/
|
185
|
-
- spec/fixtures/
|
186
|
-
- spec/fixtures/
|
187
|
-
- spec/fixtures/
|
188
|
-
- spec/
|
189
|
-
- spec/
|
190
|
-
- spec/
|
158
|
+
- .gemtest
|
159
|
+
- .gitignore
|
160
|
+
- .rspec
|
161
|
+
- .travis.yml
|
162
|
+
- .yardopts
|
163
|
+
- Gemfile
|
164
|
+
- LICENSE.md
|
165
|
+
- README.md
|
166
|
+
- Rakefile
|
167
|
+
- gems.gemspec
|
168
|
+
- lib/gems.rb
|
169
|
+
- lib/gems/client.rb
|
170
|
+
- lib/gems/configuration.rb
|
171
|
+
- lib/gems/connection.rb
|
172
|
+
- lib/gems/request.rb
|
173
|
+
- lib/gems/version.rb
|
174
|
+
- spec/fixtures/add_owner.json
|
175
|
+
- spec/fixtures/add_web_hook
|
176
|
+
- spec/fixtures/api_key
|
177
|
+
- spec/fixtures/coulda.json
|
178
|
+
- spec/fixtures/dependencies
|
179
|
+
- spec/fixtures/downloads.json
|
180
|
+
- spec/fixtures/fire_web_hook
|
181
|
+
- spec/fixtures/gems.json
|
182
|
+
- spec/fixtures/gems.xml
|
183
|
+
- spec/fixtures/owners.json
|
184
|
+
- spec/fixtures/owners.yaml
|
185
|
+
- spec/fixtures/rails.json
|
186
|
+
- spec/fixtures/rails.xml
|
187
|
+
- spec/fixtures/remove_owner.json
|
188
|
+
- spec/fixtures/remove_web_hook
|
189
|
+
- spec/fixtures/search.json
|
190
|
+
- spec/fixtures/search.xml
|
191
|
+
- spec/fixtures/web_hooks.json
|
192
|
+
- spec/gems/client_spec.rb
|
193
|
+
- spec/gems_spec.rb
|
194
|
+
- spec/helper.rb
|
191
195
|
has_rdoc: true
|
192
196
|
homepage: https://github.com/sferik/gems
|
193
197
|
licenses: []
|
@@ -196,41 +200,45 @@ post_install_message:
|
|
196
200
|
rdoc_options: []
|
197
201
|
|
198
202
|
require_paths:
|
199
|
-
- lib
|
203
|
+
- lib
|
200
204
|
required_ruby_version: !ruby/object:Gem::Requirement
|
201
205
|
none: false
|
202
206
|
requirements:
|
203
|
-
|
204
|
-
|
205
|
-
|
207
|
+
- - ">="
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: "0"
|
206
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
211
|
none: false
|
208
212
|
requirements:
|
209
|
-
|
210
|
-
|
211
|
-
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: "0"
|
212
216
|
requirements: []
|
213
217
|
|
214
218
|
rubyforge_project:
|
215
|
-
rubygems_version: 1.5.
|
219
|
+
rubygems_version: 1.5.1
|
216
220
|
signing_key:
|
217
221
|
specification_version: 3
|
218
222
|
summary: Ruby wrapper for the RubyGems.org API
|
219
223
|
test_files:
|
220
|
-
- spec/fixtures/add_owner.json
|
221
|
-
- spec/fixtures/
|
222
|
-
- spec/fixtures/
|
223
|
-
- spec/fixtures/
|
224
|
-
- spec/fixtures/
|
225
|
-
- spec/fixtures/
|
226
|
-
- spec/fixtures/
|
227
|
-
- spec/fixtures/
|
228
|
-
- spec/fixtures/
|
229
|
-
- spec/fixtures/
|
230
|
-
- spec/fixtures/
|
231
|
-
- spec/fixtures/
|
232
|
-
- spec/fixtures/
|
233
|
-
- spec/fixtures/
|
234
|
-
- spec/
|
235
|
-
- spec/
|
236
|
-
- spec/
|
224
|
+
- spec/fixtures/add_owner.json
|
225
|
+
- spec/fixtures/add_web_hook
|
226
|
+
- spec/fixtures/api_key
|
227
|
+
- spec/fixtures/coulda.json
|
228
|
+
- spec/fixtures/dependencies
|
229
|
+
- spec/fixtures/downloads.json
|
230
|
+
- spec/fixtures/fire_web_hook
|
231
|
+
- spec/fixtures/gems.json
|
232
|
+
- spec/fixtures/gems.xml
|
233
|
+
- spec/fixtures/owners.json
|
234
|
+
- spec/fixtures/owners.yaml
|
235
|
+
- spec/fixtures/rails.json
|
236
|
+
- spec/fixtures/rails.xml
|
237
|
+
- spec/fixtures/remove_owner.json
|
238
|
+
- spec/fixtures/remove_web_hook
|
239
|
+
- spec/fixtures/search.json
|
240
|
+
- spec/fixtures/search.xml
|
241
|
+
- spec/fixtures/web_hooks.json
|
242
|
+
- spec/gems/client_spec.rb
|
243
|
+
- spec/gems_spec.rb
|
244
|
+
- spec/helper.rb
|