asana_exception_notifier 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 270fb8e7bd32785bf54a2ea5b5de61948da59f6a
4
- data.tar.gz: 2a0cb808348810d7a2d7d7e2bedbabe61d9f498f
3
+ metadata.gz: 1ade21e6641573c0d132b3b869bc701cba29a03f
4
+ data.tar.gz: be5b38ffd6b55ebf9625d625634179c7ea053559
5
5
  SHA512:
6
- metadata.gz: d8bd4645473472235a3f43408769a0f1e1a21fde549ca154e4583ccb0aadf052f3238e2591a7e25f4b2c60531b22bc8f9c4b591d8be856980f51c406a3c725a1
7
- data.tar.gz: 0a829955fe166f20c6ec27544c4eb13791f5bde19a3645ad573598a88359a855f9d8408a0bb4947eaad8f36c63b1ef81833fabba2988f5410a35593899526a65
6
+ metadata.gz: 1cd3e811cec125c3bcf01aab5b2290cf4bb593e87604ffff86fd46d86c04591353b590d64a4ac350f838d638ec57abc2eef7c519ad86cb5e9dd79ce045a3f30a
7
+ data.tar.gz: 22ff489240f9ae9118bc66acd1560eb9b541bcd2c1c2574db4074533519c83043c837fdd7632c20f4e93c533b2121c4e0d2abb7b9cb5c9181138ab07f2cf62a5
data/README.md CHANGED
@@ -39,7 +39,69 @@ Add the following to your Gemfile :
39
39
  gem "asana_exception_notifier"
40
40
  ```
41
41
 
42
- #### Options: For more options to this check [here](https://asana.com/developers/api-reference/tasks)
42
+ ### Rails
43
+
44
+ If you are settting up for the first time this gem, just run the following command from the terminal:
45
+
46
+ ```
47
+ rails g asana_exception_notifier:install
48
+ ```
49
+
50
+ This command generates an initialize file (`config/initializers/asana_exception_notifier.rb`) where you can customize your configurations. ( Please see section **[2.2) Options for the Rack middleware](#available-options-for-the-rack-middleware)**\) for more information on available options )
51
+
52
+ Make sure the gem is not listed solely under the `production` group, since this initializer will be loaded regardless of environment.
53
+
54
+ AsanaExceptionNotifier is used as a rack middleware, or in the environment you want it to run. In most cases you would want AsanaExceptionNotifier to run on production. Thus, you can make it work by putting the following lines in your `config/environments/production.rb`:
55
+
56
+ ```ruby
57
+ Rails.application.config.middleware.use ExceptionNotification::Rack
58
+ ```
59
+
60
+ ### Rack/Sinatra
61
+
62
+ In order to use ExceptionNotification with Sinatra, please take a look in the [example application](https://github.com/bogdanRada/asana_exception_notifier/tree/master/examples/sinatra).
63
+
64
+ Background Notifications
65
+ ------------------------
66
+
67
+ If you want to send notifications from a background process like DelayedJob, you should use the `notify_exception` method like this:
68
+
69
+ ```ruby
70
+ begin
71
+ some code...
72
+ rescue => exception
73
+ ExceptionNotifier.notify_exception(exception, notifiers: :asana)
74
+ end
75
+ ```
76
+
77
+ You can include information about the background process that created the error by including a data parameter:
78
+
79
+ ```ruby
80
+ begin
81
+ some code...
82
+ rescue => exception
83
+ ExceptionNotifier.notify_exception(exception,
84
+ :data => {:worker => worker.to_s, :queue => queue, :payload => payload}, notifiers: :asana)
85
+ end
86
+ ```
87
+
88
+ ### Manually notify of exception
89
+
90
+ If your controller action manually handles an error, the notifier will never be run. To manually notify of an error you can do something like the following:
91
+
92
+ ```ruby
93
+ rescue_from Exception, :with => :server_error
94
+
95
+ def server_error(exception)
96
+ # Whatever code that handles the exception
97
+
98
+ ExceptionNotifier.notify_exception(exception,
99
+ :env => request.env, :data => {:message => "was doing something wrong"}, notifiers: :asana)
100
+ end
101
+ ```
102
+
103
+ Available Options for the Rack Middleware
104
+ -----------------------------------------
43
105
 
44
106
  ##### asana_api_key
45
107
 
@@ -133,66 +195,11 @@ More detailed, free-form textual information associated with the task. (Default:
133
195
 
134
196
  This can be used to override the default template when rendering the exception details with customized template.
135
197
 
136
- ### Rails
137
-
138
- If you are settting up for the first time this gem, just run the following command from the terminal:
139
-
140
- ```
141
- rails g asana_exception_notifier:install
142
- ```
143
-
144
- This command generates an initialize file (`config/initializers/asana_exception_notifier.rb`) where you can customize your configurations.
145
-
146
- Make sure the gem is not listed solely under the `production` group, since this initializer will be loaded regardless of environment.
147
-
148
- AsanaExceptionNotifier is used as a rack middleware, or in the environment you want it to run. In most cases you would want AsanaExceptionNotifier to run on production. Thus, you can make it work by putting the following lines in your `config/environments/production.rb`:
149
-
150
- ```ruby
151
- Rails.application.config.middleware.use ExceptionNotification::Rack
152
- ```
153
-
154
- ### Rack/Sinatra
155
-
156
- In order to use ExceptionNotification with Sinatra, please take a look in the [example application](https://github.com/bogdanRada/asana_exception_notifier/tree/master/examples/sinatra).
198
+ ##### unsafe_options
157
199
 
158
- Background Notifications
159
- ------------------------
160
-
161
- If you want to send notifications from a background process like DelayedJob, you should use the `notify_exception` method like this:
162
-
163
- ```ruby
164
- begin
165
- some code...
166
- rescue => exception
167
- ExceptionNotifier.notify_exception(exception, notifiers: :asana)
168
- end
169
- ```
170
-
171
- You can include information about the background process that created the error by including a data parameter:
172
-
173
- ```ruby
174
- begin
175
- some code...
176
- rescue => exception
177
- ExceptionNotifier.notify_exception(exception,
178
- :data => {:worker => worker.to_s, :queue => queue, :payload => payload}, notifiers: :asana)
179
- end
180
- ```
181
-
182
- ### Manually notify of exception
183
-
184
- If your controller action manually handles an error, the notifier will never be run. To manually notify of an error you can do something like the following:
185
-
186
- ```ruby
187
- rescue_from Exception, :with => :server_error
188
-
189
- def server_error(exception)
190
- # Whatever code that handles the exception
200
+ *Array, optional*
191
201
 
192
- ExceptionNotifier.notify_exception(exception,
193
- :env => request.env, :data => {:message => "was doing something wrong"}, notifiers: :asana)
194
- end
195
- ```
202
+ This can be used to specify options as strings that will be filtered from session and from request parameters ( The options will not be displayed in the HTML template)
196
203
 
197
204
  Testing
198
205
  -------
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- asana_exception_notifier (0.0.7)
4
+ asana_exception_notifier (0.1.0)
5
5
  activesupport (>= 4.0, < 5)
6
6
  em-http-request (~> 1.1, >= 1.1.2)
7
7
  eventmachine (~> 1.0, >= 1.0.7)
@@ -48,7 +48,7 @@ module AsanaExceptionNotifier
48
48
  exception_service_data: exception_service,
49
49
  request_data: setup_env_params,
50
50
  parameters: @request.respond_to?(:filtered_parameters) ? filter_params(@request.filtered_parameters) : filter_params(request_params),
51
- session: session.respond_to?(:to_hash) ? session.to_hash : session.to_h,
51
+ session: filter_params(session.respond_to?(:to_hash) ? session.to_hash : session.to_h),
52
52
  cookies: @request.cookies.to_h
53
53
  }.merge(@options).reject { |_key, value| value.blank? }
54
54
  end
@@ -15,9 +15,9 @@ module AsanaExceptionNotifier
15
15
  # major release version
16
16
  MAJOR = 0
17
17
  # minor release version
18
- MINOR = 0
18
+ MINOR = 1
19
19
  # tiny release version
20
- TINY = 9
20
+ TINY = 0
21
21
  # prelease version ( set this only if it is a prelease)
22
22
  PRE = nil
23
23
 
@@ -16,5 +16,6 @@ ExceptionNotification.configure do |config|
16
16
  tags: [],
17
17
  name: nil,
18
18
  notes: '',
19
- template_path: nil
19
+ template_path: nil,
20
+ unsafe_options: []
20
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asana_exception_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada