Class: Fastlane::Actions::SqCiToolsSendMaxMessageAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::SqCiToolsSendMaxMessageAction
- Defined in:
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_max_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
64 65 66 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_max_message_action.rb', line 64 def self. ['Semen Kologrivov'] end |
.available_options ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_max_message_action.rb', line 48 def self. [ FastlaneCore::ConfigItem.new( key: :message, description: 'Message for send', optional: false, type: String ) ] + Options::Max. end |
.description ⇒ Object
40 41 42 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_max_message_action.rb', line 40 def self.description 'Send message via Max' end |
.details ⇒ Object
44 45 46 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_max_message_action.rb', line 44 def self.details '' end |
.is_supported?(_) ⇒ Boolean
68 69 70 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_max_message_action.rb', line 68 def self.is_supported?(_) true end |
.return_value ⇒ Object
60 61 62 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_max_message_action.rb', line 60 def self.return_value '' end |
.run(params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_max_message_action.rb', line 10 def self.run(params) access_token = params[:max_access_token] chat_ids = params[:max_chat_ids] if access_token.nil? || access_token == "" || chat_ids.nil? || chat_ids == "" return end puts params chat_ids.split(',').each do |chat_id| uri = URI.parse("https://platform-api.max.ru") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.set_debug_output($stdout) request = Net::HTTP::Post.new("/messages?chat_id=#{chat_id}") request.add_field('Content-Type', 'application/json') request.add_field('Authorization', access_token) request.body = { "text" => params[:message], "format" => params[:max_format] }.to_json response = http.request(request) puts response puts response. puts response.body end end |