wx_ext 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/lib/wx_ext/api/base.rb +142 -142
- data/lib/wx_ext/api/customer_service.rb +18 -18
- data/lib/wx_ext/api/js.rb +49 -46
- data/lib/wx_ext/api/mass.rb +62 -62
- data/lib/wx_ext/api/menu.rb +30 -31
- data/lib/wx_ext/api/msg.rb +32 -33
- data/lib/wx_ext/api/qrcode.rb +8 -8
- data/lib/wx_ext/api/semantic.rb +11 -12
- data/lib/wx_ext/api/template_msg.rb +32 -33
- data/lib/wx_ext/api/user/group.rb +52 -52
- data/lib/wx_ext/api/user.rb +78 -79
- data/lib/wx_ext/helper.rb +20 -20
- data/lib/wx_ext/version.rb +1 -1
- data/lib/wx_ext.rb +4 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cfbcac6ac267ac9cc7b021590b75ba89136f1d5
|
4
|
+
data.tar.gz: ce32c32fa26f850e1e7d6ab1dd59175a8e17a2ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59d2457c7a110da971cb70d669fec7cf74366bc3f4b419ed89097994c3ec8e51a55960d0edbc44bfbd7a127fe556b9d791bdfcb9e1ce88636fe8b2f90df05201
|
7
|
+
data.tar.gz: 3f5cf2cbbea4ee9dc43edff9cb1a93852986e344933b25530ba0a9e9ec7baeda8efbcd062e020fe266482a8ff28356110244a555469d4c7e36c07b89c61fb8f0
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# WxExt
|
2
2
|
|
3
|
-
|
3
|
+
Weixin extention, sougou weixin post spider and weixin api gem
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -16,15 +16,15 @@ And then execute:
|
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
-
|
19
|
+
See spec/wx_ext/
|
20
20
|
|
21
|
-
##
|
21
|
+
## Test
|
22
22
|
|
23
|
-
1.
|
24
|
-
2. rspec spec/wx_ext/weixin_spec.rb
|
25
|
-
3. rspec spec/wx_ext/sougou_weixin_spec.rb
|
23
|
+
1. Change `spec/wx_ext/weixin_spec.rb` file username and pass
|
24
|
+
2. `rspec spec/wx_ext/weixin_spec.rb`
|
25
|
+
3. `rspec spec/wx_ext/sougou_weixin_spec.rb`
|
26
26
|
|
27
|
-
##
|
27
|
+
## Yard
|
28
28
|
|
29
29
|
`yardoc lib/*.rb lib/wx_ext/*.rb lib/wx_ext/api/*.rb lib/wx_ext/api/user/*.rb`
|
30
30
|
|
data/lib/wx_ext/api/base.rb
CHANGED
@@ -11,153 +11,153 @@ module WxExt
|
|
11
11
|
# User api of weixin.
|
12
12
|
#
|
13
13
|
# @author FuShengYang
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
14
|
+
module Base
|
15
|
+
# Get the access_token for other apis via get.
|
16
|
+
#
|
17
|
+
# @param [Enumerable<String>] appid
|
18
|
+
# @param [Enumerable<String>] secret
|
19
|
+
# @param [Enumerable<String>] grant_type
|
20
|
+
# @return [Hash] "access_token":"ACCESS_TOKEN","expires_in":7200
|
21
|
+
def get_access_token(appid, secret, grant_type = 'client_credential')
|
22
|
+
url = 'https://api.weixin.qq.com/cgi-bin/token'\
|
23
|
+
"?grant_type=#{grant_type}&appid=#{appid}&secret=#{secret}"
|
24
|
+
Helper.http_get(url, { accept: :json })
|
25
|
+
end
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
# Get weixin server ips.
|
28
|
+
#
|
29
|
+
# @param [Enumerable<String>] access_token
|
30
|
+
# @return [Hash] A json parse hash.
|
31
|
+
def get_weixin_ips(access_token)
|
32
|
+
url = 'https://api.weixin.qq.com/cgi-bin/getcallbackip'\
|
33
|
+
"?access_token=#{access_token}"
|
34
|
+
Helper.http_get(url, { accept: :json })
|
35
|
+
end
|
37
36
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
37
|
+
# Get weixin error_code and msg map.
|
38
|
+
#
|
39
|
+
# @return [Hash] A json parse hash.
|
40
|
+
def code_msg
|
41
|
+
{
|
42
|
+
-1 => '系统繁忙,此时请开发者稍候再试',
|
43
|
+
0 => '请求成功',
|
44
|
+
40001 => '获取access_token时AppSecret错误,或者access_token无效。请开发者认真比对AppSecret的正确性,或查看是否正在为恰当的公众号调用接口',
|
45
|
+
40002 => '不合法的凭证类型',
|
46
|
+
40003 => '不合法的OpenID,请开发者确认OpenID(该用户)是否已关注公众号,或是否是其他公众号的OpenID',
|
47
|
+
40004 => '不合法的媒体文件类型',
|
48
|
+
40005 => '不合法的文件类型',
|
49
|
+
40006 => '不合法的文件大小',
|
50
|
+
40007 => '不合法的媒体文件id',
|
51
|
+
40008 => '不合法的消息类型',
|
52
|
+
40009 => '不合法的图片文件大小',
|
53
|
+
40010 => '不合法的语音文件大小',
|
54
|
+
40011 => '不合法的视频文件大小',
|
55
|
+
40012 => '不合法的缩略图文件大小',
|
56
|
+
40013 => '不合法的AppID,请开发者检查AppID的正确性,避免异常字符,注意大小写',
|
57
|
+
40014 => '不合法的access_token,请开发者认真比对access_token的有效性(如是否过期),或查看是否正在为恰当的公众号调用接口',
|
58
|
+
40015 => '不合法的菜单类型',
|
59
|
+
40016 => '不合法的按钮个数',
|
60
|
+
40017 => '不合法的按钮个数',
|
61
|
+
40018 => '不合法的按钮名字长度',
|
62
|
+
40019 => '不合法的按钮KEY长度',
|
63
|
+
40020 => '不合法的按钮URL长度',
|
64
|
+
40021 => '不合法的菜单版本号',
|
65
|
+
40022 => '不合法的子菜单级数',
|
66
|
+
40023 => '不合法的子菜单按钮个数',
|
67
|
+
40024 => '不合法的子菜单按钮类型',
|
68
|
+
40025 => '不合法的子菜单按钮名字长度',
|
69
|
+
40026 => '不合法的子菜单按钮KEY长度',
|
70
|
+
40027 => '不合法的子菜单按钮URL长度',
|
71
|
+
40028 => '不合法的自定义菜单使用用户',
|
72
|
+
40029 => '不合法的oauth_code',
|
73
|
+
40030 => '不合法的refresh_token',
|
74
|
+
40031 => '不合法的openid列表',
|
75
|
+
40032 => '不合法的openid列表长度',
|
76
|
+
40033 => '不合法的请求字符,不能包含\uxxxx格式的字符',
|
77
|
+
40035 => '不合法的参数',
|
78
|
+
40038 => '不合法的请求格式',
|
79
|
+
40039 => '不合法的URL长度',
|
80
|
+
40050 => '不合法的分组id',
|
81
|
+
40051 => '分组名字不合法',
|
82
|
+
41001 => '缺少access_token参数',
|
83
|
+
41002 => '缺少appid参数',
|
84
|
+
41003 => '缺少refresh_token参数',
|
85
|
+
41004 => '缺少secret参数',
|
86
|
+
41005 => '缺少多媒体文件数据',
|
87
|
+
41006 => '缺少media_id参数',
|
88
|
+
41007 => '缺少子菜单数据',
|
89
|
+
41008 => '缺少oauth code',
|
90
|
+
41009 => '缺少openid',
|
91
|
+
42001 => 'access_token超时,请检查access_token的有效期,请参考基础支持-获取access_token中,对access_token的详细机制说明',
|
92
|
+
42002 => 'refresh_token超时',
|
93
|
+
42003 => 'oauth_code超时',
|
94
|
+
43001 => '需要GET请求',
|
95
|
+
43002 => '需要POST请求',
|
96
|
+
43003 => '需要HTTPS请求',
|
97
|
+
43004 => '需要接收者关注',
|
98
|
+
43005 => '需要好友关系',
|
99
|
+
44001 => '多媒体文件',
|
100
|
+
44002 => 'POST的数据包',
|
101
|
+
44003 => '图文消息内容',
|
102
|
+
44004 => '文本消息内容',
|
103
|
+
45001 => '多媒体文件大小超过',
|
104
|
+
45002 => '消息内容超过',
|
105
|
+
45003 => '标题字段超过',
|
106
|
+
45004 => '描述字段超过',
|
107
|
+
45005 => '链接字段超过',
|
108
|
+
45006 => '图片链接字段超过',
|
109
|
+
45007 => '语音播放时间超过',
|
110
|
+
45008 => '图文消息超过',
|
111
|
+
45009 => '接口调用超过',
|
112
|
+
45010 => '创建菜单个数超过',
|
113
|
+
45015 => '回复时间超过',
|
114
|
+
45016 => '系统分组,不允许修改',
|
115
|
+
45017 => '分组名字过长',
|
116
|
+
45018 => '分组数量超过上限',
|
117
|
+
46001 => '不存在媒体数据',
|
118
|
+
46002 => '不存在的菜单版本',
|
119
|
+
46003 => '不存在的菜单数据',
|
120
|
+
46004 => '不存在的用户',
|
121
|
+
47001 => '解析JSON/XML内容错误',
|
122
|
+
48001 => 'api功能未授权,请确认公众号已获得该接口,可以在公众平台官网-开发者中心页中查看接口权限',
|
123
|
+
50001 => '用户未授权该api',
|
124
|
+
61451 => '参数错误(invalid parameter)',
|
125
|
+
61452 => '无效客服账号(invalid kf_account)',
|
126
|
+
61453 => '客服帐号已存在(kf_account exsited)',
|
127
|
+
61454 => '客服帐号名长度超过(仅允许10个英文字符,不包括@及@后的公众号的微信号)(invalid kf_acount length)',
|
128
|
+
61455 => '客服帐号名包含非法字符(仅允许英文+数字)(illegal character in kf_account)',
|
129
|
+
61456 => '客服帐号个数超过(10个客服账号)(kf_account count exceeded)',
|
130
|
+
61457 => '无效头像文件类型(invalid file type)',
|
131
|
+
61450 => '系统错误(system error)',
|
132
|
+
61500 => '日期格式错误',
|
133
|
+
61501 => '日期范围错误'
|
134
|
+
}
|
135
|
+
end
|
137
136
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
137
|
+
# Upload media to weixin.
|
138
|
+
#
|
139
|
+
# @param [Enumerable<String>] access_token
|
140
|
+
# @param [Enumerable<String>] type 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
|
141
|
+
# @param [File] media form-data中媒体文件标识,有filename、filelength、content-type等信息
|
142
|
+
# @return [Hash] "type":"TYPE","media_id":"MEDIA_ID","created_at":123456789
|
143
|
+
def upload_media(access_token, type, media)
|
144
|
+
url = 'http://file.api.weixin.qq.com/cgi-bin/media/upload'\
|
145
|
+
"?access_token=#{access_token}&type=#{type}"
|
146
|
+
Helper.http_post(url, {file: media})
|
147
|
+
end
|
149
148
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
end
|
149
|
+
# Download media from weixin.
|
150
|
+
#
|
151
|
+
# @param [Enumerable<String>] access_token
|
152
|
+
# @param [Enumerable<String>] media_id
|
153
|
+
# @return [Image] Download img.
|
154
|
+
def download_media(access_token, media_id)
|
155
|
+
url = 'http://file.api.weixin.qq.com/cgi-bin/media/get'\
|
156
|
+
"?access_token=#{access_token}&media_id=#{media_id}"
|
157
|
+
RestClient.get url
|
160
158
|
end
|
159
|
+
|
160
|
+
extend self
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|
@@ -11,25 +11,25 @@ module WxExt
|
|
11
11
|
#
|
12
12
|
# @author FuShengYang
|
13
13
|
module CustomerService
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
Helper.http_post(url, msg_hash.to_json)
|
31
|
-
end
|
14
|
+
# Reply msg via post.
|
15
|
+
#
|
16
|
+
# @param [Enumerable<String>] access_token
|
17
|
+
# @param [Enumerable<String>] to_user_openid
|
18
|
+
# @param [Enumerable<String>] msg_type
|
19
|
+
# @param [Hash] msg_hash
|
20
|
+
# @return [Hash] Json based hash.
|
21
|
+
def reply_msg(access_token, to_user_openid, msg_type, msg_hash)
|
22
|
+
url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send'\
|
23
|
+
"?access_token=#{access_token}"
|
24
|
+
msg_hash = {
|
25
|
+
:touser => to_user_openid,
|
26
|
+
:msgtype => msg_type,
|
27
|
+
"#{msg_type}".to_sym => msg_hash
|
28
|
+
}
|
29
|
+
Helper.http_post(url, msg_hash.to_json)
|
32
30
|
end
|
31
|
+
|
32
|
+
extend self
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/lib/wx_ext/api/js.rb
CHANGED
@@ -11,58 +11,61 @@ module WxExt
|
|
11
11
|
# User api of weixin.
|
12
12
|
#
|
13
13
|
# @author FuShengYang
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
14
|
+
module Js
|
15
|
+
# Get js api ticket.
|
16
|
+
#
|
17
|
+
# @param [Enumerable<String>] access_token
|
18
|
+
# @return [Hash] Json based hash.
|
19
|
+
def get_jsapi_ticket(access_token)
|
20
|
+
url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=#{access_token}&type=jsapi"
|
21
|
+
Helper.http_get(url, { accept: :json })
|
22
|
+
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
24
|
+
# Get js api config hash.
|
25
|
+
#
|
26
|
+
# @param [Enumerable<String>] access_token
|
27
|
+
# @param [Enumerable<String>] url
|
28
|
+
# @param [Enumerable<String>] app_id
|
29
|
+
# @return [Hash] Json based hash.
|
30
|
+
def get_jsapi_config(access_token, url, app_id)
|
31
|
+
config_hash = {}
|
32
|
+
jsapi_ticket_hash = get_jsapi_ticket(access_token)
|
33
|
+
timestamp = set_timestamp
|
34
|
+
noncestr = set_noncestr
|
35
|
+
if jsapi_ticket_hash['errcode'] == 0
|
36
|
+
jsapi_ticket = jsapi_ticket_hash['ticket']
|
37
|
+
str = "jsapi_ticket=#{jsapi_ticket}&noncestr=#{noncestr}×tamp=#{timestamp}&url=#{url}"
|
38
|
+
signature = Digest::SHA1.hexdigest(str)
|
39
|
+
config_hash = {
|
40
|
+
app_id: app_id,
|
41
|
+
timestamp: timestamp,
|
42
|
+
noncestr: noncestr,
|
43
|
+
signature: signature,
|
44
|
+
jsapi_ticket: jsapi_ticket,
|
45
|
+
url: url,
|
46
|
+
str: str
|
47
|
+
}
|
48
48
|
end
|
49
|
+
config_hash
|
50
|
+
end
|
49
51
|
|
50
|
-
|
52
|
+
private
|
51
53
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
# Set the noncestr of 16 byte.
|
55
|
+
#
|
56
|
+
# @return [String] 16 byte str.
|
57
|
+
def set_noncestr
|
58
|
+
[*'a'..'z',*'0'..'9',*'A'..'Z'].sample(16).join
|
59
|
+
end
|
58
60
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
end
|
61
|
+
# Set the timestamp.
|
62
|
+
#
|
63
|
+
# @return [String] timestamp str.
|
64
|
+
def set_timestamp
|
65
|
+
Time.now.to_i.to_s
|
65
66
|
end
|
67
|
+
|
68
|
+
extend self
|
66
69
|
end
|
67
70
|
end
|
68
71
|
end
|
data/lib/wx_ext/api/mass.rb
CHANGED
@@ -10,74 +10,74 @@ module WxExt
|
|
10
10
|
# User api of weixin.
|
11
11
|
#
|
12
12
|
# @author FuShengYang
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
13
|
+
module Mass
|
14
|
+
# Upload news to weixin server via post.
|
15
|
+
#
|
16
|
+
# @param [Enumerable<String>] access_token
|
17
|
+
# @param [Hash] news_hash
|
18
|
+
# @return [Hash] Json based hash.
|
19
|
+
def upload_news(access_token, news_hash)
|
20
|
+
url = 'https://api.weixin.qq.com/cgi-bin/media/uploadnews'\
|
21
|
+
"?access_token=#{access_token}"
|
22
|
+
Helper.http_post(url, news_hash.to_json)
|
23
|
+
end
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
25
|
+
# Mass to users by filter group via post.
|
26
|
+
#
|
27
|
+
# @param [Enumerable<String>] access_token
|
28
|
+
# @param [Hash] filter_hash
|
29
|
+
# @return [Hash] Json based hash.
|
30
|
+
def mass_by_filter_group(access_token, filter_hash)
|
31
|
+
url = 'https://api.weixin.qq.com/cgi-bin/message/mass/sendall'\
|
32
|
+
"?access_token=#{access_token}"
|
33
|
+
Helper.http_post(url, filter_hash.to_json)
|
34
|
+
end
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
36
|
+
# Mass to users by openid via post.
|
37
|
+
#
|
38
|
+
# @param [Enumerable<String>] access_token
|
39
|
+
# @param [Hash] openid_hash
|
40
|
+
# @return [Hash] Json based hash.
|
41
|
+
def mass_by_openid(access_token, openid_hash)
|
42
|
+
url = 'https://api.weixin.qq.com/cgi-bin/message/mass/send'\
|
43
|
+
"?access_token=#{access_token}"
|
44
|
+
Helper.http_post(url, openid_hash.to_json)
|
45
|
+
end
|
47
46
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
47
|
+
# Del mass via post.
|
48
|
+
#
|
49
|
+
# @param [Enumerable<String>] access_token
|
50
|
+
# @param [String] msg_id
|
51
|
+
# @return [Hash] Json based hash.
|
52
|
+
def del_mass(access_token, msg_id)
|
53
|
+
url = 'https://api.weixin.qq.com/cgi-bin/message/mass/delete'\
|
54
|
+
"?access_token=#{access_token}"
|
55
|
+
Helper.http_post(url, { msg_id: msg_id }.to_json)
|
56
|
+
end
|
58
57
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
58
|
+
# Preview mass via post.
|
59
|
+
#
|
60
|
+
# @param [Enumerable<String>] access_token
|
61
|
+
# @param [Hash] preview_hash
|
62
|
+
# @return [Hash] Json based hash.
|
63
|
+
def preview_mass(access_token, preview_hash)
|
64
|
+
url = 'https://api.weixin.qq.com/cgi-bin/message/mass/preview'\
|
65
|
+
"?access_token=#{access_token}"
|
66
|
+
Helper.http_post(url, preview_hash.to_json)
|
67
|
+
end
|
69
68
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
69
|
+
# Get mass status via post.
|
70
|
+
#
|
71
|
+
# @param [Enumerable<String>] access_token
|
72
|
+
# @param [String] msg_id
|
73
|
+
# @return [Hash] Json based hash.
|
74
|
+
def get_mass_status(access_token, msg_id)
|
75
|
+
url = 'https://api.weixin.qq.com/cgi-bin/message/mass/get'\
|
76
|
+
"?access_token=#{access_token}"
|
77
|
+
Helper.http_post(url, { msg_id: msg_id }.to_json)
|
80
78
|
end
|
79
|
+
|
80
|
+
extend self
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|