wechat 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +25 -6
- data/bin/wechat +1 -0
- data/lib/generators/wechat/templates/app/controllers/wechats_controller.rb +7 -0
- data/lib/wechat/client.rb +4 -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: f59a6b94fe8cf2e353989117eae7ad5a628b0019
|
4
|
+
data.tar.gz: 6eeadd34d849454fe236cc6316b2712c96e803f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8832c94b0cd387a7da39e749ad8e99099f0a3a57f47072e77f4f27de1a4a6261e0f2a2376fbf627bbae53cf1f651268329b0f0052348a62e3c665d55730c2c91
|
7
|
+
data.tar.gz: 293a172e7da89170a5d459ffafc65de99b77afabab645a894e6bcbd5d0992449d7d5ae5a82a5f0398bb257900e1cf85e193a1e8cb1f80359c3edf94582f419b4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.6.1 (released at 10/20/2015)
|
4
|
+
|
5
|
+
* Handle 40001, invalid credential, access_token is invalid or not latest hint # 57
|
6
|
+
* Support at Rails 4.2.1 wechat can not run #58
|
7
|
+
|
3
8
|
## v0.6.0 (released at 10/08/2015)
|
4
9
|
|
5
10
|
### Scan and Batch job are BREAK CHANGE!
|
data/README.md
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
WeChat
|
1
|
+
WeChat [![Gem Version][version-badge]][rubygems] [![Build Status][travis-badge]][travis] [![Code Climate][codeclimate-badge]][codeclimate] [![Code Coverage][codecoverage-badge]][codecoverage]
|
2
2
|
======
|
3
3
|
|
4
|
-
[![
|
5
|
-
|
6
|
-
[![Issue Stats](http://issuestats.com/github/Eric-Guo/wechat/badge/issue)](http://issuestats.com/github/Eric-Guo/wechat) [![PR Stats](http://issuestats.com/github/Eric-Guo/wechat/badge/pr)](http://issuestats.com/github/Eric-Guo/wechat)
|
7
|
-
|
4
|
+
[![Join the chat][gitter-badge]][gitter] [![Issue Stats][issue-badge]][issuestats] [![PR Stats][pr-badge]][issuestats]
|
8
5
|
|
9
6
|
WeChat gem 可以帮助开发者方便地在Rails环境中集成微信[公众平台](https://mp.weixin.qq.com/)和[企业平台](https://qy.weixin.qq.com)提供的服务,包括:
|
10
7
|
|
@@ -397,6 +394,13 @@ class WechatsController < ApplicationController
|
|
397
394
|
request.reply.text "Subscribe user #{request[:FromUserName]} Ticket #{ticket}"
|
398
395
|
end
|
399
396
|
|
397
|
+
# 当没有任何on :scan事件处理已关注用户扫描的scene_id时
|
398
|
+
on :event, with: 'scan' do |request|
|
399
|
+
if request[:EventKey].present?
|
400
|
+
request.reply.text "event scan got EventKey #{request[:EventKey]} Ticket #{request[:Ticket]}"
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
400
404
|
# 企业号收到EventKey 为二维码扫描结果事件时
|
401
405
|
on :scan, with: 'BINDING_QR_CODE' do |request, scan_result, scan_type|
|
402
406
|
request.reply.text "User #{request[:FromUserName]} ScanResult #{scan_result} ScanType #{scan_type}"
|
@@ -516,4 +520,19 @@ Wechat 的核心是一个Message DSL,帮助开发者构建各种类型的消息
|
|
516
520
|
## 已知问题
|
517
521
|
|
518
522
|
* 企业号接受菜单消息时,Wechat腾讯服务器无法解析部分域名,请使用IP绑定回调URL,用户的普通消息目前不受影响。
|
519
|
-
* 企业号全量覆盖成员使用的csv通讯录格式,直接将下载的模板导入[是不工作的](http://qydev.weixin.qq.com/qa/index.php?qa=13978),必须使用Excel打开,然后另存为csv格式才会变成合法格式。
|
523
|
+
* 企业号全量覆盖成员使用的csv通讯录格式,直接将下载的模板导入[是不工作的](http://qydev.weixin.qq.com/qa/index.php?qa=13978),必须使用Excel打开,然后另存为csv格式才会变成合法格式。
|
524
|
+
|
525
|
+
|
526
|
+
[version-badge]: https://badge.fury.io/rb/wechat.svg
|
527
|
+
[rubygems]: https://rubygems.org/gems/wechat
|
528
|
+
[travis-badge]: https://travis-ci.org/Eric-Guo/wechat.svg
|
529
|
+
[travis]: https://travis-ci.org/Eric-Guo/wechat
|
530
|
+
[codeclimate-badge]: https://codeclimate.com/github/Eric-Guo/wechat.png
|
531
|
+
[codeclimate]: https://codeclimate.com/github/Eric-Guo/wechat
|
532
|
+
[codecoverage-badge]: https://codeclimate.com/github/Eric-Guo/wechat/coverage.png
|
533
|
+
[codecoverage]: https://codeclimate.com/github/Eric-Guo/wechat/coverage
|
534
|
+
[gitter-badge]: https://badges.gitter.im/Join%20Chat.svg
|
535
|
+
[gitter]: https://gitter.im/Eric-Guo/wechat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
536
|
+
[issue-badge]: http://issuestats.com/github/Eric-Guo/wechat/badge/issue
|
537
|
+
[pr-badge]: http://issuestats.com/github/Eric-Guo/wechat/badge/pr
|
538
|
+
[issuestats]: http://issuestats.com/github/Eric-Guo/wechat
|
data/bin/wechat
CHANGED
@@ -6,6 +6,7 @@ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
|
|
6
6
|
require 'thor'
|
7
7
|
require 'wechat'
|
8
8
|
require 'json'
|
9
|
+
require 'active_support' # To support Rails 4.2.1, see #17936
|
9
10
|
require 'active_support/dependencies/autoload'
|
10
11
|
require 'active_support/core_ext'
|
11
12
|
require 'active_support/json'
|
@@ -35,6 +35,13 @@ class WechatsController < ApplicationController
|
|
35
35
|
request.reply.text "Subscribe user #{request[:FromUserName]} Ticket #{ticket}"
|
36
36
|
end
|
37
37
|
|
38
|
+
# When no any on :scan responder can match subscribe user scaned scene_id
|
39
|
+
on :event, with: 'scan' do |request|
|
40
|
+
if request[:EventKey].present?
|
41
|
+
request.reply.text "event scan got EventKey #{request[:EventKey]} Ticket #{request[:Ticket]}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
38
45
|
# When enterprise user press menu BINDING_QR_CODE and success to scan bar code
|
39
46
|
on :scan, with: 'BINDING_QR_CODE' do |request, scan_result, scan_type|
|
40
47
|
request.reply.text "User #{request[:FromUserName]} ScanResult #{scan_result} ScanType #{scan_type}"
|
data/lib/wechat/client.rb
CHANGED
@@ -42,7 +42,10 @@ module Wechat
|
|
42
42
|
case data['errcode']
|
43
43
|
when 0 # for request didn't expect results
|
44
44
|
data
|
45
|
-
|
45
|
+
# 42001: access_token超时
|
46
|
+
# 40014: 不合法的access_token
|
47
|
+
# 40001, invalid credential, access_token is invalid or not latest hint
|
48
|
+
when 42001, 40014, 40001
|
46
49
|
fail AccessTokenExpiredError
|
47
50
|
else
|
48
51
|
fail ResponseError.new(data['errcode'], data['errmsg'])
|
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.6.
|
4
|
+
version: 0.6.1
|
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: 2015-10-
|
12
|
+
date: 2015-10-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|