Class: ExceptionNotifier::TelegramNotifier
- Inherits:
-
Object
- Object
- ExceptionNotifier::TelegramNotifier
- Defined in:
- lib/exception_notification_telegram.rb
Instance Method Summary collapse
- #call(exception, options = {}) ⇒ Object
-
#initialize(options) ⇒ TelegramNotifier
constructor
A new instance of TelegramNotifier.
Constructor Details
#initialize(options) ⇒ TelegramNotifier
Returns a new instance of TelegramNotifier.
8 9 10 11 12 13 |
# File 'lib/exception_notification_telegram.rb', line 8 def initialize() @token = .delete(:token) @channel = .delete(:channel) raise ArgumentError, "You must provide 'token' and 'channel' option" unless @token && @channel end |
Instance Method Details
#call(exception, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/exception_notification_telegram.rb', line 15 def call(exception, = {}) @options = @exception = exception @formatter = Formatter.new(exception, ) url = "https://api.telegram.org/bot#{@token}/sendMessage" HTTParty.post(url, ) end |