Module: MemberReminder::DingTalk
- Included in:
- MemberBank, MemberBank::Member
- Defined in:
- lib/member_reminder/ding_talk.rb
Instance Method Summary collapse
Instance Method Details
#post(token, content, mobiles = []) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/member_reminder/ding_talk.rb', line 5 def post(token, content, mobiles = []) mobiles = Array(mobiles) token ||= '2c26e98f69ce9960fdc308d8f7393dfe8f4b0d8dd04bc96766f6cbb20537091b' ::HTTP.post("https://oapi.dingtalk.com/robot/send?access_token=#{token}", :json => { msgtype: "text", text: { content: content, }, at: { atMobiles: [ mobiles.map { |m| %Q["#{m}"] }.join(',') ], isAtAll: false } } ) end |
#post_markdown(token, title, content) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/member_reminder/ding_talk.rb', line 24 def post_markdown(token, title, content) token ||= '2c26e98f69ce9960fdc308d8f7393dfe8f4b0d8dd04bc96766f6cbb20537091b' ::HTTP.post("https://oapi.dingtalk.com/robot/send?access_token=#{token}", :json => { msgtype: "markdown", markdown: { title: title, text: content, }, at: { isAtAll: true } } ) # system curl end |