hoptoad-api 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.1
4
+ - 1.9.2
5
+ - jruby
6
+ - rbx
7
+ - ree
8
+ - ruby-head
data/Gemfile CHANGED
@@ -1,2 +1,7 @@
1
1
  source "http://rubygems.org"
2
+
3
+ platforms :jruby do
4
+ gem 'jruby-openssl', '~> 0.7'
5
+ end
6
+
2
7
  gemspec
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Hoptoad API
2
2
  ===========
3
3
 
4
- An unofficial Ruby library for interacting with the [Hoptoad API](http://hoptoadapp.com/pages/api)
4
+ A ruby wrapper for the [Hoptoad API](http://hoptoadapp.com/pages/api)
5
5
 
6
6
  Usage
7
7
  -----
@@ -38,7 +38,7 @@ To find an individual error, you can find by ID:
38
38
 
39
39
  Find *all* notices of an error:
40
40
 
41
- Hoptoad::Notice.all(error_id)
41
+ Hoptoad::Notice.find_all_by_error_id(error_id)
42
42
 
43
43
  Find an individual notice:
44
44
 
@@ -48,6 +48,16 @@ To resolve an error via the API:
48
48
 
49
49
  Hoptoad::Error.update(1696170, :group => { :resolved => true})
50
50
 
51
+ Recreate an error:
52
+
53
+ STDOUT.sync = true
54
+ Hoptoad::Notice.find_all_by_error_id(error_id) do |batch|
55
+ batch.each do |notice|
56
+ result = system "curl --silent '#{notice.request.url}' > /dev/null"
57
+ print (result ? '.' : 'F')
58
+ end
59
+ end
60
+
51
61
  Projects
52
62
  --------
53
63
 
@@ -61,14 +71,9 @@ Responses
61
71
  If an error is returned from the API. A HoptoadError will be raised. Successful responses will return a Hashie::Mash object based on the data from the response.
62
72
 
63
73
 
64
- Requirements
65
- ------------
66
-
67
- * HTTParty
68
- * Hashie
69
-
70
74
  Contributors
71
75
  ------------
72
76
 
73
- * Matias Käkelä (SSL Support)
74
- * Jordan Brough (Notices)
77
+ * [Matias Käkelä](https://github.com/massive) - SSL Support
78
+ * [Jordan Brough](https://github.com/jordan-brough) - Notices
79
+ * [Michael Grosser](https://github.com/grosser) - Numerous performance improvements and bug fixes
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
7
7
  s.version = Hoptoad::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
9
 
10
- s.summary = "Hoptoad API"
11
- s.description = "An unofficial gem for interacting with the Hoptoad API"
10
+ s.summary = "A ruby wrapper for the Hoptoad API"
11
+ s.description = "A ruby wrapper for the Hoptoad API"
12
12
 
13
13
  s.authors = ['Steve Agalloco']
14
14
  s.email = ['steve.agalloco@gmail.com']
@@ -16,13 +16,13 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.add_dependency(%q<httparty>, [">= 0.5.2"])
18
18
  s.add_dependency(%q<hashie>, [">= 0.2.0"])
19
+ s.add_dependency(%q<parallel>, [">= 0.5.0"])
19
20
 
20
- s.add_development_dependency('bundler', '~> 1.0')
21
- s.add_development_dependency('rake', '~> 0.8')
22
- s.add_development_dependency('rspec', '~> 2.5.0')
23
- s.add_development_dependency('yard', '~> 0.6')
21
+ s.add_development_dependency('rake', '~> 0.9.2')
22
+ s.add_development_dependency('rspec', '~> 2.6.0')
23
+ s.add_development_dependency('yard', '~> 0.7.2')
24
24
  s.add_development_dependency('maruku', '~> 0.6')
25
- s.add_development_dependency('simplecov', '~> 0.3')
25
+ s.add_development_dependency('simplecov', '~> 0.4.2')
26
26
  s.add_development_dependency('fakeweb', '~> 1.3.0')
27
27
 
28
28
  # ensure the gem is built out of versioned files
@@ -30,4 +30,4 @@ Gem::Specification.new do |s|
30
30
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
31
31
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
32
32
  s.require_paths = ["lib"]
33
- end
33
+ end
@@ -27,4 +27,15 @@ module Hoptoad
27
27
  end
28
28
 
29
29
  end
30
- end
30
+ end
31
+
32
+ # hoptoad sometimes returns broken xml with strange utmz stuff
33
+ # so we remove this
34
+ require 'httparty/parser'
35
+ class HTTParty::Parser
36
+ alias utmz_unaware_xml xml
37
+ def xml
38
+ body.gsub!(/<__utmz>.*?<\/__utmz>/m,'')
39
+ utmz_unaware_xml
40
+ end
41
+ end
@@ -2,4 +2,4 @@ class Array
2
2
  def extract_options!
3
3
  last.is_a?(::Hash) ? pop : {}
4
4
  end
5
- end
5
+ end
@@ -1,5 +1,9 @@
1
+ require 'parallel'
2
+
1
3
  module Hoptoad
2
4
  class Notice < Hoptoad::Base
5
+ PER_PAGE = 30
6
+ PARALLEL_WORKERS = 10
3
7
 
4
8
  def self.find(id, error_id, options={})
5
9
  setup
@@ -25,12 +29,14 @@ module Hoptoad
25
29
  if hash.errors
26
30
  raise HoptoadError.new(results.errors.error)
27
31
  end
28
- notice_stubs = hash.notices
29
32
 
30
- notice_stubs.map do |notice|
31
- notices << find(notice.id, error_id)
33
+ batch = Parallel.map(hash.notices, :in_threads => PARALLEL_WORKERS) do |notice_stub|
34
+ find(notice_stub.id, error_id)
32
35
  end
33
- break if notice_stubs.size < 30
36
+ yield batch if block_given?
37
+ batch.each{|n| notices << n }
38
+
39
+ break if batch.size < PER_PAGE
34
40
  page += 1
35
41
  end
36
42
  notices
@@ -57,4 +63,4 @@ module Hoptoad
57
63
  "/errors/#{error_id}/notices.xml"
58
64
  end
59
65
  end
60
- end
66
+ end
@@ -1,3 +1,3 @@
1
1
  module Hoptoad
2
- VERSION = '2.4.0'
2
+ VERSION = '2.5.0'
3
3
  end
@@ -0,0 +1,288 @@
1
+ HTTP/1.1 200 OK
2
+
3
+ <?xml version="1.0" encoding="UTF-8"?>
4
+ <notice>
5
+ <created-at type="datetime">2011-07-06T09:38:44Z</created-at>
6
+ <project-id type="integer">849</project-id>
7
+ <updated-at type="datetime">2011-07-06T09:38:44Z</updated-at>
8
+ <error-message>TypeError: can't convert Fixnum into String</error-message>
9
+ <group-id type="integer">9004013</group-id>
10
+
11
+ <id type="integer">1625800089</id>
12
+ <environment>
13
+ <rack-session></rack-session>
14
+ <HTTP_ACCEPT>
15
+ </HTTP_ACCEPT>
16
+ <HTTP_HOST>
17
+ <de-dawanda-com></de-dawanda-com>
18
+ </HTTP_HOST>
19
+
20
+ <SERVER_NAME>
21
+ <cookie4-dawanda-com></cookie4-dawanda-com>
22
+ </SERVER_NAME>
23
+ <HTTP_X_REAL_IP>
24
+ <127-0-0-1></127-0-0-1>
25
+ </HTTP_X_REAL_IP>
26
+ <HTTP_USER_AGENT>
27
+ <infopath-2></infopath-2>
28
+
29
+ <net-clr-3-0-30729></net-clr-3-0-30729>
30
+ <trident-4-0></trident-4-0>
31
+ <msie-7-0></msie-7-0>
32
+ <net-clr-3-5-30729></net-clr-3-5-30729>
33
+ <slcc2></slcc2>
34
+ <gtb7-1></gtb7-1>
35
+ <windows-nt-6-1></windows-nt-6-1>
36
+ <net4-0c></net4-0c>
37
+ <media-center-pc-6-0></media-center-pc-6-0>
38
+
39
+ <net-clr-2-0-50727></net-clr-2-0-50727>
40
+ <wow64></wow64>
41
+ <msoffice-12></msoffice-12>
42
+ <mozilla-4-0-compatible></mozilla-4-0-compatible>
43
+ </HTTP_USER_AGENT>
44
+ <PASSENGER_SPAWN_METHOD>
45
+ <smart></smart>
46
+ </PASSENGER_SPAWN_METHOD>
47
+ <PASSENGER_CONNECT_PASSWORD>
48
+
49
+ <c3q43q3iskkbtzcbxvclhjpuvbbx7ras5bgc7xnbbst></c3q43q3iskkbtzcbxvclhjpuvbbx7ras5bgc7xnbbst>
50
+ </PASSENGER_CONNECT_PASSWORD>
51
+ <PASSENGER_FRIENDLY_ERROR_PAGES>
52
+ <true></true>
53
+ </PASSENGER_FRIENDLY_ERROR_PAGES>
54
+ <rack.url_scheme>
55
+ <http></http>
56
+ </rack.url_scheme>
57
+ <CONTENT_LENGTH>
58
+
59
+ <0></0>
60
+ </CONTENT_LENGTH>
61
+ <rack.request.cookie_hash>
62
+ <__utma>
63
+ <65743547-2098315535-1306779867-1309858755-1309861793-21></65743547-2098315535-1306779867-1309858755-1309861793-21>
64
+ </__utma>
65
+ <__utmv>
66
+ <65743547-user></65743547-user>
67
+
68
+ </__utmv>
69
+ <ulc>
70
+ <1309635910></1309635910>
71
+ </ulc>
72
+ <__utmz>
73
+ <65743547.1306779867.1.1.utmcsr>
74
+ <(direct)|utmccn>
75
+ <(direct)|utmcmd>
76
+ <none></none>
77
+ </(direct)|utmcmd>
78
+
79
+ </(direct)|utmccn>
80
+ </65743547.1306779867.1.1.utmcsr>
81
+ </__utmz>
82
+ <lang>
83
+ <de-de></de-de>
84
+ </lang>
85
+ <remember_token>
86
+ <1df0267eec3557f3cebc805fe41a8719ae566767></1df0267eec3557f3cebc805fe41a8719ae566767>
87
+
88
+ </remember_token>
89
+ <dawanda_vanity8>
90
+ <8452434631e07058ce4491ca7d1fc65c></8452434631e07058ce4491ca7d1fc65c>
91
+ </dawanda_vanity8>
92
+ <partner>
93
+ <dawanda-de></dawanda-de>
94
+ </partner>
95
+ </rack.request.cookie_hash>
96
+
97
+ <rack.errors>
98
+ <io-0x3c91fa0></io-0x3c91fa0>
99
+ </rack.errors>
100
+ <action-controller-request-request-parameters></action-controller-request-request-parameters>
101
+ <SERVER_PROTOCOL>
102
+ <http-1-0></http-1-0>
103
+ </SERVER_PROTOCOL>
104
+ <SERVER_SOFTWARE>
105
+ <nginx-0-8-52></nginx-0-8-52>
106
+
107
+ </SERVER_SOFTWARE>
108
+ <PASSENGER_MIN_INSTANCES>
109
+ <5></5>
110
+ </PASSENGER_MIN_INSTANCES>
111
+ <REMOTE_ADDR>
112
+ <192-168-2-22></192-168-2-22>
113
+ </REMOTE_ADDR>
114
+ <PASSENGER_ANALYTICS>
115
+
116
+ <false></false>
117
+ </PASSENGER_ANALYTICS>
118
+ <rack.version>
119
+ <0></0>
120
+ <1></1>
121
+ </rack.version>
122
+ <PATH_INFO>
123
+ <counters-secure-pixel></counters-secure-pixel>
124
+
125
+ </PATH_INFO>
126
+ <rack.run_once>
127
+ <false></false>
128
+ </rack.run_once>
129
+ <SERVER_ADDR>
130
+ <192-168-2-25></192-168-2-25>
131
+ </SERVER_ADDR>
132
+ <rack.request.cookie_string>
133
+
134
+ <ulc>
135
+ <1309635910></1309635910>
136
+ </ulc>
137
+ <__utmv>
138
+ <65743547-user></65743547-user>
139
+ </__utmv>
140
+ <__utma>
141
+ <65743547-2098315535-1306779867-1309858755-1309861793-21></65743547-2098315535-1306779867-1309858755-1309861793-21>
142
+
143
+ </__utma>
144
+ <__utmz>
145
+ <65743547.1306779867.1.1.utmcsr>
146
+ <(direct)|utmccn>
147
+ <(direct)|utmcmd>
148
+ <none></none>
149
+ </(direct)|utmcmd>
150
+ </(direct)|utmccn>
151
+ </65743547.1306779867.1.1.utmcsr>
152
+ </__utmz>
153
+ <remember_token>
154
+
155
+ <1df0267eec3557f3cebc805fe41a8719ae566767></1df0267eec3557f3cebc805fe41a8719ae566767>
156
+ </remember_token>
157
+ <lang>
158
+ <de-de></de-de>
159
+ </lang>
160
+ </rack.request.cookie_string>
161
+ </environment>
162
+ <session>
163
+
164
+ <data>
165
+ </data>
166
+ </session>
167
+ <request>
168
+ <rails-root>/srv/dawanda.com/releases/20110622211451</rails-root>
169
+ <url>http://de.dawanda.com/counters/secure_pixel?data=eJxj4ajmsOJKL8ovLVCSjs9NzMzRTUnVzS9KSS2KL87ILChITbHiTEksSVXiNzIwNNQ1MNc1MLPizEvMTVXiKstMLS8GAJ-5FAY|b004b9e2a6bde04eb349bd1d51dced20aeacab2c&amp;expires=never</url>
170
+ <params>
171
+
172
+ <data>
173
+ <ejxj4ajmsojkl8ovlvcsjs9nzmzrtunvzs9kss2kl87ilchitbhitekssvxinziwnnq1mnc1mlpizevmtvxikstmls8gaj-5fay-b004b9e2a6bde04eb349bd1d51dced20aeacab2c></ejxj4ajmsojkl8ovlvcsjs9nzmzrtunvzs9kss2kl87ilchitbhitekssvxinziwnnq1mnc1mlpizevmtvxikstmls8gaj-5fay-b004b9e2a6bde04eb349bd1d51dced20aeacab2c>
174
+ </data>
175
+ <expires>
176
+ <never></never>
177
+ </expires>
178
+ <action>secure_pixel</action>
179
+ <controller>counters</controller>
180
+
181
+ </params>
182
+ </request>
183
+ <backtrace>
184
+ <line>[PROJECT_ROOT]/app/models/counter.rb:64:in `+'</line>
185
+ <line>[PROJECT_ROOT]/app/models/counter.rb:64:in `counter_for_date'</line>
186
+ <line>[PROJECT_ROOT]/app/models/counter.rb:54:in `counter_id_for_date'</line>
187
+ <line>[PROJECT_ROOT]/vendor/plugins/cachy/lib/cachy.rb:28:in `cache'</line>
188
+
189
+ <line>[PROJECT_ROOT]/app/models/counter.rb:53:in `counter_id_for_date'</line>
190
+ <line>[PROJECT_ROOT]/app/models/counter.rb:12:in `increment_for_date'</line>
191
+ <line>[PROJECT_ROOT]/app/controllers/counters_controller.rb:16:in `secure_pixel'</line>
192
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/base.rb:1333:in `send'</line>
193
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/base.rb:1333:in `perform_action_without_filters'</line>
194
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/filters.rb:617:in `call_filters'</line>
195
+
196
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'</line>
197
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'</line>
198
+ <line>/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in `ms'</line>
199
+ <line>/usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'</line>
200
+ <line>/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in `ms'</line>
201
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'</line>
202
+
203
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'</line>
204
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/flash.rb:151:in `perform_action_without_newrelic_trace'</line>
205
+ <line>[GEM_ROOT]/gems/newrelic_rpm-2.13.3/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:254:in `perform_action'</line>
206
+ <line>[GEM_ROOT]/gems/newrelic_rpm-2.13.3/lib/new_relic/agent/method_tracer.rb:141:in `trace_execution_scoped'</line>
207
+ <line>[GEM_ROOT]/gems/newrelic_rpm-2.13.3/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:247:in `perform_action'</line>
208
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:in `send'</line>
209
+
210
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:in `process_without_filters'</line>
211
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/filters.rb:606:in `process'</line>
212
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/base.rb:391:in `process'</line>
213
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/base.rb:386:in `call'</line>
214
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/routing/route_set.rb:438:in `call'</line>
215
+ <line>/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:87:in `dispatch'</line>
216
+
217
+ <line>/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:121:in `_call'</line>
218
+ <line>/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'</line>
219
+ <line>/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:29:in `call'</line>
220
+ <line>/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:29:in `call'</line>
221
+ <line>/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'</line>
222
+ <line>[PROJECT_ROOT]/vendor/plugins/masochism/lib/active_reload/connection_proxy.rb:137:in `send'</line>
223
+
224
+ <line>[PROJECT_ROOT]/vendor/plugins/masochism/lib/active_reload/connection_proxy.rb:137:in `method_missing'</line>
225
+ <line>/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:9:in `cache'</line>
226
+ <line>/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:28:in `call'</line>
227
+ <line>/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'</line>
228
+ <line>[PROJECT_ROOT]/vendor/plugins/api-throttling/lib/api_throttling.rb:16:in `call'</line>
229
+ <line>[PROJECT_ROOT]/lib/http_verb_responder.rb:11:in `call'</line>
230
+
231
+ <line>[PROJECT_ROOT]/lib/meta_info.rb:9:in `call'</line>
232
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/string_coercion.rb:25:in `call'</line>
233
+ <line>[GEM_ROOT]/gems/rack-1.1.0/lib/rack/head.rb:9:in `call'</line>
234
+ <line>[GEM_ROOT]/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in `call'</line>
235
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/params_parser.rb:15:in `call'</line>
236
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/session/abstract_store.rb:177:in `call'</line>
237
+
238
+ <line>[GEM_ROOT]/gems/activesupport-2.3.11/lib/active_support/cache/strategy/local_cache.rb:25:in `call'</line>
239
+ <line>[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/failsafe.rb:26:in `call'</line>
240
+ <line>[GEM_ROOT]/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'</line>
241
+ <line>[GEM_ROOT]/gems/rack-1.1.0/lib/rack/lock.rb:11:in `synchronize'</line>
242
+ <line>[GEM_ROOT]/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'</line>
243
+ <line>/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:106:in `call'</line>
244
+
245
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'</line>
246
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'</line>
247
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'</line>
248
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'</line>
249
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'</line>
250
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'</line>
251
+
252
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/utils.rb:479:in `safe_fork'</line>
253
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'</line>
254
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:357:in `__send__'</line>
255
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'</line>
256
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'</line>
257
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:180:in `start'</line>
258
+
259
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'</line>
260
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/framework_spawner.rb:268:in `handle_spawn_application'</line>
261
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'</line>
262
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/framework_spawner.rb:263:in `handle_spawn_application'</line>
263
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'</line>
264
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'</line>
265
+
266
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/framework_spawner.rb:261:in `handle_spawn_application'</line>
267
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:357:in `__send__'</line>
268
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'</line>
269
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'</line>
270
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:180:in `start'</line>
271
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/framework_spawner.rb:93:in `start'</line>
272
+
273
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'</line>
274
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'</line>
275
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'</line>
276
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'</line>
277
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'</line>
278
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'</line>
279
+
280
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'</line>
281
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'</line>
282
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:357:in `__send__'</line>
283
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'</line>
284
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'</line>
285
+ <line>/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/helper-scripts/passenger-spawn-server:99</line>
286
+
287
+ </backtrace>
288
+ </notice>
@@ -23,8 +23,20 @@ describe Hoptoad::Notice do
23
23
  notices.size.should == 60
24
24
  end
25
25
 
26
+ it "yields batches" do
27
+ batches = []
28
+ notices = Hoptoad::Notice.find_all_by_error_id(1696171, :pages => 2) do |batch|
29
+ batches << batch
30
+ end
31
+ notices.size.should == 60
32
+ batches.map(&:size).should == [30,30]
33
+ end
34
+
26
35
  it "should find individual notices" do
27
- Hoptoad::Notice.find(1234, 1696170)
36
+ Hoptoad::Notice.find(1234, 1696170).should_not == nil
28
37
  end
29
38
 
30
- end
39
+ it "should find a broken notices" do
40
+ Hoptoad::Notice.find(666, 1696170).should_not == nil
41
+ end
42
+ end
@@ -11,28 +11,35 @@ require 'fakeweb'
11
11
 
12
12
  FakeWeb.allow_net_connect = false
13
13
 
14
+ DEFAULTS = {:content_type => "application/xml; charset=utf-8", :status => ["403", "Forbidden"]}
15
+
16
+ def fixture_request(verb, url, file)
17
+ FakeWeb.register_uri(verb, url, DEFAULTS.merge(:response => File.join(File.dirname(__FILE__), 'fixtures', file)))
18
+ end
19
+
14
20
  # errors
15
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/errors.xml?auth_token=abcdefg123456", :response => File.join(File.dirname(__FILE__), 'fixtures', 'errors.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
16
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/errors.xml?auth_token=abcdefg123456&page=2", :response => File.join(File.dirname(__FILE__), 'fixtures', 'paginated_errors.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
17
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/errors/1696170.xml?auth_token=abcdefg123456", :response => File.join(File.dirname(__FILE__), 'fixtures', 'individual_error.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
18
- FakeWeb.register_uri(:put, 'http://myapp.hoptoadapp.com/errors/1696170.xml?auth_token=abcdefg123456&group[resolved]=true', :response => File.join(File.dirname(__FILE__), 'fixtures', 'update_error.xml'), :content_type => 'application/xml; charset=utf-8', :status => ['200', 'OK'])
21
+ fixture_request :get, 'http://myapp.hoptoadapp.com/errors.xml?auth_token=abcdefg123456', 'errors.xml'
22
+ fixture_request :get, "http://myapp.hoptoadapp.com/errors.xml?auth_token=abcdefg123456&page=2", 'paginated_errors.xml'
23
+ fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170.xml?auth_token=abcdefg123456", 'individual_error.xml'
24
+ fixture_request :put, 'http://myapp.hoptoadapp.com/errors/1696170.xml?auth_token=abcdefg123456&group[resolved]=true', 'update_error.xml'
19
25
 
20
26
  # notices
21
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/errors/1696170/notices.xml?auth_token=abcdefg123456", :response => File.join(File.dirname(__FILE__), 'fixtures', 'notices.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
22
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/errors/1696170/notices.xml?auth_token=abcdefg123456&page=1", :response => File.join(File.dirname(__FILE__), 'fixtures', 'notices.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
23
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/errors/1696170/notices.xml?page=1&auth_token=abcdefg123456", :response => File.join(File.dirname(__FILE__), 'fixtures', 'notices.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
24
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/errors/1696170/notices.xml?auth_token=abcdefg123456&page=2", :response => File.join(File.dirname(__FILE__), 'fixtures', 'paginated_notices.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
25
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/errors/1696170/notices/1234.xml?auth_token=abcdefg123456", :response => File.join(File.dirname(__FILE__), 'fixtures', 'notices.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
26
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456", :response => File.join(File.dirname(__FILE__), 'fixtures', 'notices.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
27
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456&page=1", :response => File.join(File.dirname(__FILE__), 'fixtures', 'notices.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
28
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456&page=2", :response => File.join(File.dirname(__FILE__), 'fixtures', 'notices.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
29
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456&page=3", :response => File.join(File.dirname(__FILE__), 'fixtures', 'paginated_notices.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
30
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/errors/1696171/notices/1234.xml?auth_token=abcdefg123456", :response => File.join(File.dirname(__FILE__), 'fixtures', 'notices.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
27
+ fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170/notices.xml?auth_token=abcdefg123456", 'notices.xml'
28
+ fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170/notices.xml?auth_token=abcdefg123456&page=1", 'notices.xml'
29
+ fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170/notices.xml?page=1&auth_token=abcdefg123456", 'notices.xml'
30
+ fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170/notices.xml?auth_token=abcdefg123456&page=2", 'paginated_notices.xml'
31
+ fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170/notices/1234.xml?auth_token=abcdefg123456", 'individual_notice.xml'
32
+ fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170/notices/666.xml?auth_token=abcdefg123456", 'broken_notice.xml'
33
+ fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456", 'notices.xml'
34
+ fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456&page=1", 'notices.xml'
35
+ fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456&page=2", 'notices.xml'
36
+ fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456&page=3", 'paginated_notices.xml'
37
+ fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696171/notices/1234.xml?auth_token=abcdefg123456", 'notices.xml'
31
38
 
32
39
 
33
40
  # projects
34
- FakeWeb.register_uri(:get, "http://myapp.hoptoadapp.com/data_api/v1/projects.xml?auth_token=abcdefg123456", :response => File.join(File.dirname(__FILE__), 'fixtures', 'projects.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
41
+ fixture_request :get, "http://myapp.hoptoadapp.com/data_api/v1/projects.xml?auth_token=abcdefg123456", 'projects.xml'
35
42
 
36
43
  # ssl responses
37
- FakeWeb.register_uri(:get, "http://sslapp.hoptoadapp.com/errors/1696170.xml?auth_token=abcdefg123456", :body => " ", :content_type => "application/xml; charset=utf-8", :status => ["403", "Forbidden"])
38
- FakeWeb.register_uri(:get, "https://sslapp.hoptoadapp.com/errors/1696170.xml?auth_token=abcdefg123456", :response => File.join(File.dirname(__FILE__), 'fixtures', 'individual_error.xml'), :content_type => "application/xml; charset=utf-8", :status => ["200", "OK"])
44
+ fixture_request :get, "https://sslapp.hoptoadapp.com/errors/1696170.xml?auth_token=abcdefg123456", 'individual_error.xml'
45
+ FakeWeb.register_uri(:get, "http://sslapp.hoptoadapp.com/errors/1696170.xml?auth_token=abcdefg123456", DEFAULTS.merge(:body => " ", :status => ["403", "Forbidden"]))
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hoptoad-api
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.4.0
5
+ version: 2.5.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Steve Agalloco
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-25 00:00:00 -04:00
13
+ date: 2011-07-10 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -36,15 +36,15 @@ dependencies:
36
36
  type: :runtime
37
37
  version_requirements: *id002
38
38
  - !ruby/object:Gem::Dependency
39
- name: bundler
39
+ name: parallel
40
40
  prerelease: false
41
41
  requirement: &id003 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
- - - ~>
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: "1.0"
47
- type: :development
46
+ version: 0.5.0
47
+ type: :runtime
48
48
  version_requirements: *id003
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rake
@@ -54,7 +54,7 @@ dependencies:
54
54
  requirements:
55
55
  - - ~>
56
56
  - !ruby/object:Gem::Version
57
- version: "0.8"
57
+ version: 0.9.2
58
58
  type: :development
59
59
  version_requirements: *id004
60
60
  - !ruby/object:Gem::Dependency
@@ -65,7 +65,7 @@ dependencies:
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: 2.5.0
68
+ version: 2.6.0
69
69
  type: :development
70
70
  version_requirements: *id005
71
71
  - !ruby/object:Gem::Dependency
@@ -76,7 +76,7 @@ dependencies:
76
76
  requirements:
77
77
  - - ~>
78
78
  - !ruby/object:Gem::Version
79
- version: "0.6"
79
+ version: 0.7.2
80
80
  type: :development
81
81
  version_requirements: *id006
82
82
  - !ruby/object:Gem::Dependency
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirements:
99
99
  - - ~>
100
100
  - !ruby/object:Gem::Version
101
- version: "0.3"
101
+ version: 0.4.2
102
102
  type: :development
103
103
  version_requirements: *id008
104
104
  - !ruby/object:Gem::Dependency
@@ -112,7 +112,7 @@ dependencies:
112
112
  version: 1.3.0
113
113
  type: :development
114
114
  version_requirements: *id009
115
- description: An unofficial gem for interacting with the Hoptoad API
115
+ description: A ruby wrapper for the Hoptoad API
116
116
  email:
117
117
  - steve.agalloco@gmail.com
118
118
  executables: []
@@ -124,6 +124,7 @@ extra_rdoc_files: []
124
124
  files:
125
125
  - .gitignore
126
126
  - .rspec
127
+ - .travis.yml
127
128
  - Gemfile
128
129
  - README.md
129
130
  - Rakefile
@@ -135,6 +136,7 @@ files:
135
136
  - lib/hoptoad-api/notice.rb
136
137
  - lib/hoptoad-api/project.rb
137
138
  - lib/hoptoad-api/version.rb
139
+ - spec/fixtures/broken_notice.xml
138
140
  - spec/fixtures/errors.xml
139
141
  - spec/fixtures/individual_error.xml
140
142
  - spec/fixtures/individual_notice.xml
@@ -172,11 +174,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
174
  requirements: []
173
175
 
174
176
  rubyforge_project:
175
- rubygems_version: 1.6.1
177
+ rubygems_version: 1.6.2
176
178
  signing_key:
177
179
  specification_version: 3
178
- summary: Hoptoad API
180
+ summary: A ruby wrapper for the Hoptoad API
179
181
  test_files:
182
+ - spec/fixtures/broken_notice.xml
180
183
  - spec/fixtures/errors.xml
181
184
  - spec/fixtures/individual_error.xml
182
185
  - spec/fixtures/individual_notice.xml