wechat 0.7.19 → 0.7.20
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/action_controller/wechat_responder.rb +10 -5
- data/lib/wechat/api_loader.rb +4 -6
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a1fcfa80de68c3711415ea5b2a09e2f00a2e89e8
|
|
4
|
+
data.tar.gz: fdfe9d0212a7536c011d8e3f04579dfca8547052
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 98d4bc51b5e7c838a0979e4b51819cfe0fce80f96b6090ea45ddd87e4df844bbf2f8c7b3572918dbc5a275cfbef399f5184741fffed4c0184abc23e672eb8bd1
|
|
7
|
+
data.tar.gz: c004f7e6e4912667f34a356e0f24cc8f0f0e002080e062996d166bdb706c532cb37a7e8f1c7d69a6708a3fe7d78f117817b62ef25332917dcba7798ce95a9142
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.7.20 (released at 8/29/2016)
|
|
4
|
+
|
|
5
|
+
* Apply opt and config together when loading controller_wechat, to simplify wechat_responder params. by @bzhang443 #147
|
|
6
|
+
|
|
3
7
|
## v0.7.19 (released at 8/25/2016)
|
|
4
8
|
|
|
5
9
|
* Enterprise account now custom_image/voice/file works now. by @zymiboxpay #145
|
data/README.md
CHANGED
|
@@ -5,7 +5,7 @@ WeChat [![Gem Version][version-badge]][rubygems] [![Build Status][travis-badge]]
|
|
|
5
5
|
|
|
6
6
|
[中文文档 Chinese document](/README-CN.md)
|
|
7
7
|
|
|
8
|
-
[Wechat](http://www.wechat.com/) is a free messaging and calling app developed by [Tencent](http://tencent.com/en-us/index.shtml), after linking billion people, Wechat
|
|
8
|
+
[Wechat](http://www.wechat.com/) is a free messaging and calling app developed by [Tencent](http://tencent.com/en-us/index.shtml), after linking billion people, Wechat had become [a platform of application](https://uxdesign.cc/wechat-the-invincible-app-a-key-to-business-success-in-china-8e9a920deb26?source=wechat_gem).
|
|
9
9
|
|
|
10
10
|
WeChat gem tries to help Rails developer to integrate [enterprise account](https://qy.weixin.qq.com) / [public account](https://mp.weixin.qq.com/) easily. Features below are ready and there is no need writing adapter code for talking to wechat server directly.
|
|
11
11
|
|
|
@@ -14,7 +14,7 @@ module ActionController
|
|
|
14
14
|
self.wechat_api_client ||= load_controller_wechat
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
private
|
|
18
18
|
|
|
19
19
|
def load_controller_wechat(opts = {})
|
|
20
20
|
self.token = opts[:token] || Wechat.config.token
|
|
@@ -29,13 +29,18 @@ module ActionController
|
|
|
29
29
|
Wechat.config.oauth2_cookie_duration ||= 1.hour
|
|
30
30
|
self.oauth2_cookie_duration = opts[:oauth2_cookie_duration] || Wechat.config.oauth2_cookie_duration.to_i.seconds
|
|
31
31
|
|
|
32
|
+
access_token = opts[:access_token] || Wechat.config.access_token
|
|
33
|
+
jsapi_ticket = opts[:jsapi_ticket] || Wechat.config.jsapi_ticket
|
|
34
|
+
|
|
32
35
|
return self.wechat_api_client = Wechat.api if opts.empty?
|
|
33
36
|
if corpid.present?
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
corpsecret = opts[:corpsecret] || Wechat.config.corpsecret
|
|
38
|
+
Wechat::CorpApi.new(corpid, corpsecret, access_token, \
|
|
39
|
+
agentid, timeout, skip_verify_ssl, jsapi_ticket)
|
|
36
40
|
else
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
secret = opts[:secret] || Wechat.config.secret
|
|
42
|
+
Wechat::Api.new(appid, secret, access_token, \
|
|
43
|
+
timeout, skip_verify_ssl, jsapi_ticket)
|
|
39
44
|
end
|
|
40
45
|
end
|
|
41
46
|
end
|
data/lib/wechat/api_loader.rb
CHANGED
|
@@ -27,9 +27,7 @@ HELP
|
|
|
27
27
|
@config
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
private_class_method
|
|
31
|
-
|
|
32
|
-
def self.loading_config!
|
|
30
|
+
private_class_method def self.loading_config!
|
|
33
31
|
config ||= config_from_file || config_from_environment
|
|
34
32
|
|
|
35
33
|
if defined?(::Rails)
|
|
@@ -42,7 +40,7 @@ HELP
|
|
|
42
40
|
@config = OpenStruct.new(config)
|
|
43
41
|
end
|
|
44
42
|
|
|
45
|
-
def self.config_from_file
|
|
43
|
+
private_class_method def self.config_from_file
|
|
46
44
|
if defined?(::Rails)
|
|
47
45
|
config_file = Rails.root.join('config/wechat.yml')
|
|
48
46
|
return YAML.load(ERB.new(File.read(config_file)).result)[Rails.env] if File.exist?(config_file)
|
|
@@ -63,7 +61,7 @@ HELP
|
|
|
63
61
|
end
|
|
64
62
|
end
|
|
65
63
|
|
|
66
|
-
def self.config_from_environment
|
|
64
|
+
private_class_method def self.config_from_environment
|
|
67
65
|
{ appid: ENV['WECHAT_APPID'],
|
|
68
66
|
secret: ENV['WECHAT_SECRET'],
|
|
69
67
|
corpid: ENV['WECHAT_CORPID'],
|
|
@@ -79,7 +77,7 @@ HELP
|
|
|
79
77
|
trusted_domain_fullname: ENV['WECHAT_TRUSTED_DOMAIN_FULLNAME'] }
|
|
80
78
|
end
|
|
81
79
|
|
|
82
|
-
def self.class_exists?(class_name)
|
|
80
|
+
private_class_method def self.class_exists?(class_name)
|
|
83
81
|
return Module.const_get(class_name).present?
|
|
84
82
|
rescue NameError
|
|
85
83
|
return false
|
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.20
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Skinnyworm
|
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
|
31
31
|
R5k6Ma92sW8jupX4cqbSu9rntdVQkNRpoHIrfU0MZT0cKsg/D1zMteylxrO3KMsz
|
|
32
32
|
SPQRv+nrI1J0zevFqb8010heoR8SDyUA0Mm3+Q==
|
|
33
33
|
-----END CERTIFICATE-----
|
|
34
|
-
date: 2016-08-
|
|
34
|
+
date: 2016-08-29 00:00:00.000000000 Z
|
|
35
35
|
dependencies:
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: activesupport
|
metadata.gz.sig
CHANGED
|
Binary file
|