class DingTalk::Command::Text
Public Class Methods
new(argv)
click to toggle source
Calls superclass method
DingTalk::Command::new
# File lib/DingTalk/command/text.rb, line 25 def initialize(argv) @content = argv.shift_argument at_str = argv.option('at'); @at_mobiles = [] if at_str then at_str.split(%r{,\s*}).each do |at_mobile| @at_mobiles << at_mobile unless at_mobile.nil? || at_mobile.empty? end end @is_at_all = argv.flag?('all', false) super end
options()
click to toggle source
Calls superclass method
DingTalk::Command::options
# File lib/DingTalk/command/text.rb, line 18 def self.options [ %w(--at=`at` [可选]被@人的手机号(在content里添加@人的手机号),多个手机号以英文逗号(`,`)分隔。), %w(--all [可选]@所有人), ].concat(super) end
Public Instance Methods
run()
click to toggle source
# File lib/DingTalk/command/text.rb, line 43 def run res = DingTalk::HttpHelper.send_text(@content, @at_mobiles, @is_at_all, @token, @secret) puts res.bold.green end
validate!()
click to toggle source
Calls superclass method
# File lib/DingTalk/command/text.rb, line 38 def validate! super help! 'A message content is required.' unless @content end