ratchetio 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +9 -0
- data/README.md +13 -6
- data/lib/generators/ratchetio/templates/initializer.rb +8 -0
- data/lib/ratchetio/configuration.rb +8 -0
- data/lib/ratchetio/rails/controller_methods.rb +10 -10
- data/lib/ratchetio/version.rb +1 -1
- metadata +3 -2
data/CHANGELOG.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
**0.4.0**
|
4
|
+
|
5
|
+
- Breaking change to make the "person" more configurable. If you were previously relying on your `current_member` method being called to return the person object, you will need to add the following line to `config/initializers/ratchetio.rb`:
|
6
|
+
|
7
|
+
config.person_method = "current_member"
|
8
|
+
|
9
|
+
- Person id, username, and email method names are now configurable -- see README for details.
|
data/README.md
CHANGED
@@ -66,19 +66,26 @@ Ratchetio.report_message("Login successful", "info", :user => @user)
|
|
66
66
|
|
67
67
|
## Person tracking
|
68
68
|
|
69
|
-
Ratchet will send information about the current user (called a "person" in Ratchet parlance) along with each error report, when available. This works by
|
69
|
+
Ratchet will send information about the current user (called a "person" in Ratchet parlance) along with each error report, when available. This works by calling the `current\_user` controller method. The return value should be an object with an `id` method and, optionally, `username` and `email` methods.
|
70
70
|
|
71
|
-
If
|
71
|
+
If the gem should call a controller method besides `current\_user`, add the following in `config/initializers/ratchetio.rb`:
|
72
72
|
|
73
73
|
```ruby
|
74
|
-
|
75
|
-
|
74
|
+
config.person_method = "my_current_user"
|
75
|
+
```
|
76
|
+
|
77
|
+
If the methods to extract the `id`, `username`, and `email` from the object returned by the `person\_method` have other names, configure like so in `config/initializers/ratchetio.rb`:
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
config.person_id_method = "user_id" # default is "id"
|
81
|
+
config.person_username_method = "user_name" # default is "username"
|
82
|
+
config.person_email_method = "email_address" # default is "email"
|
76
83
|
```
|
77
84
|
|
78
85
|
|
79
86
|
## Exception level filters
|
80
87
|
|
81
|
-
By default, all exceptions reported through `Ratchetio.
|
88
|
+
By default, all exceptions reported through `Ratchetio.report\_exception()` are reporeted at the "error" level, except for the following, which are reported at "warning" level:
|
82
89
|
|
83
90
|
- ActiveRecord::RecordNotFound
|
84
91
|
- AbstractController::ActionNotFound
|
@@ -89,7 +96,7 @@ If you'd like to customize this list, see the example code in `config/initialize
|
|
89
96
|
|
90
97
|
## Help / Support
|
91
98
|
|
92
|
-
If you run into any issues, please email me at
|
99
|
+
If you run into any issues, please email me at support@ratchet.io
|
93
100
|
|
94
101
|
## Contributing
|
95
102
|
|
@@ -2,6 +2,14 @@ require 'ratchetio/rails'
|
|
2
2
|
Ratchetio.configure do |config|
|
3
3
|
config.access_token = <%= access_token_expr %>
|
4
4
|
|
5
|
+
# By default, Ratchetio will try to call the `current_user` controller method
|
6
|
+
# to fetch the logged-in user object, and then call that object's `id`,
|
7
|
+
# `username`, and `email` methods to fetch those properties. To customize:
|
8
|
+
# config.person_method = "my_current_user"
|
9
|
+
# config.person_id_method = "my_id"
|
10
|
+
# config.person_username_method = "my_username"
|
11
|
+
# config.person_email_method = "my_email"
|
12
|
+
|
5
13
|
# Add exception class names to the exception_level_filters hash to
|
6
14
|
# change the level that exception is reported at. Note that if an exception
|
7
15
|
# has already been reported and logged the level will need to be changed
|
@@ -8,6 +8,10 @@ module Ratchetio
|
|
8
8
|
attr_accessor :framework
|
9
9
|
attr_accessor :endpoint
|
10
10
|
attr_accessor :exception_level_filters
|
11
|
+
attr_accessor :person_method
|
12
|
+
attr_accessor :person_id_method
|
13
|
+
attr_accessor :person_username_method
|
14
|
+
attr_accessor :person_email_method
|
11
15
|
|
12
16
|
attr_accessor :logger
|
13
17
|
|
@@ -21,6 +25,10 @@ module Ratchetio
|
|
21
25
|
'AbstractController::ActionNotFound' => 'warning',
|
22
26
|
'ActionController::RoutingError' => 'warning'
|
23
27
|
}
|
28
|
+
@person_method = "current_user"
|
29
|
+
@person_id_method = "id"
|
30
|
+
@person_username_method = "username"
|
31
|
+
@person_email_method = "email"
|
24
32
|
end
|
25
33
|
|
26
34
|
# allow params to be read like a hash
|
@@ -16,17 +16,17 @@ module Ratchetio
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def ratchetio_person_data
|
19
|
-
user =
|
19
|
+
user = send(Ratchetio.configuration.person_method)
|
20
20
|
# include id, username, email if non-empty
|
21
|
-
user
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
21
|
+
if user
|
22
|
+
{
|
23
|
+
:id => begin user.send(Ratchetio.configuration.person_id_method) rescue nil end,
|
24
|
+
:username => begin user.send(Ratchetio.configuration.person_username_method) rescue nil end,
|
25
|
+
:email => begin user.send(Ratchetio.configuration.person_email_method) rescue nil end
|
26
|
+
}
|
27
|
+
else
|
28
|
+
{}
|
29
|
+
end
|
30
30
|
rescue NoMethodError, NameError
|
31
31
|
{}
|
32
32
|
end
|
data/lib/ratchetio/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ratchetio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
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-
|
12
|
+
date: 2012-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Rails plugin to catch and send exceptions to Ratchet.io
|
15
15
|
email:
|
@@ -19,6 +19,7 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- .gitignore
|
22
|
+
- CHANGELOG.md
|
22
23
|
- Gemfile
|
23
24
|
- LICENSE
|
24
25
|
- README.md
|