wechat 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README-CN.md +1 -0
- data/README.md +1 -0
- data/bin/wechat +5 -0
- data/lib/wechat/api.rb +4 -0
- data/lib/wechat/api_loader.rb +1 -1
- data/lib/wechat/message.rb +7 -3
- data/lib/wechat/responder.rb +1 -1
- 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: f60b7afc101f3badd6661236b6df3747d24995ce
|
4
|
+
data.tar.gz: b1c7ef968ef8db8c843a4edf35a48a169b647bd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3324275a6604f4cac101bd11ade6d4c405380432169febf634fb13b4d4fbbe5c548ce48d9f2faad1840e11272fda3699376cb3e944b4937750b057ed0b0df2ac
|
7
|
+
data.tar.gz: 14606aa8ff517eb6f1249e35cf7abb64862613cdb4ab748ae9f5baee805a3bb07e53c0bc55cd02c721c54ccbb3d7456223284dbcd261814b0533079704d6a677
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.7.3 (released at 1/19/2016)
|
4
|
+
|
5
|
+
* Allow transfer_customer_service to specific account.
|
6
|
+
* New customservice_getonlinekflist API.
|
7
|
+
* session support class WechatSession no need table_exists? methods exist.
|
8
|
+
|
3
9
|
## v0.7.2 (released at 1/18/2016)
|
4
10
|
|
5
11
|
* Optional session support by @zfben #81, #88, #91
|
data/README-CN.md
CHANGED
@@ -192,6 +192,7 @@ Wechat commands:
|
|
192
192
|
wechat custom_text [OPENID, TEXT_MESSAGE] # 发送文字客服消息
|
193
193
|
wechat custom_video [OPENID, VIDEO_PATH] # 发送视频客服消息
|
194
194
|
wechat custom_voice [OPENID, VOICE_PATH] # 发送语音客服消息
|
195
|
+
wechat customservice_getonlinekflist # 获取在线客服接待信息
|
195
196
|
wechat group_create [GROUP_NAME] # 创建分组
|
196
197
|
wechat group_delete [GROUP_ID] # 删除分组
|
197
198
|
wechat group_update [GROUP_ID, NEW_GROUP_NAME] # 修改分组名
|
data/README.md
CHANGED
@@ -205,6 +205,7 @@ Wechat commands:
|
|
205
205
|
wechat custom_text [OPENID, TEXT_MESSAGE] # 发送文字客服消息
|
206
206
|
wechat custom_video [OPENID, VIDEO_PATH] # 发送视频客服消息
|
207
207
|
wechat custom_voice [OPENID, VOICE_PATH] # 发送语音客服消息
|
208
|
+
wechat customservice_getonlinekflist # 获取在线客服接待信息
|
208
209
|
wechat group_create [GROUP_NAME] # 创建分组
|
209
210
|
wechat group_delete [GROUP_ID] # 删除分组
|
210
211
|
wechat group_update [GROUP_ID, NEW_GROUP_NAME] # 修改分组名
|
data/bin/wechat
CHANGED
@@ -281,6 +281,11 @@ class App < Thor
|
|
281
281
|
def qrcode_create_limit_scene(scene_id_or_str)
|
282
282
|
puts wechat_api.qrcode_create_limit_scene(scene_id_or_str)
|
283
283
|
end
|
284
|
+
|
285
|
+
desc 'customservice_getonlinekflist', '获取在线客服接待信息'
|
286
|
+
def customservice_getonlinekflist
|
287
|
+
puts wechat_api.customservice_getonlinekflist
|
288
|
+
end
|
284
289
|
end
|
285
290
|
|
286
291
|
desc 'user [OPEN_ID]', '获取用户基本信息'
|
data/lib/wechat/api.rb
CHANGED
@@ -113,6 +113,10 @@ module Wechat
|
|
113
113
|
post 'message/template/send', message.to_json, content_type: :json
|
114
114
|
end
|
115
115
|
|
116
|
+
def customservice_getonlinekflist
|
117
|
+
get 'customservice/getonlinekflist'
|
118
|
+
end
|
119
|
+
|
116
120
|
# http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html
|
117
121
|
# 第二步:通过code换取网页授权access_token
|
118
122
|
def web_access_token(code)
|
data/lib/wechat/api_loader.rb
CHANGED
@@ -24,7 +24,6 @@ HELP
|
|
24
24
|
def self.config
|
25
25
|
return @config unless @config.nil?
|
26
26
|
@config ||= loading_config!
|
27
|
-
@config.have_session_table = class_exists?('WechatSession') && WechatSession.table_exists?
|
28
27
|
@config
|
29
28
|
end
|
30
29
|
|
@@ -38,6 +37,7 @@ HELP
|
|
38
37
|
config[:jsapi_ticket] ||= Rails.root.join('tmp/jsapi_ticket').to_s
|
39
38
|
end
|
40
39
|
config[:timeout] ||= 20
|
40
|
+
config[:have_session_class] = class_exists?('WechatSession')
|
41
41
|
config.symbolize_keys!
|
42
42
|
@config = OpenStruct.new(config)
|
43
43
|
end
|
data/lib/wechat/message.rb
CHANGED
@@ -42,7 +42,7 @@ module Wechat
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def session
|
45
|
-
return nil unless Wechat.config.
|
45
|
+
return nil unless Wechat.config.have_session_class
|
46
46
|
@message_hash[:WechatSession] ||= WechatSession.find_or_initialize_session(underscore_hash_keys(message_hash))
|
47
47
|
end
|
48
48
|
|
@@ -81,8 +81,12 @@ module Wechat
|
|
81
81
|
update(MsgType: 'text', Content: content)
|
82
82
|
end
|
83
83
|
|
84
|
-
def transfer_customer_service
|
85
|
-
|
84
|
+
def transfer_customer_service(kf_account = nil)
|
85
|
+
if kf_account
|
86
|
+
update(MsgType: 'transfer_customer_service', TransInfo: { KfAccount: kf_account })
|
87
|
+
else
|
88
|
+
update(MsgType: 'transfer_customer_service')
|
89
|
+
end
|
86
90
|
end
|
87
91
|
|
88
92
|
def success
|
data/lib/wechat/responder.rb
CHANGED
@@ -178,7 +178,7 @@ module Wechat
|
|
178
178
|
render nothing: true, status: 200, content_type: 'text/html'
|
179
179
|
end
|
180
180
|
|
181
|
-
response_msg.save_session if response_msg.is_a?(Wechat::Message) && Wechat.config.
|
181
|
+
response_msg.save_session if response_msg.is_a?(Wechat::Message) && Wechat.config.have_session_class
|
182
182
|
|
183
183
|
ActiveSupport::Notifications.instrument 'wechat.responder.after_create', request: request_msg, response: response_msg
|
184
184
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wechat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Skinnyworm
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-01-
|
12
|
+
date: 2016-01-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|