Class: Fastlane::Actions::SqCiToolsSendTelegramMessageAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::SqCiToolsSendTelegramMessageAction
- Defined in:
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_telegram_message_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(_) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
55 56 57 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_telegram_message_action.rb', line 55 def self. ['Semen Kologrivov'] end |
.available_options ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_telegram_message_action.rb', line 39 def self. [ FastlaneCore::ConfigItem.new( key: :message, description: 'Message for send', optional: false, type: String ) ] + Options::Telegram. end |
.description ⇒ Object
31 32 33 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_telegram_message_action.rb', line 31 def self.description 'Send message via Telegram' end |
.details ⇒ Object
35 36 37 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_telegram_message_action.rb', line 35 def self.details '' end |
.is_supported?(_) ⇒ Boolean
59 60 61 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_telegram_message_action.rb', line 59 def self.is_supported?(_) true end |
.return_value ⇒ Object
51 52 53 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_telegram_message_action.rb', line 51 def self.return_value '' end |
.run(params) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_telegram_message_action.rb', line 9 def self.run(params) access_token = params[:telegram_access_token] chat_ids = params[:telegram_chat_ids] if access_token.nil? || access_token == "" || chat_ids.nil? || chat_ids == "" return end uri = URI.parse("https://api.telegram.org/bot#{access_token}/sendMessage") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true chat_ids.split(',').each do |chat_id| request = Net::HTTP::Post::Multipart.new(uri, { "chat_id" => chat_id, "text" => params[:message], "parse_mode" => params[:telegram_parse_mode] }) http.request(request) end end |