class FastlaneExt::TelegramNotifier
Public Class Methods
new(bot_api_token:, chat_id:)
click to toggle source
# File lib/fastlane-ext/telegram_notifier.rb, line 11 def initialize(bot_api_token:, chat_id:) raise 'Invalid Bot Api Token' if bot_api_token.empty? raise 'Invalid Chat Id' if chat_id.empty? @bot_api_token = bot_api_token @chat_id = chat_id end
Public Instance Methods
notify(message:, parse_mode: nil, silent: nil)
click to toggle source
# File lib/fastlane-ext/telegram_notifier.rb, line 19 def notify(message:, parse_mode: nil, silent: nil) uri = URI.parse("https://api.telegram.org/bot#{@bot_api_token}/sendMessage") params = { text: message, chat_id: @chat_id } params[:parse_mode] = parse_mode unless parse_mode.nil? params[:disable_notification] = silent || true Net::HTTP.post_form(uri, params) end