exception_notification_line_notify 0.1.1 → 0.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61784cb72c5fb2ade618d53c127e21787dce967357b6316bd1b4e0aad741c6d2
4
- data.tar.gz: a8cb6c61163689536bd2a41204d90214d7d0d55a33565efd7bc7a2e7f85fcc2f
3
+ metadata.gz: ea4909d1181bfce6da7503f36af9ce186db8eb3b9e919d6f9b73d8e5c2080755
4
+ data.tar.gz: 4c397664d886ea818236a0d274b61310e863023d1b53494e14ddfba60b5f810f
5
5
  SHA512:
6
- metadata.gz: 3815988bd03b37de16674e6d63c435d3bbaca53bb58f37033828acacf60288858d1f46af8045ef64d9b86e179718e42392f31eff2741bc2e31c93805acc2688a
7
- data.tar.gz: e2078cc3a13e3fe67ca06392bef3b2fb6a4e9746848cc3d7be4ff6e058fa91d24c434ef28a28f3e898e64f3b32f06921dda26445174c10684acd18beaf103913
6
+ metadata.gz: ae5979bb10f2b87b3ce4e6b672a206685d5b788ea0dd7710dffa9112bc138bdfcfc82c9d5e4de19a8ce0a6d7395fce8287c53d6b4c83d6aa5f4f89addef96d14
7
+ data.tar.gz: 378431f01408f8beade5bf9c34aa0e62ae03744933f4dffa34f766068cf3d093b07a5562d63d75e0f093af5086d763c913af709aca51c29a9752d0d09e4798cd
data/Gemfile CHANGED
@@ -2,5 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
+ gem 'exception_notification'
6
+
5
7
  # Specify your gem's dependencies in exception_notification_line_notify.gemspec
6
8
  gemspec
@@ -1,46 +1,46 @@
1
1
  require "exception_notification_line_notify/version"
2
+ require 'exception_notification'
3
+ require 'rest-client'
2
4
 
3
- module ExceptionNotificationLineNotify
4
- module ExceptionNotifier
5
- class LineNotifier
6
- def initialize args = {}
7
- args = args.symbolize_keys
5
+ module ExceptionNotifier
6
+ class LineNotifier
7
+ def initialize args = {}
8
+ args = args.symbolize_keys
8
9
 
9
- @line_notify_token = args.fetch(:line_notify_token, nil)
10
+ @line_notify_token = args.fetch(:line_notify_token, nil)
10
11
 
11
- end
12
+ end
12
13
 
13
- def call(exception, options={})
14
- require 'rest-client'
15
- @request = ActionDispatch::Request.new(options[:env])
16
- @backtrace = exception.backtrace.first
17
- @exception_message = exception.message
18
-
19
- @request_section = {
20
- parameters: @request.filtered_parameters.inspect,
21
- method: @request.request_method,
22
- ip: @request.remote_ip,
23
- root: Rails.root.to_s,
24
- }.map{|k, v| "[#{k}] \n#{v}"}.join("\n")
25
-
26
- @session_section = @request.session.to_hash.inspect
27
-
28
-
29
- @message = %Q(
30
- \n #{@request.url}
31
- \n #{@backtrace}
32
- \n======Request=====
33
- \n#{@request_section}
34
- \n======Session=====
35
- \n#{@session_section}
36
- )
37
-
38
- if @line_notify_token
39
- begin
40
- @response = RestClient.post 'https://notify-api.line.me/api/notify', {message: @message}, { :Authorization => "Bearer #{@line_notify_token}"}
41
- rescue => e
42
- puts e
43
- end
14
+ def call(exception, options={})
15
+
16
+ @request = ActionDispatch::Request.new(options[:env])
17
+ @backtrace = exception.backtrace.first
18
+ @exception_message = exception.message
19
+
20
+ @request_section = {
21
+ parameters: @request.filtered_parameters.inspect,
22
+ method: @request.request_method,
23
+ ip: @request.remote_ip,
24
+ root: Rails.root.to_s,
25
+ }.map{|k, v| "[#{k}] \n#{v}"}.join("\n")
26
+
27
+ @session_section = @request.session.to_hash.inspect
28
+
29
+
30
+ @message = %Q(
31
+ \n #{@request.url}
32
+ \n #{@backtrace}
33
+ \n======Request=====
34
+ \n#{@request_section}
35
+ \n======Session=====
36
+ \n#{@session_section}
37
+ )
38
+
39
+ if @line_notify_token
40
+ begin
41
+ @response = RestClient.post 'https://notify-api.line.me/api/notify', {message: @message}, { :Authorization => "Bearer #{@line_notify_token}"}
42
+ rescue => e
43
+ puts e
44
44
  end
45
45
  end
46
46
  end
@@ -1,3 +1,3 @@
1
1
  module ExceptionNotificationLineNotify
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exception_notification_line_notify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - chang
@@ -69,6 +69,8 @@ files:
69
69
  - Rakefile
70
70
  - bin/console
71
71
  - bin/setup
72
+ - exception_notification_line_notify-0.1.0.gem
73
+ - exception_notification_line_notify-0.1.1.gem
72
74
  - exception_notification_line_notify.gemspec
73
75
  - lib/exception_notification_line_notify.rb
74
76
  - lib/exception_notification_line_notify/version.rb