zenbox 0.0.5 → 0.0.6

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/README.md CHANGED
@@ -1,19 +1,21 @@
1
- Zenbox
1
+ Zenbox Gem
2
2
  ========
3
3
 
4
- This is the notifier gem for integrating apps with [Zenbox](http://zenbox.io).
4
+ An implementation of the Zenbox integration API for Ruby. It's super
5
+ simple and lets your sync your custom models with your gmail interface
6
+ in minutes
5
7
 
6
- When an uncaught exception occurs, Zenbox will POST the relevant data
7
- to the Zenbox server specified in your environment.
8
8
 
9
9
  Help
10
10
  ----
11
11
 
12
- For help with using Zenbox and this notifier visit [our support site](http://help.zenbox.io).
12
+ For help with using Zenbox and this notifier [email us](mailto://support@zenboxapp.com).
13
13
 
14
- For discussion of Zenbox development check out the [mailing list](http://groups.google.com/group/hoptoad-notifier-dev).
14
+ Extension Installation
15
+ ----------------------
16
+
17
+ Visit [zenboxapp.com](http://getzenboxapp.com), click on "Install Zenbox Extension", and follow the instructions.
15
18
 
16
- For SSL verification see the [Resources](https://github.com/zenbox/zenbox/blob/master/resources/README.md).
17
19
 
18
20
  Rails Installation
19
21
  ------------------
@@ -33,431 +35,40 @@ That's it!
33
35
 
34
36
  The generator creates a file under `config/initializers/zenbox.rb` configuring Zenbox with your API key. This file should be checked into your version control system so that it is deployed to your staging and production environments.
35
37
 
36
- ### Rails 2.x
37
-
38
- Add the zenbox gem to your app. In config/environment.rb:
39
-
40
- config.gem 'zenbox'
41
-
42
- or if you are using bundler:
43
-
44
- gem 'zenbox', :require => 'zenbox/rails'
45
-
46
- Then from your project's RAILS_ROOT, and in your development environment, run:
47
-
48
- rake gems:install
49
- rake gems:unpack GEM=zenbox
50
- script/generate zenbox --api-key your_key_here
51
-
52
- As always, if you choose not to vendor the zenbox gem, make sure
53
- every server you deploy to has the gem installed or your application won't start.
54
-
55
- The generator creates a file under `config/initializers/zenbox.rb` configuring Zenbox with your API key. This file should be checked into your version control system so that it is deployed to your staging and production environments.
56
-
57
- ### Upgrading From Earlier Versions of Zenbox
58
-
59
- If you're currently using the plugin version (if you have a
60
- vendor/plugins/hoptoad_notifier directory, you are), you'll need to perform a
61
- few extra steps when upgrading to the gem version.
62
-
63
- Add the zenbox gem to your app. In config/environment.rb:
64
-
65
- config.gem 'zenbox'
66
-
67
- Remove the plugin:
68
-
69
- rm -rf vendor/plugins/hoptoad_notifier
70
-
71
- Make sure the following line DOES NOT appear in your ApplicationController file:
72
-
73
- include HoptoadNotifier::Catcher
74
-
75
- If it does, remove it. The new catcher is automatically included by the gem
76
- version of Zenbox.
77
-
78
- Before running the zenbox generator, you need to find your project's API key.
79
- Log in to your account at zenbox.io, and click on the "Projects" button.
80
- Then, find your project in the list, and click on its name. In the left-hand
81
- column, you'll see an "Edit this project" button. Click on that to get your
82
- project's API key. If you accidentally use your personal API api_key,
83
- you will get API key not found errors, and exceptions will not be stored
84
- by the Zenbox service.
85
-
86
- Then from your project's RAILS_ROOT, run:
87
-
88
- rake gems:install
89
- script/generate zenbox --api-key your_key_here
90
-
91
- Once installed, you should vendor the zenbox gem.
92
-
93
- rake gems:unpack GEM=zenbox
94
-
95
- As always, if you choose not to vendor the zenbox gem, make sure
96
- every server you deploy to has the gem installed or your application won't
97
- start.
98
-
99
- ### Upgrading from Earlier Versions of the Hoptoad Gem (with config.gem)
100
-
101
- If you're currently using the gem version of the hoptoad_notifier and have
102
- a version of Rails that uses config.gem (in the 2.x series), there is
103
- a step or two that you need to do to upgrade. First, you need to remove
104
- the old version of the gem from vendor/gems:
105
-
106
- rm -rf vendor/gems/hoptoad_notifier-X.X.X
107
-
108
- Then you must remove the hoptoad_notifier_tasks.rake file from lib:
109
-
110
- rm lib/tasks/hoptoad_notifier_tasks.rake
111
-
112
- You can then continue to install normally. If you don't remove the rake file,
113
- you will be unable to unpack this gem (Rails will think it's part of the
114
- framework).
115
-
116
-
117
-
118
- You can test that Zenbox is working in your production environment by using
119
- this rake task (from RAILS_ROOT):
120
-
121
- rake zenbox:test
122
-
123
- If everything is configured properly, that task will send a notice to Zenbox
124
- which will be visible immediately.
125
-
126
- ### Removing hoptoad_notifier
127
-
128
- in your ApplicationController, REMOVE this line:
129
-
130
- include HoptoadNotifiable
131
-
132
- In your config/environment* files, remove all references to HoptoadNotifier
133
-
134
- Remove the vendor/plugins/hoptoad_notifier directory.
135
-
136
- ### Remove hoptoad_notifier plugin
137
-
138
- Remove the vendor/plugins/hoptoad_notifier directory before installing the gem, or run:
139
-
140
- script/plugin remove hoptoad_notifier
141
-
142
- Non-rails apps using Bundler
143
- ----------------------------
144
- There is an undocumented dependency in `activesupport` where the `i18n` gem is
145
- required only if the core classes extensions are used (`active_support/core_ext`).
146
- This can lead to a confusing `LoadError` exception when using Zenbox. Until
147
- this is fixed in `activesupport` the workaround is to add `i18n` to the Gemfile
148
- for your Sinatra/Rack/pure ruby application:
149
-
150
- gem 'i18n'
151
- gem 'zenbox'
152
-
153
- Rack
154
- ----
155
-
156
- In order to use zenbox in a non-Rails rack app, just load
157
- zenbox, configure your API key, and use the Zenbox::Rack
158
- middleware:
159
-
160
- require 'rack'
161
- require 'zenbox'
162
-
163
- Zenbox.configure do |config|
164
- config.api_key = 'my_api_key'
165
- end
166
-
167
- app = Rack::Builder.app do
168
- run lambda { |env| raise "Rack down" }
169
- end
170
-
171
- use Zenbox::Rack
172
- run app
173
-
174
- Sinatra
175
- -------
176
-
177
- Using zenbox in a Sinatra app is just like a Rack app:
178
-
179
- require 'sinatra'
180
- require 'zenbox'
181
-
182
- Zenbox.configure do |config|
183
- config.api_key = 'my API key'
184
- end
185
-
186
- use Zenbox::Rack
187
-
188
- get '/' do
189
- raise "Sinatra has left the building"
190
- end
191
-
192
- Usage
193
- -----
194
-
195
- For the most part, Zenbox works for itself.
196
-
197
- It intercepts the exception middleware calls, sends notifications and continues the middleware call chain.
198
-
199
- If you want to log arbitrary things which you've rescued yourself from a
200
- controller, you can do something like this:
201
-
202
- ...
203
- rescue => ex
204
- notify_zenbox(ex)
205
- flash[:failure] = 'Encryptions could not be rerouted, try again.'
206
- end
207
- ...
208
-
209
- The `#notify_zenbox` call will send the notice over to Zenbox for later
210
- analysis. While in your controllers you use the `notify_zenbox` method, anywhere
211
- else in your code, use `Zenbox.notify`.
212
-
213
- To perform custom error processing after Zenbox has been notified, define the
214
- instance method `#rescue_action_in_public_without_zenbox(exception)` in your
215
- controller.
216
-
217
- Informing the User
218
- ------------------
219
-
220
- The zenbox gem is capable of telling the user information about the error that just happened
221
- via the user_information option. They can give this error number in bug reports, for example.
222
- By default, if your 500.html contains the text
223
-
224
- <!-- AIRBRAKE ERROR -->
225
-
226
- then that comment will be replaced with the text "Zenbox Error [errnum]". You can modify the text
227
- of the informer by setting `config.user_information`. Zenbox will replace "{{ error_id }}" with the
228
- ID of the error that is returned from Zenbox.
229
-
230
- Zenbox.configure do |config|
231
- ...
232
- config.user_information = "<p>Tell the devs that it was <strong>{{ error_id }}</strong>'s fault.</p>"
233
- end
234
-
235
- You can also turn the middleware that handles this completely off by setting `config.user_information` to false.
236
-
237
- Note that this feature is reading the error id from `env['zenbox.error_id']`. When the exception is caught
238
- automatically in a controller, Zenbox sets that value. If you're, however, calling the Zenbox methods like
239
- `Zenbox#notify` or `Zenbox#notify_or_ignore`, please make sure you set that value. So the proper way of calling the
240
- "manual" methods would be `env['zenbox.error_id'] = Zenbox.notify_or_ignore(...)`.
241
-
242
- Tracking deployments in Zenbox
243
- --------------------------------
244
-
245
- Paying Zenbox plans support the ability to track deployments of your application in Zenbox.
246
- By notifying Zenbox of your application deployments, all errors are resolved when a deploy occurs,
247
- so that you'll be notified again about any errors that reoccur after a deployment.
248
-
249
- Additionally, it's possible to review the errors in Zenbox that occurred before and after a deploy.
250
-
251
- When Zenbox is installed as a gem, you need to add
252
-
253
- require 'zenbox/capistrano'
254
-
255
- to your deploy.rb
256
-
257
- If you don't use Capistrano, then you can use the following rake task from your
258
- deployment process to notify Zenbox:
259
-
260
- rake zenbox:deploy TO=#{rails_env} REVISION=#{current_revision} REPO=#{repository} USER=#{local_user}
261
-
262
- Going beyond exceptions
263
- -----------------------
264
-
265
- You can also pass a hash to `Zenbox.notify` method and store whatever you want,
266
- not just an exception. And you can also use it anywhere, not just in
267
- controllers:
268
-
269
- begin
270
- params = {
271
- # params that you pass to a method that can throw an exception
272
- }
273
- my_unpredicable_method(params)
274
- rescue => e
275
- Zenbox.notify(
276
- :error_class => "Special Error",
277
- :error_message => "Special Error: #{e.message}",
278
- :parameters => params
279
- )
280
- end
281
-
282
- While in your controllers you use the `notify_zenbox` method, anywhere else in
283
- your code, use `Zenbox.notify`. Zenbox will get all the information
284
- about the error itself. As for a hash, these are the keys you should pass:
285
-
286
- * `:error_class` - Use this to group similar errors together. When Zenbox catches an exception it sends the class name of that exception object.
287
- * `:error_message` - This is the title of the error you see in the errors list. For exceptions it is "#{exception.class.name}: #{exception.message}"
288
- * `:parameters` - While there are several ways to send additional data to Zenbox, passing a Hash as :parameters as in the example above is the most common use case. When Zenbox catches an exception in a controller, the actual HTTP client request parameters are sent using this key.
289
-
290
- Zenbox merges the hash you pass with these default options:
291
-
292
- {
293
- :api_key => Zenbox.api_key,
294
- :error_message => 'Notification',
295
- :backtrace => caller,
296
- :parameters => {},
297
- :session => {}
298
- }
299
-
300
- You can override any of those parameters.
301
-
302
- ### Sending shell environment variables when "Going beyond exceptions"
303
-
304
- One common request we see is to send shell environment variables along with
305
- manual exception notification. We recommend sending them along with CGI data
306
- or Rack environment (:cgi_data or :rack_env keys, respectively.)
307
-
308
- See Zenbox::Notice#initialize in lib/zenbox/notice.rb for
309
- more details.
310
-
311
- Filtering
312
- ---------
313
-
314
- You can specify a whitelist of errors that Zenbox will not report on. Use
315
- this feature when you are so apathetic to certain errors that you don't want
316
- them even logged.
317
-
318
- This filter will only be applied to automatic notifications, not manual
319
- notifications (when #notify is called directly).
320
-
321
- Zenbox ignores the following exceptions by default:
322
-
323
- ActiveRecord::RecordNotFound
324
- ActionController::RoutingError
325
- ActionController::InvalidAuthenticityToken
326
- CGI::Session::CookieStore::TamperedWithCookie
327
- ActionController::UnknownAction
328
- AbstractController::ActionNotFound
329
- Mongoid::Errors::DocumentNotFound
330
-
331
-
332
- To ignore errors in addition to those, specify their names in your Zenbox
333
- configuration block.
334
-
335
- Zenbox.configure do |config|
336
- config.api_key = '1234567890abcdef'
337
- config.ignore << "ActiveRecord::IgnoreThisError"
338
- end
339
-
340
- To ignore *only* certain errors (and override the defaults), use the #ignore_only attribute.
341
-
342
- Zenbox.configure do |config|
343
- config.api_key = '1234567890abcdef'
344
- config.ignore_only = ["ActiveRecord::IgnoreThisError"] # or [] to ignore no exceptions.
345
- end
346
-
347
- To ignore certain user agents, add in the #ignore_user_agent attribute as a
348
- string or regexp:
349
-
350
- Zenbox.configure do |config|
351
- config.api_key = '1234567890abcdef'
352
- config.ignore_user_agent << /Ignored/
353
- config.ignore_user_agent << 'IgnoredUserAgent'
354
- end
355
-
356
- To ignore exceptions based on other conditions, use #ignore_by_filter:
357
-
358
- Zenbox.configure do |config|
359
- config.api_key = '1234567890abcdef'
360
- config.ignore_by_filter do |exception_data|
361
- true if exception_data[:error_class] == "RuntimeError"
362
- end
363
- end
364
-
365
- To replace sensitive information sent to the Zenbox service with [FILTERED] use #params_filters:
366
-
367
- Zenbox.configure do |config|
368
- config.api_key = '1234567890abcdef'
369
- config.params_filters << "credit_card_number"
370
- end
371
-
372
- Note that, when rescuing exceptions within an ActionController method,
373
- zenbox will reuse filters specified by #filter_parameter_logging.
374
-
375
- Testing
376
- -------
377
-
378
- When you run your tests, you might notice that the Zenbox service is recording
379
- notices generated using #notify when you don't expect it to. You can
380
- use code like this in your test_helper.rb or spec_helper.rb files to redefine
381
- that method so those errors are not reported while running tests.
382
-
383
- module Zenbox
384
- def self.notify(exception, opts = {})
385
- # do nothing.
386
- end
387
- end
388
-
389
- Proxy Support
38
+ Configuration
390
39
  -------------
391
40
 
392
- The notifier supports using a proxy, if your server is not able to directly reach the Zenbox servers. To configure the proxy settings, added the following information to your Zenbox configuration block.
41
+ Any ActiveRecord model that responds to `#email` can be easily integrated with two lines:
393
42
 
394
- Zenbox.configure do |config|
395
- config.proxy_host = proxy.host.com
396
- config.proxy_port = 4038
397
- config.proxy_user = foo # optional
398
- config.proxy_pass = bar # optional
43
+ include Zenbox::ModelHelper
44
+ zenbox_model methods
399
45
 
400
- Supported Rails versions
401
- ------------------------
402
-
403
- See SUPPORTED_RAILS_VERSIONS for a list of official supported versions of
404
- Rails.
405
-
406
- Please open up a support ticket ( http://help.zenbox.io ) or submit a new github issue
407
- if you're using a version of Rails that is listed above and the notifier is
408
- not working properly.
409
-
410
- Javascript Notifer
411
- ------------------
46
+ where fields is just a list of methods your model responds to that you want synced with your backend, for example `zenbox_model :first_name, :last_name, :paying_customer?, :current_plan, :widgets_bought, :created_at`
412
47
 
413
- To automatically include the Javascript node on every page, use this helper method from your layouts:
48
+ That's it! If you have additional models, that will also work fine, all the data will be merged, with the latest values replacing previous ones.
414
49
 
415
- <%= zenbox_javascript_notifier %>
50
+ You can sync all your data in one-go with the `zenbox:sync` rake task:
416
51
 
417
- It's important to insert this very high in the markup, above all other javascript. Example:
52
+ rake zenbox:sync
418
53
 
419
- <!DOCTYPE html>
420
- <html>
421
- <head>
422
- <meta charset="utf8">
423
- <%= zenbox_javascript_notifier %>
424
- <!-- more javascript -->
425
- </head>
426
- <body>
427
- ...
428
- </body>
429
- </html>
430
-
431
- This helper will automatically use the API key, host, and port specified in the configuration.
432
-
433
- The Javascript notifier tends to send much more notifications than the base Rails project.
434
- If you want to receive them into a separate Zenbox project, specify its
435
- API key in the `js_api_key` option.
436
-
437
- config.js_api_key = 'another-projects-api-key'
438
-
439
- To test the Javascript notifier in development environment, overwrite (temporarily) the development_environments option:
54
+ Ruby Installation
55
+ ------------------
56
+ After adding the `zenbox` gem to your Gemfile, you can simple use: `Zenbox.post(email, profile_data)`, where `profile_data` is a hash. That's it!
440
57
 
441
- Zenbox.configure do |config|
442
- # ...
443
- config.development_environments = []
444
- end
58
+ HTTP API
59
+ --------
60
+ You can also simply post to the endpoint using any http library from any language your prefer. Here's and example:
445
61
 
446
- Development
447
- -----------
62
+ `curl -X POST 'http://zenboxapp.com/customers?api_key=<your_api_key&email=support@zenboxapp.com&title=Support People&widgets_consumed=4000'`
448
63
 
449
- See TESTING.md for instructions on how to run the tests.
64
+ Now go check out your email from support@zenboxapp.com. If you've installed the Zenbox extension, you should see your custom fields rendered alongside!
450
65
 
451
66
  Credits
452
67
  -------
453
68
 
454
- ![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
455
-
456
- Zenbox is maintained and funded by [zenbox.io](http://zenbox.io)
457
-
458
- Thank you to all [the contributors](https://github.com/zenbox/zenbox/contributors)!
69
+ ![Cloudfuji](http://zenbox.com/images/tm/logo.png)
459
70
 
460
- The names and logos for Zenbox, thoughtbot are trademarks of their respective holders.
71
+ The Zenbox gem was forked from [Airbrake](http://airbrake.io), which is a totally amazing company run by people you should support.
461
72
 
462
73
  License
463
74
  -------
@@ -42,9 +42,19 @@ namespace :zenbox do
42
42
 
43
43
  puts "Syncing #{model.all.count} models with Zenbox..."
44
44
 
45
- model.all.each do |model|
45
+ reset = "\r\e[0k"
46
+
47
+ count = model.all.count
48
+
49
+ model.all.each_with_index do |model, index|
50
+ progress = ((index.to_f + 1) / count * 100).round(2)
51
+ output = "#{progress}%: #{model.email}"
52
+ print "#{reset}"
53
+ print output
46
54
  model.zenbox_sync!
47
55
  end
56
+
57
+ puts " - Finished!"
48
58
  end
49
59
  end
50
60
 
@@ -1,3 +1,3 @@
1
1
  module Zenbox
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.add_runtime_dependency("json")
16
16
 
17
17
  s.authors = ["Zenbox"]
18
- s.email = %q{support@cloudfuji.com}
18
+ s.email = %q{support@zenboxapp.com}
19
19
  s.homepage = "http://cloudfuji.com"
20
20
 
21
21
  s.platform = Gem::Platform::RUBY
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zenbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-21 00:00:00.000000000 Z
12
+ date: 2012-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -28,7 +28,7 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
30
  description:
31
- email: support@cloudfuji.com
31
+ email: support@zenboxapp.com
32
32
  executables: []
33
33
  extensions: []
34
34
  extra_rdoc_files: []
@@ -72,7 +72,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
72
  version: '0'
73
73
  segments:
74
74
  - 0
75
- hash: -3809776815902382558
75
+ hash: -1725993044033598525
76
76
  required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  none: false
78
78
  requirements:
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  segments:
83
83
  - 0
84
- hash: -3809776815902382558
84
+ hash: -1725993044033598525
85
85
  requirements: []
86
86
  rubyforge_project:
87
87
  rubygems_version: 1.8.24