wechat 0.6.9 → 0.6.10
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 +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +0 -1
- data/lib/wechat/api_loader.rb +3 -2
- data/lib/wechat/responder.rb +15 -3
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a46351d945927448378043c4d7ff5305d42a16dc
|
4
|
+
data.tar.gz: b8f2ab96e6f7c04803a993cede138db3ac385b53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 388f39cc6658760db382a9f0cb327716a1cacaa2673ed655c32d10d160169d290342c70d259c560ad894d204e6481c453a7d26cd35c934cbf2b15d134f9df3c6
|
7
|
+
data.tar.gz: 93cd2d31a610c60ff6cb7962aea8f3e42813c55f35cd687ace7dd5091c1459549792ca8d76e244d79a5d68194705c6bd856ded5aad8c9730ee23449b0cfd6217
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
* Support Rails 3.2 again after support Rails 5.0. by @guange2015 #87
|
4
|
+
* Fetch setting from RAILS_ENV first, then fetch default. by @kikyous #85
|
5
|
+
* Warning not support on :scan with regular expression. by @kikyous #84
|
6
|
+
|
7
|
+
## v0.7.1 (released at 1/11/2016)
|
8
|
+
|
9
|
+
* Fix after using http, upload file function break. #78
|
10
|
+
* Add callback function after_wechat_response support. by @zfben #79
|
11
|
+
* Should using department_id instead of departmentid at enterprise api: user_simplelist/user_list.
|
12
|
+
|
13
|
+
## v0.7.0 (released at 1/1/2016)
|
14
|
+
|
15
|
+
* Using [http](https://github.com/httprb/http) instead of rest-client for performance reason. (not support upload file yet)
|
16
|
+
|
17
|
+
## v0.6.10 (released at 1/17/2016)
|
18
|
+
|
19
|
+
* Support Rails 3.2 again after support Rails 5.0. by @guange2015 #87
|
20
|
+
* Fetch setting from RAILS_ENV first, then fetch default. by @kikyous #85
|
21
|
+
* Warning not support on :scan with regular expression. by @kikyous #84
|
22
|
+
|
3
23
|
## v0.6.9 (released at 1/6/2016)
|
4
24
|
|
5
25
|
* Fix token refresh bug on multi worker. #76
|
data/README.md
CHANGED
data/lib/wechat/api_loader.rb
CHANGED
@@ -48,9 +48,10 @@ HELP
|
|
48
48
|
rails_config_file = File.join(Dir.getwd, 'config/wechat.yml')
|
49
49
|
home_config_file = File.join(Dir.home, '.wechat.yml')
|
50
50
|
if File.exist?(rails_config_file)
|
51
|
-
|
51
|
+
rails_env = ENV['RAILS_ENV'] || 'default'
|
52
|
+
config = YAML.load(ERB.new(File.read(rails_config_file)).result)[rails_env]
|
52
53
|
if config.present? && (config['appid'] || config['corpid'])
|
53
|
-
puts
|
54
|
+
puts "Using rails project config/wechat.yml #{rails_env} setting..."
|
54
55
|
return config
|
55
56
|
end
|
56
57
|
end
|
data/lib/wechat/responder.rb
CHANGED
@@ -8,7 +8,7 @@ module Wechat
|
|
8
8
|
|
9
9
|
included do
|
10
10
|
# Rails 5 remove before_filter and skip_before_filter
|
11
|
-
if
|
11
|
+
if respond_to?(:skip_before_action)
|
12
12
|
# Rails 5 API mode won't define verify_authenticity_token
|
13
13
|
skip_before_action :verify_authenticity_token unless defined?(:verify_authenticity_token)
|
14
14
|
before_action :verify_signature, only: [:show, :create]
|
@@ -29,7 +29,13 @@ module Wechat
|
|
29
29
|
if with.present?
|
30
30
|
fail 'Only text, event, click, view, scan and batch_job can having :with parameters' unless [:text, :event, :click, :view, :scan, :batch_job].include?(message_type)
|
31
31
|
config.merge!(with: with)
|
32
|
-
|
32
|
+
if message_type == :scan
|
33
|
+
if with.is_a?(String)
|
34
|
+
self.known_scan_key_lists = with
|
35
|
+
else
|
36
|
+
fail 'on :scan only support string in parameter with, detail see https://github.com/Eric-Guo/wechat/issues/84'
|
37
|
+
end
|
38
|
+
end
|
33
39
|
else
|
34
40
|
fail 'Message type click, view, scan and batch_job must specify :with parameters' if [:click, :view, :scan, :batch_job].include?(message_type)
|
35
41
|
end
|
@@ -41,6 +47,8 @@ module Wechat
|
|
41
47
|
user_defined_view_responders(with) << config
|
42
48
|
when :batch_job
|
43
49
|
user_defined_batch_job_responders(with) << config
|
50
|
+
when :scan
|
51
|
+
user_defined_scan_responders << config
|
44
52
|
when :location
|
45
53
|
user_defined_location_responders << config
|
46
54
|
else
|
@@ -64,6 +72,10 @@ module Wechat
|
|
64
72
|
@batch_job_responders[with] ||= []
|
65
73
|
end
|
66
74
|
|
75
|
+
def user_defined_scan_responders
|
76
|
+
@scan_responders ||= []
|
77
|
+
end
|
78
|
+
|
67
79
|
def user_defined_location_responders
|
68
80
|
@location_responders ||= []
|
69
81
|
end
|
@@ -88,7 +100,7 @@ module Wechat
|
|
88
100
|
elsif 'click' == message[:Event]
|
89
101
|
yield(* match_responders(responders, message[:EventKey]))
|
90
102
|
elsif known_scan_key_lists.include?(message[:EventKey])
|
91
|
-
yield(* known_scan_with_match_responders(
|
103
|
+
yield(* known_scan_with_match_responders(user_defined_scan_responders, message))
|
92
104
|
elsif 'batch_job_result' == message[:Event]
|
93
105
|
yield(* user_defined_batch_job_responders(message[:BatchJob][:JobType]), message[:BatchJob])
|
94
106
|
elsif 'location' == message[:Event]
|
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.10
|
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-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -139,12 +139,14 @@ licenses:
|
|
139
139
|
- MIT
|
140
140
|
metadata: {}
|
141
141
|
post_install_message: |-
|
142
|
-
|
143
|
-
|
142
|
+
***************************** WeChat Notice *****************************
|
143
|
+
Last version of v6 series, v7 relay on http gems and performance improved.
|
144
|
+
|
145
|
+
1. Scan 2D barcode using new syntax `on :scan, with: 'BINDING_QR_CODE'`
|
144
146
|
instead of previous `on :event, with: 'BINDING_QR_CODE' `.
|
145
147
|
2. Batch job using new syntax `on :batch_job, with: 'replace_user' `
|
146
148
|
instead of previous `on :event, with: 'replace_user' `.
|
147
|
-
|
149
|
+
***************************************************************************
|
148
150
|
rdoc_options: []
|
149
151
|
require_paths:
|
150
152
|
- lib
|