talk-notifier 1.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 84ac79987e8da4eaa1e0c3aa291bafe91ce3271f
4
+ data.tar.gz: 0e3da3d5c2a9b27bf61117d4a104c54bbb03d557
5
+ SHA512:
6
+ metadata.gz: 34c6de2fe1eee2e1a10df93ecfac6b45f0f42f70c6ff3df50c8bb7a1f62ae0ff170ec6db8ff67a99f1c37b63b91ec2da19a49d1445b7f1bf91ea725994820582
7
+ data.tar.gz: 2538225cc39d23f49ef71760176569b4ab1229c2a5ed9edbaeb27ce106a227a7af11b72d43f4d406ac31be263b8ec0a53dd0be1c8d9028462be7246f395ddaf5
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in talk-notifier.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 于湛
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # Talk::Notifier
2
+
3
+ Notify exceptions using Talk.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'talk-notifier'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install talk-notifier
20
+
21
+ ## Usage
22
+
23
+ Add following lines to your `exception-notification` configurations.
24
+
25
+ ```ruby
26
+ Rails.application.config.middleware.use ExceptionNotification::Rack,
27
+ :talk => {
28
+ author_name: 'something you like', # message author name
29
+ hook_url: 'your hook url', # your hook url
30
+ backtrace_depth: 10, # (optional) backtrace depth you want, default 10
31
+ }
32
+ ```
33
+
34
+ ## Contributing
35
+
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/FlyingBlazer/talk-notifier.
37
+
38
+
39
+ ## License
40
+
41
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
42
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,19 @@
1
+ require 'faraday'
2
+
3
+ module ExceptionNotifier
4
+ class TalkNotifier
5
+ def initialize(options)
6
+ @author_name = options[:author_name]
7
+ @backtrace_depth = options[:backtrace_depth] || 10
8
+ @hook_url = options[:hook_url]
9
+ end
10
+
11
+ def call(exception, options={})
12
+ Faraday.post(@hook_url, {
13
+ authorName: @author_name,
14
+ title: "#{exception.class.name}: #{exception.message}",
15
+ text: exception.backtrace.try(:[], 0, @backtrace_depth).try(:join, "\n")
16
+ })
17
+ end
18
+ end
19
+ end
@@ -0,0 +1 @@
1
+ require 'exception_notifier/talk_notifier'
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'talk-notifier'
7
+ spec.version = '1.0.0'
8
+ spec.authors = ['于湛']
9
+ spec.email = ['yuzhan1994@gmail.com']
10
+
11
+ spec.summary = 'Notify exceptions using Talk.'
12
+ spec.homepage = 'https://github.com/FlyingBlazer/talk-notifier'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.require_paths = ['lib']
17
+
18
+ spec.add_dependency 'exception_notification', '~> 4.0'
19
+ spec.add_dependency 'faraday', '~> 0.9.0'
20
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: talk-notifier
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - "于湛"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-08-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: exception_notification
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.9.0
41
+ description:
42
+ email:
43
+ - yuzhan1994@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - lib/exception_notifier/talk_notifier.rb
54
+ - lib/talk-notifier.rb
55
+ - talk-notifier.gemspec
56
+ homepage: https://github.com/FlyingBlazer/talk-notifier
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.2.2
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Notify exceptions using Talk.
80
+ test_files: []