class Fastlane::Actions::GoogleChatAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/google_chat/actions/google_chat_action.rb, line 87 def self.available_options [ FastlaneCore::ConfigItem.new(key: :imageUrl, env_name: "GOOGLE_CHAT_imageUrl", description: "A description of your option", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :webhook, env_name: "GOOGLE_CHAT_webhook", description: "A description of your option", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :title, env_name: "GOOGLE_CHAT_title", description: "A description of your option", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :description, env_name: "GOOGLE_CHAT_webhook", description: "A description of your option", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :section1Title, env_name: "GOOGLE_CHAT_section1Title", description: "A description of your option", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :section1Description, env_name: "GOOGLE_CHAT_section1Description", description: "A description of your option", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :buttonTitle, env_name: "GOOGLE_CHAT_buttonTitle", description: "A description of your option", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :buttonUrl, env_name: "GOOGLE_CHAT_buttonUrl", description: "A description of your option", optional: false, type: String) ] end
description()
click to toggle source
# File lib/fastlane/plugin/google_chat/actions/google_chat_action.rb, line 70 def self.description "Send messages to Google Chat" end
details()
click to toggle source
# File lib/fastlane/plugin/google_chat/actions/google_chat_action.rb, line 82 def self.details # Optional: "Send messages to Google Chat rooms" end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/google_chat/actions/google_chat_action.rb, line 132 def self.is_supported?(platform) # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example) # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform # [:ios, :mac, :android].include?(platform) true end
return_value()
click to toggle source
# File lib/fastlane/plugin/google_chat/actions/google_chat_action.rb, line 78 def self.return_value # If your method provides a return value, you can describe here what it does end
run(params)
click to toggle source
# File lib/fastlane/plugin/google_chat/actions/google_chat_action.rb, line 10 def self.run(params) uri = URI.parse(params[:webhook]) cards = {cards: [ { header: { title: params[:title], imageUrl: params[:imageUrl] }, sections: [ { widgets: [ { textParagraph: { text: params[:description] } }, { keyValue: { topLabel: params[:section1Title], content: params[:section1Description] } } ] }, { widgets: [ { buttons: [ { textButton: { text: params[:buttonTitle], onClick: { openLink: { url: params[:buttonUrl] } } } } ] } ] } ] } ]} # Create the HTTP objects http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true # http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(uri.request_uri) request["Content-Type"] = "application/json" request.body = cards.to_json # Send the request response = http.request(request) # + response.read_body UI.message("Message sent!") end