class Fastlane::Actions::DingtalkAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/dingtalk/actions/dingtalk_action.rb, line 31
def self.authors
  ["Kim Huang"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/dingtalk/actions/dingtalk_action.rb, line 44
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :access_token,
                            env_name: "DINGTALK_ACCESS_TOKEN",
                         description: "Access token for ding talk",
                            optional: false,
                       default_value: "",
                                type: String),
    FastlaneCore::ConfigItem.new(key: :title,
                            env_name: "DINGTALK_TITLE",
                         description: "Title",
                            optional: false,
                       default_value: "",
                                type: String),
    FastlaneCore::ConfigItem.new(key: :message,
                            env_name: "DINGTALK_MESSAGE",
                         description: "Message",
                            optional: false,
                       default_value: "",
                                type: String),
    FastlaneCore::ConfigItem.new(key: :more_title,
                            env_name: "DINGTALK_MORE_TITLE",
                         description: "More title",
                            optional: false,
                       default_value: "",
                                type: String),
    FastlaneCore::ConfigItem.new(key: :more_url,
                            env_name: "DINGTALK_MORE_URL",
                         description: "More URL",
                            optional: false,
                       default_value: "",
                                type: String)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/dingtalk/actions/dingtalk_action.rb, line 27
def self.description
  "a fastlane plugin for dingtalk."
end
details() click to toggle source
# File lib/fastlane/plugin/dingtalk/actions/dingtalk_action.rb, line 39
def self.details
  # Optional:
  "a fastlane plugin for dingtalk."
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/dingtalk/actions/dingtalk_action.rb, line 79
def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
  #
  [:ios, :mac, :android].include?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/dingtalk/actions/dingtalk_action.rb, line 35
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/dingtalk/actions/dingtalk_action.rb, line 6
def self.run(params)
  UI.message("The dingtalk plugin is working!")

  access_token = params[:access_token]

  title = params[:title]
  message = params[:message]
  more_title = params[:more_title]
  more_url = params[:more_url]

  DingBot.endpoint = 'https://oapi.dingtalk.com/robot/send'
  DingBot.access_token = access_token

  # Send ActionCard message
  message = DingBot::Message::WholeActionCard.new(title, message, more_title, more_url)

  DingBot.send_msg(message)

  UI.success "Message send success."
end