gems 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ ---
2
+ :total: 244368950
@@ -0,0 +1,4 @@
1
+ ---
2
+ all gems:
3
+ - url: http://example.com
4
+ failure_count: 0
@@ -7,13 +7,13 @@ describe Gems::Client do
7
7
 
8
8
  describe ".info" do
9
9
  before do
10
- stub_get("/api/v1/gems/rails.json").
11
- to_return(:body => fixture("rails.json"))
10
+ stub_get("/api/v1/gems/rails.yaml").
11
+ to_return(:body => fixture("rails.yaml"))
12
12
  end
13
13
 
14
14
  it "should return some basic information about the given gem" do
15
15
  info = Gems.info 'rails'
16
- a_get("/api/v1/gems/rails.json").
16
+ a_get("/api/v1/gems/rails.yaml").
17
17
  should have_been_made
18
18
  info['name'].should == 'rails'
19
19
  end
@@ -21,14 +21,14 @@ describe Gems::Client do
21
21
 
22
22
  describe ".search" do
23
23
  before do
24
- stub_get("/api/v1/search.json").
24
+ stub_get("/api/v1/search.yaml").
25
25
  with(:query => {"query" => "cucumber"}).
26
- to_return(:body => fixture("search.json"))
26
+ to_return(:body => fixture("search.yaml"))
27
27
  end
28
28
 
29
29
  it "should return an array of active gems that match the query" do
30
30
  search = Gems.search 'cucumber'
31
- a_get("/api/v1/search.json").
31
+ a_get("/api/v1/search.yaml").
32
32
  with(:query => {"query" => "cucumber"}).
33
33
  should have_been_made
34
34
  search.first['name'].should == 'cucumber'
@@ -49,18 +49,72 @@ describe Gems::Client do
49
49
  end
50
50
  end
51
51
 
52
+ describe ".total_downloads" do
53
+ context "with no version or gem name specified" do
54
+ before do
55
+ stub_get("/api/v1/downloads.yaml").
56
+ to_return(:body => fixture("total_downloads.yaml"))
57
+ end
58
+
59
+ it "should return the total number of downloads on RubyGems.org" do
60
+ downloads = Gems.total_downloads
61
+ a_get("/api/v1/downloads.yaml").
62
+ should have_been_made
63
+ downloads[:total].should == 244368950
64
+ end
65
+ end
66
+
67
+ context "with no version specified" do
68
+ before do
69
+ stub_get("/api/v1/gems/rails_admin.yaml").
70
+ to_return(:body => fixture("rails.yaml"))
71
+ stub_get("/api/v1/downloads/rails_admin-3.0.9.yaml").
72
+ to_return(:body => fixture("rails_admin-0.0.0.yaml"))
73
+ end
74
+
75
+ it "should the total number of downloads for the specified gem" do
76
+ downloads = Gems.total_downloads('rails_admin')
77
+ a_get("/api/v1/gems/rails_admin.yaml").
78
+ should have_been_made
79
+ a_get("/api/v1/downloads/rails_admin-3.0.9.yaml").
80
+ should have_been_made
81
+ downloads[:version_downloads].should == 3142
82
+ downloads[:total_downloads].should == 3142
83
+ end
84
+ end
85
+
86
+ context "with a version specified" do
87
+ before do
88
+ stub_get("/api/v1/downloads/rails_admin-0.0.0.yaml").
89
+ to_return(:body => fixture("rails_admin-0.0.0.yaml"))
90
+ end
91
+
92
+ it "should the total number of downloads for the specified gem" do
93
+ downloads = Gems.total_downloads('rails_admin', '0.0.0')
94
+ a_get("/api/v1/downloads/rails_admin-0.0.0.yaml").
95
+ should have_been_made
96
+ downloads[:version_downloads].should == 3142
97
+ downloads[:total_downloads].should == 3142
98
+ end
99
+ end
100
+
101
+ end
102
+
52
103
  describe ".downloads" do
104
+
53
105
  context "with no dates or version specified" do
54
106
  before do
55
- stub_get("/api/v1/gems/coulda.json").
56
- to_return(:body => fixture("rails.json"))
57
- stub_get("/api/v1/versions/coulda-3.0.9/downloads.json").
58
- to_return(:body => fixture("downloads.json"))
107
+ stub_get("/api/v1/gems/coulda.yaml").
108
+ to_return(:body => fixture("rails.yaml"))
109
+ stub_get("/api/v1/versions/coulda-3.0.9/downloads.yaml").
110
+ to_return(:body => fixture("downloads.yaml"))
59
111
  end
60
112
 
61
113
  it "should return the number of downloads by day for a particular gem version" do
62
114
  downloads = Gems.downloads 'coulda'
63
- a_get("/api/v1/versions/coulda-3.0.9/downloads.json").
115
+ a_get("/api/v1/gems/coulda.yaml").
116
+ should have_been_made
117
+ a_get("/api/v1/versions/coulda-3.0.9/downloads.yaml").
64
118
  should have_been_made
65
119
  downloads['2011-06-22'].should == 8
66
120
  end
@@ -68,13 +122,13 @@ describe Gems::Client do
68
122
 
69
123
  context "with no dates specified" do
70
124
  before do
71
- stub_get("/api/v1/versions/coulda-0.6.3/downloads.json").
72
- to_return(:body => fixture("downloads.json"))
125
+ stub_get("/api/v1/versions/coulda-0.6.3/downloads.yaml").
126
+ to_return(:body => fixture("downloads.yaml"))
73
127
  end
74
128
 
75
129
  it "should return the number of downloads by day for a particular gem version" do
76
130
  downloads = Gems.downloads 'coulda', '0.6.3'
77
- a_get("/api/v1/versions/coulda-0.6.3/downloads.json").
131
+ a_get("/api/v1/versions/coulda-0.6.3/downloads.yaml").
78
132
  should have_been_made
79
133
  downloads['2011-06-22'].should == 8
80
134
  end
@@ -82,14 +136,14 @@ describe Gems::Client do
82
136
 
83
137
  context "with from date specified" do
84
138
  before do
85
- stub_get("/api/v1/versions/coulda-0.6.3/downloads/search.json").
139
+ stub_get("/api/v1/versions/coulda-0.6.3/downloads/search.yaml").
86
140
  with(:query => {"from" => "2011-01-01", "to" => Date.today.to_s}).
87
- to_return(:body => fixture("downloads.json"))
141
+ to_return(:body => fixture("downloads.yaml"))
88
142
  end
89
143
 
90
144
  it "should return the number of downloads by day for a particular gem version" do
91
145
  downloads = Gems.downloads 'coulda', '0.6.3', Date.parse('2011-01-01')
92
- a_get("/api/v1/versions/coulda-0.6.3/downloads/search.json").
146
+ a_get("/api/v1/versions/coulda-0.6.3/downloads/search.yaml").
93
147
  with(:query => {"from" => "2011-01-01", "to" => Date.today.to_s}).
94
148
  should have_been_made
95
149
  downloads['2011-06-22'].should == 8
@@ -98,14 +152,14 @@ describe Gems::Client do
98
152
 
99
153
  context "with from and to dates specified" do
100
154
  before do
101
- stub_get("/api/v1/versions/coulda-0.6.3/downloads/search.json").
155
+ stub_get("/api/v1/versions/coulda-0.6.3/downloads/search.yaml").
102
156
  with(:query => {"from" => "2011-01-01", "to" => "2011-06-28"}).
103
- to_return(:body => fixture("downloads.json"))
157
+ to_return(:body => fixture("downloads.yaml"))
104
158
  end
105
159
 
106
160
  it "should return the number of downloads by day for a particular gem version" do
107
161
  downloads = Gems.downloads 'coulda', '0.6.3', Date.parse('2011-01-01'), Date.parse('2011-06-28')
108
- a_get("/api/v1/versions/coulda-0.6.3/downloads/search.json").
162
+ a_get("/api/v1/versions/coulda-0.6.3/downloads/search.yaml").
109
163
  with(:query => {"from" => "2011-01-01", "to" => "2011-06-28"}).
110
164
  should have_been_made
111
165
  downloads['2011-06-22'].should == 8
@@ -149,15 +203,15 @@ describe Gems::Client do
149
203
 
150
204
  describe ".gems" do
151
205
  before do
152
- stub_get("/api/v1/gems.json").
153
- to_return(:body => fixture("gems.json"))
206
+ stub_get("/api/v1/gems.yaml").
207
+ to_return(:body => fixture("gems.yaml"))
154
208
  end
155
209
 
156
210
  it "should list all gems that you own" do
157
211
  gems = Gems.gems
158
- a_get("/api/v1/gems.json").
212
+ a_get("/api/v1/gems.yaml").
159
213
  should have_been_made
160
- gems.first['name'].should == "congress"
214
+ gems.first['name'].should == "exchb"
161
215
  end
162
216
  end
163
217
 
@@ -179,7 +233,7 @@ describe Gems::Client do
179
233
  before do
180
234
  stub_post("/api/v1/gems/gems/owners").
181
235
  with(:body => {:email => "sferik@gmail.com"}).
182
- to_return(:body => fixture("add_owner.json"))
236
+ to_return(:body => fixture("add_owner"))
183
237
  end
184
238
 
185
239
  it "should add an owner to a RubyGem" do
@@ -195,7 +249,7 @@ describe Gems::Client do
195
249
  before do
196
250
  stub_delete("/api/v1/gems/gems/owners").
197
251
  with(:query => {:email => "sferik@gmail.com"}).
198
- to_return(:body => fixture("remove_owner.json"))
252
+ to_return(:body => fixture("remove_owner"))
199
253
  end
200
254
 
201
255
  it "should remove an owner from a RubyGem" do
@@ -209,15 +263,15 @@ describe Gems::Client do
209
263
 
210
264
  describe ".web_hooks" do
211
265
  before do
212
- stub_get("/api/v1/web_hooks.json").
213
- to_return(:body => fixture("web_hooks.json"))
266
+ stub_get("/api/v1/web_hooks.yaml").
267
+ to_return(:body => fixture("web_hooks.yaml"))
214
268
  end
215
269
 
216
- it "should list the webhooks registered under your account" do
270
+ it "should list the web hooks registered under your account" do
217
271
  web_hooks = Gems.web_hooks
218
- a_get("/api/v1/web_hooks.json").
272
+ a_get("/api/v1/web_hooks.yaml").
219
273
  should have_been_made
220
- web_hooks['rails'].first['url'].should == "http://example.com"
274
+ web_hooks['all gems'].first['url'].should == "http://example.com"
221
275
  end
222
276
  end
223
277
 
@@ -286,8 +340,8 @@ describe Gems::Client do
286
340
  describe ".yank" do
287
341
  context "with no version specified" do
288
342
  before do
289
- stub_get("/api/v1/gems/gems.json").
290
- to_return(:body => fixture("rails.json"))
343
+ stub_get("/api/v1/gems/gems.yaml").
344
+ to_return(:body => fixture("rails.yaml"))
291
345
  stub_delete("/api/v1/gems/yank").
292
346
  with(:query => {:gem_name => "gems", :version => "3.0.9"}).
293
347
  to_return(:body => fixture("yank"))
@@ -322,8 +376,8 @@ describe Gems::Client do
322
376
  describe ".unyank" do
323
377
  context "with no version specified" do
324
378
  before do
325
- stub_get("/api/v1/gems/gems.json").
326
- to_return(:body => fixture("rails.json"))
379
+ stub_get("/api/v1/gems/gems.yaml").
380
+ to_return(:body => fixture("rails.yaml"))
327
381
  stub_put("/api/v1/gems/unyank").
328
382
  with(:body => {:gem_name => "gems", :version => "3.0.9"}).
329
383
  to_return(:body => fixture("unyank"))
data/spec/gems_spec.rb CHANGED
@@ -3,14 +3,14 @@ require 'helper'
3
3
  describe Gems do
4
4
  context "when delegating to a client" do
5
5
  before do
6
- stub_get("/api/v1/gems/rails.json").
7
- to_return(:body => fixture("rails.json"))
6
+ stub_get("/api/v1/gems/rails.yaml").
7
+ to_return(:body => fixture("rails.yaml"))
8
8
  Gems.reset
9
9
  end
10
10
 
11
11
  it "should get the correct resource" do
12
12
  Gems.info('rails')
13
- a_get("/api/v1/gems/rails.json").should have_been_made
13
+ a_get("/api/v1/gems/rails.yaml").should have_been_made
14
14
  end
15
15
 
16
16
  it "should return the same results as a client" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gems
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-18 00:00:00.000000000 -07:00
12
+ date: 2011-08-02 00:00:00.000000000 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ZenTest
17
- requirement: &70168231492860 !ruby/object:Gem::Requirement
17
+ requirement: &70290861639460 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '4.5'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *70168231492860
25
+ version_requirements: *70290861639460
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: maruku
28
- requirement: &70168231492000 !ruby/object:Gem::Requirement
28
+ requirement: &70290861638960 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0.6'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70168231492000
36
+ version_requirements: *70290861638960
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rake
39
- requirement: &70168231491100 !ruby/object:Gem::Requirement
39
+ requirement: &70290861638500 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0.9'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *70168231491100
47
+ version_requirements: *70290861638500
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rspec
50
- requirement: &70168231510480 !ruby/object:Gem::Requirement
50
+ requirement: &70290861638040 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '2.6'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *70168231510480
58
+ version_requirements: *70290861638040
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: simplecov
61
- requirement: &70168231509760 !ruby/object:Gem::Requirement
61
+ requirement: &70290861637580 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0.4'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *70168231509760
69
+ version_requirements: *70290861637580
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: webmock
72
- requirement: &70168231509140 !ruby/object:Gem::Requirement
72
+ requirement: &70290861637120 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '1.6'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *70168231509140
80
+ version_requirements: *70290861637120
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: yard
83
- requirement: &70168231508480 !ruby/object:Gem::Requirement
83
+ requirement: &70290861666840 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,18 +88,7 @@ dependencies:
88
88
  version: '0.7'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *70168231508480
92
- - !ruby/object:Gem::Dependency
93
- name: multi_json
94
- requirement: &70168231507720 !ruby/object:Gem::Requirement
95
- none: false
96
- requirements:
97
- - - ~>
98
- - !ruby/object:Gem::Version
99
- version: 1.0.3
100
- type: :runtime
101
- prerelease: false
102
- version_requirements: *70168231507720
91
+ version_requirements: *70290861666840
103
92
  description: Ruby wrapper for the RubyGems.org API
104
93
  email:
105
94
  - sferik@gmail.com
@@ -122,33 +111,31 @@ files:
122
111
  - lib/gems/configuration.rb
123
112
  - lib/gems/request.rb
124
113
  - lib/gems/version.rb
125
- - spec/fixtures/add_owner.json
114
+ - spec/fixtures/add_owner
126
115
  - spec/fixtures/add_web_hook
127
116
  - spec/fixtures/api_key
128
117
  - spec/fixtures/coulda.json
129
118
  - spec/fixtures/dependencies
130
- - spec/fixtures/downloads.json
119
+ - spec/fixtures/downloads.yaml
131
120
  - spec/fixtures/fire_web_hook
132
121
  - spec/fixtures/gems-0.0.8.gem
133
- - spec/fixtures/gems.json
134
- - spec/fixtures/gems.xml
135
- - spec/fixtures/owners.json
122
+ - spec/fixtures/gems.yaml
136
123
  - spec/fixtures/owners.yaml
137
124
  - spec/fixtures/push
138
- - spec/fixtures/rails.json
139
- - spec/fixtures/rails.xml
140
- - spec/fixtures/remove_owner.json
125
+ - spec/fixtures/rails.yaml
126
+ - spec/fixtures/rails_admin-0.0.0.yaml
127
+ - spec/fixtures/remove_owner
141
128
  - spec/fixtures/remove_web_hook
142
- - spec/fixtures/search.json
143
- - spec/fixtures/search.xml
129
+ - spec/fixtures/search.yaml
130
+ - spec/fixtures/total_downloads.yaml
144
131
  - spec/fixtures/unyank
145
- - spec/fixtures/web_hooks.json
132
+ - spec/fixtures/web_hooks.yaml
146
133
  - spec/fixtures/yank
147
134
  - spec/gems/client_spec.rb
148
135
  - spec/gems_spec.rb
149
136
  - spec/helper.rb
150
137
  has_rdoc: true
151
- homepage: https://github.com/sferik/gems
138
+ homepage: https://github.com/rubygems/gems
152
139
  licenses: []
153
140
  post_install_message:
154
141
  rdoc_options: []
@@ -159,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
146
  requirements:
160
147
  - - ! '>='
161
148
  - !ruby/object:Gem::Version
162
- version: '0'
149
+ version: '1.9'
163
150
  required_rubygems_version: !ruby/object:Gem::Requirement
164
151
  none: false
165
152
  requirements:
@@ -173,27 +160,25 @@ signing_key:
173
160
  specification_version: 3
174
161
  summary: Ruby wrapper for the RubyGems.org API
175
162
  test_files:
176
- - spec/fixtures/add_owner.json
163
+ - spec/fixtures/add_owner
177
164
  - spec/fixtures/add_web_hook
178
165
  - spec/fixtures/api_key
179
166
  - spec/fixtures/coulda.json
180
167
  - spec/fixtures/dependencies
181
- - spec/fixtures/downloads.json
168
+ - spec/fixtures/downloads.yaml
182
169
  - spec/fixtures/fire_web_hook
183
170
  - spec/fixtures/gems-0.0.8.gem
184
- - spec/fixtures/gems.json
185
- - spec/fixtures/gems.xml
186
- - spec/fixtures/owners.json
171
+ - spec/fixtures/gems.yaml
187
172
  - spec/fixtures/owners.yaml
188
173
  - spec/fixtures/push
189
- - spec/fixtures/rails.json
190
- - spec/fixtures/rails.xml
191
- - spec/fixtures/remove_owner.json
174
+ - spec/fixtures/rails.yaml
175
+ - spec/fixtures/rails_admin-0.0.0.yaml
176
+ - spec/fixtures/remove_owner
192
177
  - spec/fixtures/remove_web_hook
193
- - spec/fixtures/search.json
194
- - spec/fixtures/search.xml
178
+ - spec/fixtures/search.yaml
179
+ - spec/fixtures/total_downloads.yaml
195
180
  - spec/fixtures/unyank
196
- - spec/fixtures/web_hooks.json
181
+ - spec/fixtures/web_hooks.yaml
197
182
  - spec/fixtures/yank
198
183
  - spec/gems/client_spec.rb
199
184
  - spec/gems_spec.rb