dingbot 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 891eb19b1f3dbc85d7cd60765985dd7c8e9b6f00
4
- data.tar.gz: 86616b1c794ec9933694c0d651b3dd222a518686
3
+ metadata.gz: 0f3900000e1d35173b8444d6895f2abc081d3d4a
4
+ data.tar.gz: bb25170d9dacb52ec4680df49c411707a4ae06f1
5
5
  SHA512:
6
- metadata.gz: a78af359e4c94dd0b5ca679af2fe92c6f98ffc061efa7498083923514c35bc45215b757309b5a290c45589d5ed0c3373525428d11e8e799a24f594b0bd1535b3
7
- data.tar.gz: c75e226f9218042e415b77938bc0cae19a15dbd8ce316fc363215b5a4e82023bb0e67ffa51f9703e7d2e712631e3f03f8d568a5b80a45f80649c60c0d15f64ee
6
+ metadata.gz: 9584951d70aebb491bcf6eb4184b1779b33ae79f6b525b70b6695c3816b1cce47c925980648224d939235abeab2f32d4987745e52f93156b75041d3b618b43c9
7
+ data.tar.gz: f377b6f1a43757fe38ae38c54b01c19a4981c3e61c6309732b5ee3165f25d667785c4fd96a0b7b8d8f768c5a89a4239e3ccd811ea0b54bca1a567f760fe9c088
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # DingTalk Bot
2
- [![Gem Version](https://rubygems.org/gems/dingbot)](https://badge.fury.io/rb/dingbot.svg)
2
+ [![Build Status](https://travis-ci.org/thierryxing/dingtalk-bot.svg?branch=master)](https://travis-ci.org/thierryxing/dingtalk-bot)
3
+ [![Gem Version](https://badge.fury.io/rb/dingbot.svg)](https://rubygems.org/gems/dingbot)
3
4
  [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/thierryxing/dingtalk-bot/master/LICENSE.txt)
4
5
 
5
6
  DingTalk Bot是阿里钉钉自定义机器人的Ruby库
@@ -24,10 +25,15 @@ gem 'dingbot'
24
25
  初始化客户端:
25
26
 
26
27
  ```ruby
28
+ # 全局配置方式
27
29
  DingBot.configure do |config|
28
30
  config.endpoint = 'https://oapi.dingtalk.com/robot/send' # API endpoint URL, default: ENV['DINGTALK_API_ENDPOINT'] or https://oapi.dingtalk.com/robot/send
29
31
  config.access_token = '3ddef428f1478056e858450e07272834c79bd538e8055a04e989573c469xxxx' # access token, default: ENV['DINGTALK_ACCESS_TOKEN']
30
32
  end
33
+
34
+ # 局部配置方式
35
+ DingBot.endpoint='https://oapi.dingtalk.com/robot/send'
36
+ DingBot.access_token = '3ddef428f1478056e858450e07272834c79bd538e8055a04e989573c469xxxx'
31
37
  ```
32
38
 
33
39
  发送消息
@@ -41,7 +47,7 @@ end
41
47
  def send_text
42
48
  message = DingBot::Message::Text.new(
43
49
  '我就是我, 是不一样的烟火',
44
- ['13718896117'],
50
+ ['1371xxxx117'],
45
51
  false
46
52
  )
47
53
  DingBot.send_msg(message)
@@ -52,7 +58,7 @@ def send_link
52
58
  message = DingBot::Message::Link.new(
53
59
  '我就是我, 是不一样的烟火',
54
60
  '这个即将发布的新版本,创始人陈航(花名“无招”)称它为“红树林”。',
55
- 'https://mp.weixin.qq.com/s?__biz=MzA4NjMwMTA2Ng==&mid=2650316842&idx=1&sn=60da3ea2b29f1dcc43a7c8e4a7c97a16&scene=2&srcid=09189AnRJEdIiWVaKltFzNTw&from=timeline&isappinstalled=0&key=&ascene=2&uin=&devicetype=android-23&version=26031933&nettype=WIFI',
61
+ 'https://www.dingtalk.com/',
56
62
  'https://avatars1.githubusercontent.com/u/64818'
57
63
  )
58
64
  DingBot.send_msg(message)
@@ -109,4 +115,4 @@ end
109
115
  更为详细的用法请见此链接:[https://github.com/thierryxing/dingtalk-bot/blob/master/test/dingbot_test.rb](https://github.com/thierryxing/dingtalk-bot/blob/master/test/dingbot_test.rb)
110
116
 
111
117
  ## License
112
- Released under the MIT license. See LICENSE.txt for details.
118
+ Released under the MIT license. See LICENSE.txt for details.
@@ -10,14 +10,22 @@ module DingBot
10
10
  # "> 9度,西北风1级,空气良89,相对温度73%\n\n" +
11
11
  # "> ![screenshot](http://image.jpg)\n" +
12
12
  # "> ###### 10点20分发布 [天气](http://www.thinkpage.cn/) \n"
13
+ # },
14
+ # "at": {
15
+ # "atMobiles": [
16
+ # "1825718XXXX"
17
+ # ],
18
+ # "isAtAll": false
13
19
  # }
14
20
  # }
15
21
  class Markdown < Base
16
- attr_accessor :title, :text
22
+ attr_accessor :title, :text, :at_mobiles, :is_at_all
17
23
 
18
- def initialize(title='', text='')
24
+ def initialize(title='', text='', at_mobiles=[], is_at_all=false)
19
25
  @title = title
20
26
  @text = text
27
+ @at_mobiles = at_mobiles
28
+ @is_at_all = is_at_all
21
29
  end
22
30
 
23
31
  def msg_type
@@ -25,10 +33,15 @@ module DingBot
25
33
  end
26
34
 
27
35
  def body_params
28
- super.merge(
36
+ super.merge({
29
37
  markdown: {
30
38
  text: @text,
31
39
  title: @title,
40
+ },
41
+ at: {
42
+ atMobiles: @at_mobiles,
43
+ isAtAll: @is_at_all
44
+ }
32
45
  }
33
46
  )
34
47
  end
@@ -1,5 +1,5 @@
1
1
  module DingBot
2
2
 
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dingbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thierry Xing
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-19 00:00:00.000000000 Z
11
+ date: 2018-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  version: '0'
135
135
  requirements: []
136
136
  rubyforge_project:
137
- rubygems_version: 2.5.1
137
+ rubygems_version: 2.6.14
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: 钉钉自定义机器人Ruby库