wechat_public_api 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wechat_public_api/kf_message.rb +22 -22
- data/lib/wechat_public_api/templet_message.rb +12 -12
- data/lib/wechat_public_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5041f661bea1b425bc2ee410608b57ab0189291
|
4
|
+
data.tar.gz: eca2b80d1cdfa8f1ec5ea3773e1c33045d1391d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da34aa6178a8f923ea16cb955e25bf29ec0563c1ba4e1e32abe30c2da61c082f53a5444aa4d835f7431af17101fc689fe455fe48edc8538d30ebcc94fc70cd26
|
7
|
+
data.tar.gz: 6834a328295225f88cb6e9103a6e6fde9fb49f589d5e8fc5a208205a96d7ffb1aef618a6a95d4c98826a004a4c4d926df98d7613bfc117d5dc64a476e6e3343b
|
@@ -45,13 +45,13 @@ class WechatPublicApi
|
|
45
45
|
def kf_text_message(openid, content, kf_account=nil)
|
46
46
|
|
47
47
|
custom_message = {
|
48
|
-
touser
|
49
|
-
msgtype
|
50
|
-
text
|
48
|
+
:touser => openid,
|
49
|
+
:msgtype => 'text',
|
50
|
+
:text => {:content => content}
|
51
51
|
}
|
52
52
|
|
53
53
|
if kf_account
|
54
|
-
custom_message.merge({customservice:
|
54
|
+
custom_message.merge({:customservice => {:account => kf_account}})
|
55
55
|
end
|
56
56
|
|
57
57
|
post_customer_message custom_message
|
@@ -64,13 +64,13 @@ class WechatPublicApi
|
|
64
64
|
def kf_image_message(openid, media_id, kf_account=nil)
|
65
65
|
|
66
66
|
custom_message = {
|
67
|
-
touser
|
68
|
-
msgtype
|
69
|
-
image
|
67
|
+
:touser => openid,
|
68
|
+
:msgtype => 'image',
|
69
|
+
:image => {:media_id => media_id}
|
70
70
|
}
|
71
71
|
|
72
72
|
if kf_account
|
73
|
-
custom_message.merge({customservice:
|
73
|
+
custom_message.merge({:customservice => {:account => kf_account}})
|
74
74
|
end
|
75
75
|
|
76
76
|
post_customer_message custom_message
|
@@ -79,12 +79,12 @@ class WechatPublicApi
|
|
79
79
|
# 发送图文消息(点击跳转到图文消息页面)
|
80
80
|
def kf_mpnews_message(openid, media_id, kf_account=nil)
|
81
81
|
custom_message = {
|
82
|
-
touser
|
83
|
-
msgtype
|
84
|
-
mpnews
|
82
|
+
:touser => openid,
|
83
|
+
:msgtype => 'mpnews',
|
84
|
+
:mpnews => {:media_id => media_id}
|
85
85
|
}
|
86
86
|
if kf_account
|
87
|
-
custom_message.merge({customservice:
|
87
|
+
custom_message.merge({:customservice => {:account => kf_account}})
|
88
88
|
end
|
89
89
|
|
90
90
|
post_customer_message custom_message
|
@@ -111,15 +111,15 @@ class WechatPublicApi
|
|
111
111
|
# 发送图文消息(点击跳转到外链)
|
112
112
|
def kf_news_message(openid, articles, kf_account=nil)
|
113
113
|
custom_message = {
|
114
|
-
touser
|
115
|
-
msgtype
|
116
|
-
news
|
117
|
-
articles
|
114
|
+
:touser => openid,
|
115
|
+
:msgtype => 'news',
|
116
|
+
:news => {
|
117
|
+
:articles => articles
|
118
118
|
}
|
119
119
|
}
|
120
120
|
|
121
121
|
if kf_account
|
122
|
-
custom_message.merge({customservice:
|
122
|
+
custom_message.merge({:customservice => {:account => kf_account}})
|
123
123
|
end
|
124
124
|
post_customer_message custom_message
|
125
125
|
end
|
@@ -128,14 +128,14 @@ class WechatPublicApi
|
|
128
128
|
def kf_voice_message(openid, media_id, kf_account=nil)
|
129
129
|
|
130
130
|
custom_message = {
|
131
|
-
touser
|
132
|
-
msgtype
|
133
|
-
voice
|
134
|
-
media_id
|
131
|
+
:touser => openid,
|
132
|
+
:msgtype => 'voice',
|
133
|
+
:voice => {
|
134
|
+
:media_id => media_id
|
135
135
|
}
|
136
136
|
}
|
137
137
|
if kf_account
|
138
|
-
custom_message.merge({customservice:
|
138
|
+
custom_message.merge({:customservice => {:account => kf_account}})
|
139
139
|
end
|
140
140
|
post_customer_message custom_message
|
141
141
|
end
|
@@ -60,14 +60,14 @@ class WechatPublicApi
|
|
60
60
|
# 小程序模板消息
|
61
61
|
def tp_miniprogram_message(openid, templet_id, url, appid, pagepath, data)
|
62
62
|
message = {
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
63
|
+
:touser => openid,
|
64
|
+
:template_id => templet_id,
|
65
|
+
:url => url,
|
66
|
+
:miniprogram =>{
|
67
|
+
:appid => appid,
|
68
|
+
:pagepath => pagepath
|
69
69
|
},
|
70
|
-
|
70
|
+
:data => data
|
71
71
|
}
|
72
72
|
|
73
73
|
post_template_message message, 'send'
|
@@ -76,10 +76,10 @@ class WechatPublicApi
|
|
76
76
|
# 普通的模板消息,不跳转小程序
|
77
77
|
def tp_general_message(openid, templet_id, url, data)
|
78
78
|
message = {
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
:touser => openid,
|
80
|
+
:template_id => templet_id,
|
81
|
+
:url => url,
|
82
|
+
:data => data
|
83
83
|
}
|
84
84
|
post_template_message message, 'send'
|
85
85
|
end
|
@@ -87,7 +87,7 @@ class WechatPublicApi
|
|
87
87
|
# 删除模板
|
88
88
|
def tp_delete_template(templet_id)
|
89
89
|
message = {
|
90
|
-
|
90
|
+
:template_id => template_id
|
91
91
|
}
|
92
92
|
post_template_message message, 'del_private_template'
|
93
93
|
end
|