konsierge-notifier 0.1.3 → 0.1.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Rakefile +2 -4
- data/konsierge-notifier.gemspec +10 -19
- data/lib/generators/install/konsierge_notifier.rb +1 -1
- data/lib/generators/install/templates/{konsierge_notifier_telegram.rb → konsierge_notifier.rb} +1 -1
- data/lib/konsierge/notifier/adapters/base_adapter.rb +17 -0
- data/lib/konsierge/notifier/adapters/telegram.rb +108 -0
- data/lib/konsierge/notifier/configuration.rb +22 -4
- data/lib/konsierge/notifier/rails_report_subscriber.rb +13 -0
- data/lib/konsierge/notifier/templates/telegram/error.html.erb +14 -0
- data/lib/konsierge/notifier/version.rb +1 -1
- data/lib/konsierge/notifier.rb +18 -64
- metadata +21 -109
- data/lib/generators/konsierge/notifier/mailer/install_generator.rb +0 -15
- data/lib/generators/konsierge/notifier/mailer/templates/README +0 -18
- data/lib/generators/konsierge/notifier/mailer/templates/initializer.rb +0 -8
- data/lib/konsierge/notifier/error_template.html.erb +0 -8
- /data/lib/konsierge/notifier/{template.html.erb → templates/telegram/message.html.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc425bfa6f9517f101566c0eafc628825b199bab158a745ed774bed0c671cc6f
|
4
|
+
data.tar.gz: dd3e91fcbdedebf8b0103dcb10fb092b7c1075202f5073c75b78e2289855f569
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b52bc1f695f699711c5d0a195db9828787919daafaa71b968a4be790eac813aa36ee7302c559998c4f4af5b2229c7f329352a0cb818487edc73c24f67e837ac
|
7
|
+
data.tar.gz: 05fb8eecec7b5d8f2f9f5db32bc8a3f0290271d08ba9ddd096d491bb0c1645f9e61542f50c1652d399c835b6e090c06183c8a029e33fa1f5be75ecb738e7ff00
|
data/.rubocop.yml
CHANGED
data/Rakefile
CHANGED
@@ -2,11 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rspec/core/rake_task'
|
5
|
-
|
6
|
-
RSpec::Core::RakeTask.new(:spec)
|
7
|
-
|
8
5
|
require 'rubocop/rake_task'
|
9
6
|
|
10
7
|
RuboCop::RakeTask.new
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
11
9
|
|
12
|
-
task default: %i[spec
|
10
|
+
task default: %i[rubocop spec]
|
data/konsierge-notifier.gemspec
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
require_relative 'lib/konsierge/notifier/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
6
|
+
spec.name = 'konsierge-notifier'
|
7
7
|
spec.version = Konsierge::Notifier::VERSION
|
8
|
-
spec.author
|
9
|
-
spec.email
|
8
|
+
spec.author = 'David Rybolovlev'
|
9
|
+
spec.email = ['golifox911@gmail.com']
|
10
10
|
|
11
|
-
spec.summary
|
12
|
-
spec.description
|
11
|
+
spec.summary = 'Notifier for Konsierge.'
|
12
|
+
spec.description = spec.summary
|
13
13
|
spec.required_ruby_version = '>= 2.7.4'
|
14
14
|
|
15
15
|
spec.metadata['source_code_uri'] = 'https://gitlab.konsierge.com/digitalbox/gem/konsierge-notifier'
|
@@ -20,23 +20,14 @@ Gem::Specification.new do |spec|
|
|
20
20
|
f.start_with?(*%w[bin/ spec/ features/ .git .circleci appveyor Gemfile])
|
21
21
|
end
|
22
22
|
end
|
23
|
-
spec.bindir = 'exe'
|
24
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
25
|
-
spec.require_paths = ['lib']
|
26
23
|
|
27
|
-
spec.
|
24
|
+
spec.bindir = 'exe'
|
25
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ['lib']
|
28
27
|
|
29
|
-
|
28
|
+
spec.add_dependency 'dotenv', '>= 2.0'
|
29
|
+
spec.add_dependency 'erb', '>= 2.0'
|
30
30
|
spec.add_dependency 'telegram-bot', '~> 0.16.1'
|
31
31
|
|
32
|
-
# Development and test dependencies
|
33
|
-
spec.add_development_dependency 'bundler', '~> 2.0'
|
34
|
-
spec.add_development_dependency 'rspec', '~> 3.10'
|
35
|
-
spec.add_development_dependency 'rspec-mocks', '~> 3.10'
|
36
|
-
spec.add_development_dependency 'rubocop', '~> 1.60'
|
37
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.11'
|
38
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 2.11'
|
39
|
-
spec.add_development_dependency 'simplecov', '~> 0.22'
|
40
|
-
|
41
32
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
42
33
|
end
|
@@ -14,7 +14,7 @@ module Generators
|
|
14
14
|
desc 'Creates a Konsierge::Notifier initializer for your application'
|
15
15
|
|
16
16
|
def copy_initializer
|
17
|
-
template '
|
17
|
+
template 'konsierge_notifier.rb', 'config/initializers/konsierge_notifier.rb'
|
18
18
|
|
19
19
|
# Code to copy the message and error_message erb templates
|
20
20
|
copy_file 'message_template.html.erb', 'lib/templates/konsierge_notifier/message.html.erb'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Konsierge
|
4
|
+
module Notifier
|
5
|
+
module Adapters
|
6
|
+
class BaseAdapter
|
7
|
+
def send_message(message, context: {}, **options)
|
8
|
+
raise NotImplementedError
|
9
|
+
end
|
10
|
+
|
11
|
+
def send_error(error, context: {}, source: nil, **options)
|
12
|
+
raise NotImplementedError
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'erb'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
require_relative 'base_adapter'
|
7
|
+
|
8
|
+
module Konsierge
|
9
|
+
module Notifier
|
10
|
+
module Adapters
|
11
|
+
class Telegram < BaseAdapter
|
12
|
+
TELEGRAM_CHAT_ID_NOT_SET = 'Telegram Chat ID is not set'
|
13
|
+
TELEGRAM_BOT_ERROR = 'TelegramBot Error: %s'
|
14
|
+
TELEGRAM_BOT_DISABLED = 'TelegramBot is disabled! Message not sent.'
|
15
|
+
PATH_OR_CHAT_ID_NOT_PROVIDED = 'Please, provide path and chat_id'
|
16
|
+
|
17
|
+
def send_message(message, context: {}, **options)
|
18
|
+
chat_id = options.delete(:chat_id)
|
19
|
+
|
20
|
+
template_params = {
|
21
|
+
app_name: Notifier.config.app_name,
|
22
|
+
message: message,
|
23
|
+
context: context
|
24
|
+
}
|
25
|
+
|
26
|
+
send_with_message_template(
|
27
|
+
path: Notifier.config.message_template_path,
|
28
|
+
chat_id: chat_id,
|
29
|
+
template_params: template_params
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def send_error(error, context: {}, source: nil, **options)
|
34
|
+
chat_id = options.delete(:chat_id)
|
35
|
+
|
36
|
+
template_params = {
|
37
|
+
app_name: Notifier.config.app_name,
|
38
|
+
error: error,
|
39
|
+
source: source,
|
40
|
+
context: context
|
41
|
+
}
|
42
|
+
|
43
|
+
send_with_message_template(
|
44
|
+
path: Notifier.config.error_template_path,
|
45
|
+
chat_id: chat_id,
|
46
|
+
template_params: template_params
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def send_with_message_template(**options)
|
53
|
+
return log_disabled_bot_warning unless bot_enabled?
|
54
|
+
|
55
|
+
opts = sanitize_template_options!(options)
|
56
|
+
|
57
|
+
provided_chat_id = opts.delete(:chat_id)
|
58
|
+
chat_id = check_chat_id!(provided_chat_id)
|
59
|
+
|
60
|
+
provided_path = opts.delete(:path)
|
61
|
+
template = ::ERB.new(File.read(provided_path))
|
62
|
+
|
63
|
+
template_params = opts.delete(:template_params)
|
64
|
+
message = template.result_with_hash(template_params)
|
65
|
+
|
66
|
+
send_to_telegram(message, chat_id: chat_id)
|
67
|
+
end
|
68
|
+
|
69
|
+
def send_to_telegram(text, chat_id:)
|
70
|
+
::Telegram.bot.send_message(chat_id: chat_id, text: text, parse_mode: Notifier.config.parse_mode)
|
71
|
+
|
72
|
+
true
|
73
|
+
rescue StandardError => e
|
74
|
+
Notifier.config.logger.error(TELEGRAM_BOT_ERROR % e.message)
|
75
|
+
false
|
76
|
+
end
|
77
|
+
|
78
|
+
def sanitize_template_options!(options)
|
79
|
+
opts = options.dup
|
80
|
+
|
81
|
+
unless %i[path chat_id template_params].all? { |key| opts.key?(key) }
|
82
|
+
raise ArgumentError, PATH_OR_CHAT_ID_NOT_PROVIDED
|
83
|
+
end
|
84
|
+
|
85
|
+
opts
|
86
|
+
end
|
87
|
+
|
88
|
+
def check_chat_id!(chat_id)
|
89
|
+
chat_id ||= Notifier.config.chat_id
|
90
|
+
|
91
|
+
raise TELEGRAM_CHAT_ID_NOT_SET unless chat_id
|
92
|
+
|
93
|
+
chat_id
|
94
|
+
end
|
95
|
+
|
96
|
+
def bot_enabled?
|
97
|
+
Notifier.config.bot_enabled
|
98
|
+
end
|
99
|
+
|
100
|
+
def log_disabled_bot_warning # rubocop:disable Naming/PredicateMethod
|
101
|
+
Notifier.config.logger.warn(TELEGRAM_BOT_DISABLED)
|
102
|
+
|
103
|
+
false
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -1,17 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'adapters/telegram'
|
4
|
+
|
3
5
|
module Konsierge
|
4
6
|
module Notifier
|
5
7
|
class Configuration
|
6
|
-
|
7
|
-
|
8
|
+
class Error < StandardError; end
|
9
|
+
|
10
|
+
ADAPTER_IMPLEMENTATIONS = {
|
11
|
+
telegram: Adapters::Telegram
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
attr_accessor :app_name, :adapter, :chat_id, :bot_enabled,
|
15
|
+
:message_template_path, :error_template_path, :logger, :parse_mode
|
8
16
|
|
9
17
|
def initialize
|
10
18
|
@app_name = nil
|
19
|
+
@adapter = :telegram
|
11
20
|
@chat_id = ENV.fetch('TELEGRAM_CHANNEL_ID', nil)
|
12
21
|
@bot_enabled = ENV.fetch('TELEGRAM_BOT_ENABLED', false)
|
13
|
-
@message_template_path = File.expand_path('
|
14
|
-
@error_template_path = File.expand_path('
|
22
|
+
@message_template_path = File.expand_path('templates/telegram/message.html.erb', __dir__)
|
23
|
+
@error_template_path = File.expand_path('templates/telegram/error.html.erb', __dir__)
|
15
24
|
@logger = Logger.new($stdout)
|
16
25
|
@parse_mode = 'HTML'
|
17
26
|
end
|
@@ -21,6 +30,15 @@ module Konsierge
|
|
21
30
|
hash[var.to_s.delete('@').to_sym] = instance_variable_get(var)
|
22
31
|
end
|
23
32
|
end
|
33
|
+
|
34
|
+
def adapter_class
|
35
|
+
unless ADAPTER_IMPLEMENTATIONS[@adapter]
|
36
|
+
error_msg = "#{@adapter} must be one of #{ADAPTER_IMPLEMENTATIONS.keys.join(', ')}"
|
37
|
+
raise Error, error_msg
|
38
|
+
end
|
39
|
+
|
40
|
+
ADAPTER_IMPLEMENTATIONS[@adapter.to_s.to_sym]
|
41
|
+
end
|
24
42
|
end
|
25
43
|
end
|
26
44
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Konsierge
|
4
|
+
module Notifier
|
5
|
+
class RailsReportSubscriber
|
6
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
7
|
+
def report(error, handled:, severity:, context:, source: nil)
|
8
|
+
Notifier.send_error(error, source: source, context: context)
|
9
|
+
end
|
10
|
+
# rubocop:enable Lint/UnusedMethodArgument
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<b><%= CGI.escape_html(app_name.to_s) %></b>
|
2
|
+
<% "\n" %>
|
3
|
+
<b>Error</b>: <%= CGI.escape_html(error.class.to_s) %> - <%= CGI.escape_html(error.message.to_s) %>
|
4
|
+
<% "\n" %>
|
5
|
+
<b>Source</b>: <%= CGI.escape_html(source.to_s) %>
|
6
|
+
<% if context %>
|
7
|
+
<b>Context</b>: <%= CGI.escape_html(JSON.pretty_generate(context)) %>
|
8
|
+
<% end %>
|
9
|
+
<% if error&.backtrace && error.backtrace.any? %>
|
10
|
+
<b>Trace:</b>
|
11
|
+
<%= error.backtrace[0..2].map { |trace| "===> #{CGI.escape_html(trace.to_s)}" }.join("\n") %>
|
12
|
+
<% else %>
|
13
|
+
<b>No backtrace available</b>
|
14
|
+
<% end %>
|
data/lib/konsierge/notifier.rb
CHANGED
@@ -2,92 +2,46 @@
|
|
2
2
|
|
3
3
|
require 'logger'
|
4
4
|
require 'telegram/bot'
|
5
|
+
|
6
|
+
require_relative 'notifier/version'
|
5
7
|
require_relative 'notifier/configuration'
|
8
|
+
require_relative 'notifier/adapters/telegram'
|
9
|
+
require_relative 'notifier/rails_report_subscriber'
|
6
10
|
|
7
11
|
module Konsierge
|
8
12
|
module Notifier
|
9
|
-
TELEGRAM_CHAT_ID_NOT_SET = 'Telegram Chat ID is not set'
|
10
|
-
TELEGRAM_BOT_ERROR = 'TelegramBot Error: %s'
|
11
|
-
TELEGRAM_BOT_DISABLED = 'TelegramBot is disabled! Message not sent.'
|
12
|
-
PATH_OR_CHAT_ID_NOT_PROVIDED = 'Please, provide path and chat_id'
|
13
|
-
|
14
13
|
class << self
|
15
14
|
def config
|
16
15
|
@config ||= Configuration.new
|
17
16
|
end
|
18
17
|
|
19
18
|
def configure
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
def send_message(text, chat_id: nil)
|
24
|
-
send_with_message_template(
|
25
|
-
path: config.message_template_path,
|
26
|
-
chat_id: chat_id,
|
27
|
-
app_name: config.app_name,
|
28
|
-
message: text
|
29
|
-
)
|
30
|
-
end
|
19
|
+
subscribe_on_reporter
|
31
20
|
|
32
|
-
|
33
|
-
send_with_message_template(
|
34
|
-
path: config.error_template_path,
|
35
|
-
chat_id: chat_id,
|
36
|
-
app_name: config.app_name,
|
37
|
-
error: error,
|
38
|
-
source: source
|
39
|
-
)
|
21
|
+
yield(config)
|
40
22
|
end
|
41
23
|
|
42
|
-
|
43
|
-
|
44
|
-
private
|
45
|
-
|
46
|
-
def send_with_message_template(**options)
|
47
|
-
return log_disabled_bot_warning unless bot_enabled?
|
48
|
-
|
49
|
-
opts = sanitize_template_options!(options)
|
50
|
-
chat_id = check_chat_id!(opts[:chat_id])
|
51
|
-
|
52
|
-
template = ERB.new(File.read(opts[:path]))
|
53
|
-
|
54
|
-
template_params = opts.except(:path, :chat_id)
|
55
|
-
message = template.result_with_hash(template_params)
|
56
|
-
|
57
|
-
send_to_telegram(message, chat_id: chat_id)
|
24
|
+
def adapter_instance
|
25
|
+
@adapter_instance ||= config.adapter_class.new
|
58
26
|
end
|
59
27
|
|
60
|
-
def
|
61
|
-
|
62
|
-
|
63
|
-
true
|
64
|
-
rescue StandardError => e
|
65
|
-
config.logger.error(TELEGRAM_BOT_ERROR % e.message)
|
66
|
-
false
|
28
|
+
def send_message(...)
|
29
|
+
adapter_instance.send_message(...)
|
67
30
|
end
|
68
31
|
|
69
|
-
def
|
70
|
-
|
71
|
-
raise ArgumentError, PATH_OR_CHAT_ID_NOT_PROVIDED unless %i[path chat_id].all? { |key| opts.key?(key) }
|
72
|
-
|
73
|
-
opts
|
32
|
+
def send_error(...)
|
33
|
+
adapter_instance.send_error(...)
|
74
34
|
end
|
75
35
|
|
76
|
-
|
77
|
-
chat_id ||= config.chat_id
|
78
|
-
|
79
|
-
raise TELEGRAM_CHAT_ID_NOT_SET unless chat_id
|
36
|
+
alias report_error send_error
|
80
37
|
|
81
|
-
|
82
|
-
end
|
38
|
+
private
|
83
39
|
|
84
|
-
def
|
85
|
-
|
86
|
-
end
|
40
|
+
def subscribe_on_reporter
|
41
|
+
return unless Gem::Version.new(::Rails.version).segments.first >= 7
|
87
42
|
|
88
|
-
|
89
|
-
|
90
|
-
false
|
43
|
+
config.logger.debug { 'Konsierge notifier is subscribing to Rails error reporter...' }
|
44
|
+
Rails.error.subscribe(RailsReportSubscriber.new)
|
91
45
|
end
|
92
46
|
end
|
93
47
|
end
|
metadata
CHANGED
@@ -1,141 +1,56 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: konsierge-notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Rybolovlev
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: dotenv
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.7'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
16
|
+
- - ">="
|
25
17
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: telegram-bot
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.16.1
|
18
|
+
version: '2.0'
|
34
19
|
type: :runtime
|
35
20
|
prerelease: false
|
36
21
|
version_requirements: !ruby/object:Gem::Requirement
|
37
22
|
requirements:
|
38
|
-
- - "
|
23
|
+
- - ">="
|
39
24
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0
|
25
|
+
version: '2.0'
|
41
26
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
27
|
+
name: erb
|
43
28
|
requirement: !ruby/object:Gem::Requirement
|
44
29
|
requirements:
|
45
|
-
- - "
|
30
|
+
- - ">="
|
46
31
|
- !ruby/object:Gem::Version
|
47
32
|
version: '2.0'
|
48
|
-
type: :
|
33
|
+
type: :runtime
|
49
34
|
prerelease: false
|
50
35
|
version_requirements: !ruby/object:Gem::Requirement
|
51
36
|
requirements:
|
52
|
-
- - "
|
37
|
+
- - ">="
|
53
38
|
- !ruby/object:Gem::Version
|
54
39
|
version: '2.0'
|
55
40
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.10'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.10'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec-mocks
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '3.10'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '3.10'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '1.60'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '1.60'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-performance
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '1.11'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '1.11'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop-rspec
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '2.11'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '2.11'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: simplecov
|
41
|
+
name: telegram-bot
|
127
42
|
requirement: !ruby/object:Gem::Requirement
|
128
43
|
requirements:
|
129
44
|
- - "~>"
|
130
45
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
132
|
-
type: :
|
46
|
+
version: 0.16.1
|
47
|
+
type: :runtime
|
133
48
|
prerelease: false
|
134
49
|
version_requirements: !ruby/object:Gem::Requirement
|
135
50
|
requirements:
|
136
51
|
- - "~>"
|
137
52
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
53
|
+
version: 0.16.1
|
139
54
|
description: Notifier for Konsierge.
|
140
55
|
email:
|
141
56
|
- golifox911@gmail.com
|
@@ -154,25 +69,23 @@ files:
|
|
154
69
|
- konsierge-notifier.gemspec
|
155
70
|
- lib/generators/install/konsierge_notifier.rb
|
156
71
|
- lib/generators/install/templates/error_template.html.erb
|
157
|
-
- lib/generators/install/templates/
|
72
|
+
- lib/generators/install/templates/konsierge_notifier.rb
|
158
73
|
- lib/generators/install/templates/template.html.erb
|
159
|
-
- lib/generators/konsierge/notifier/mailer/install_generator.rb
|
160
|
-
- lib/generators/konsierge/notifier/mailer/templates/README
|
161
|
-
- lib/generators/konsierge/notifier/mailer/templates/initializer.rb
|
162
74
|
- lib/konsierge/notifier.rb
|
75
|
+
- lib/konsierge/notifier/adapters/base_adapter.rb
|
76
|
+
- lib/konsierge/notifier/adapters/telegram.rb
|
163
77
|
- lib/konsierge/notifier/configuration.rb
|
164
|
-
- lib/konsierge/notifier/
|
165
|
-
- lib/konsierge/notifier/
|
78
|
+
- lib/konsierge/notifier/rails_report_subscriber.rb
|
79
|
+
- lib/konsierge/notifier/templates/telegram/error.html.erb
|
80
|
+
- lib/konsierge/notifier/templates/telegram/message.html.erb
|
166
81
|
- lib/konsierge/notifier/version.rb
|
167
82
|
- mise.toml
|
168
83
|
- sig/konsierge.rbs
|
169
84
|
- sig/konsierge/notifier.rbs
|
170
|
-
homepage:
|
171
85
|
licenses: []
|
172
86
|
metadata:
|
173
87
|
source_code_uri: https://gitlab.konsierge.com/digitalbox/gem/konsierge-notifier
|
174
88
|
rubygems_mfa_required: 'true'
|
175
|
-
post_install_message:
|
176
89
|
rdoc_options: []
|
177
90
|
require_paths:
|
178
91
|
- lib
|
@@ -187,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
100
|
- !ruby/object:Gem::Version
|
188
101
|
version: '0'
|
189
102
|
requirements: []
|
190
|
-
rubygems_version: 3.
|
191
|
-
signing_key:
|
103
|
+
rubygems_version: 3.6.8
|
192
104
|
specification_version: 4
|
193
105
|
summary: Notifier for Konsierge.
|
194
106
|
test_files: []
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails/generators'
|
4
|
-
|
5
|
-
module KonsiergeSmtpMailer
|
6
|
-
class InstallGenerator < ::Rails::Generators::Base
|
7
|
-
source_root File.expand_path('templates', __dir__)
|
8
|
-
desc 'Installs KonsiergeSmtpMailer.'
|
9
|
-
|
10
|
-
def install
|
11
|
-
template 'initializer.rb', 'config/initializers/konsierge-smtp-mailer.rb'
|
12
|
-
readme 'README'
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
===============================================================================
|
2
|
-
|
3
|
-
There is a setup that you need to do before you can use KonsiergeSmtpMailer.
|
4
|
-
|
5
|
-
Step 1.
|
6
|
-
Go to config/initializers/konsierge-smtp-mailer.rb and configure
|
7
|
-
smtp_mailer_host and smtp_mailer_auth_key.
|
8
|
-
|
9
|
-
Step 2.
|
10
|
-
Set new mailer in environment files:
|
11
|
-
|
12
|
-
config.action_mailer.delivery_method = :konsierge_smtp_mailer
|
13
|
-
|
14
|
-
Step 3.
|
15
|
-
That's it, that's all. Enjoy!
|
16
|
-
|
17
|
-
===============================================================================
|
18
|
-
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
ActionMailer::Base.add_delivery_method :konsierge_notifier, Konsierge::Notifier::Mailer
|
4
|
-
|
5
|
-
Konsierge::Notifier::Mailer.configure do |config|
|
6
|
-
config.smtp_mailer_host = ENV.fetch('KONSIERGE_SMTP_MAILER_HOST', nil)
|
7
|
-
config.smtp_mailer_auth_key = ENV.fetch('KONSIERGE_SMTP_MAILER_AUTH_KEY', nil)
|
8
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<b><%= CGI.escape_html(app_name.to_s) %></b>
|
2
|
-
<% "\n" %>
|
3
|
-
<b>Error</b>: <%= CGI.escape_html(error.class.to_s) %> - <%= CGI.escape_html(error.message.to_s) %>
|
4
|
-
<% "\n" %>
|
5
|
-
<b>Source</b>: <%= CGI.escape_html(source.to_s) %>
|
6
|
-
<% "\n" %>
|
7
|
-
<b>Trace:</b>
|
8
|
-
<%= error.backtrace[0..2].flatten.map { |trace| "===> #{CGI.escape_html(trace.to_s)}" }.join("\n") %>
|
File without changes
|