wechat 0.7.14 → 0.7.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ee9e70f17f62c608e75487348f1931638db3acc
4
- data.tar.gz: 2324834ce8690aeab08707612d230e3831fa5267
3
+ metadata.gz: 3dc56f21f48d36e92b661e701ef739bf57c0e19c
4
+ data.tar.gz: a3e8fa2c4e22491607a006695992a544d54020d1
5
5
  SHA512:
6
- metadata.gz: 1edab9326f1f48c5eefa7993f7fcac909eda38d8c9141446bf2c49a201bfe4caae1458dbe970f7ce5686316f1927c700a87684d8aa3af6ffefc132d876341828
7
- data.tar.gz: 6a383130d1f5015aa8e81e6230a27e5a66f7d85ab69afc6e26290d569b048390c34986c95ef8038c2ed9a882d051fad2051731e823e3c0a532a9ed4c38e2af8d
6
+ metadata.gz: 2fa99da16ca5d3587970a1a81bcec0b301bea9c1bd1e29811bd992452deb0f9554382cf464056c5a7a88ab709dc406f8495734bdd829077bfebb594593b0dda1
7
+ data.tar.gz: 15ce193b4dd2939f3d79e3d98e0666de9b6b451505ea376a801cefb76090ef108ad29ae6e258e65c6f3b6747ba36ff2dbe2a094b4a3e750d6af7fd94b4847c23
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.7.15 (released at 7/03/2016)
4
+
5
+ * RSpec testing case on Rails 5 now.
6
+ * Resolve Rails 5 ActionController::Parameters issue.
7
+
3
8
  ## v0.7.14 (released at 5/29/2016)
4
9
 
5
10
  * Fix when access_token failed lead ticket can not refresh problem.
@@ -242,7 +242,9 @@ end
242
242
 
243
243
  `wechat_oauth2`封装了OAuth2.0验证接口和cookie处理逻辑,用户仅需提供业务代码块即可。userid指的是微信企业成员UserID,openid是关注该公众号的用户openid。
244
244
 
245
- 注意: 如果使用 `wechat_responder`, 请不要在 Controller 里定义 `show` 和 `create` 方法, 否则会报错。
245
+ 注意:
246
+ * 如果使用 `wechat_responder`, 请不要在 Controller 里定义 `show` 和 `create` 方法, 否则会报错。
247
+ * 如果遇到“redirect_uri参数错误”的错误信息,请登录服务号管理后台,查看“开发者中心/网页服务/网页授权获取用户基本信息”的授权回调页面域名已正确配置。
246
248
 
247
249
  ## 关于接口权限
248
250
 
data/README.md CHANGED
@@ -5,38 +5,38 @@ 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 linked billion people, Wechat become a platform of application
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 has become a platform of application
9
9
 
10
- WeChat gem trying to helping Rails developer to integrated [enterprise account](https://qy.weixin.qq.com) / [public account](https://mp.weixin.qq.com/) easily. Below feature is ready and no need writing adapter code talking to wechat server directly.
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
 
12
12
  - [Sending message](http://qydev.weixin.qq.com/wiki/index.php?title=%E5%8F%91%E9%80%81%E6%B6%88%E6%81%AF) API(Can access via console or in rails)
13
- - [Receiving message](http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E6%B6%88%E6%81%AF%E4%B8%8E%E4%BA%8B%E4%BB%B6)(You must running on rails server to receiving message)
13
+ - [Receiving message](http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E6%B6%88%E6%81%AF%E4%B8%8E%E4%BA%8B%E4%BB%B6)(You must run on rails server to receiving message)
14
14
  - [Wechat JS-SDK](http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BE%AE%E4%BF%A1JS%E6%8E%A5%E5%8F%A3) config signature
15
15
  - OAuth 2.0 authentication
16
- - Record session when received message from user (Optional)
16
+ - Record session when receiving message from user (Optional)
17
17
 
18
18
 
19
- `wechat` command share the same API in console, so you can interactive with wechat server quickly, without starting up web environment/code.
19
+ `wechat` command shares the same API in console, so you can interactive with wechat server quickly, without starting up web environment/code.
20
20
 
21
- A responder DSL can used in Rails controller, so giving a event based interface to handler message sent by end user from wechat server.
21
+ A responder DSL can be used in Rails controller, so giving an event based interface to handle messages sent by end user from wechat server.
22
22
 
23
- Wechat provide OAuth2.0 authentication method `wechat_oauth2`, possible the easiest way, for the user perfer using devise style authorization gems, [omniauth-wechat-oauth2](https://github.com/skinnyworm/omniauth-wechat-oauth2) can be a good option.
23
+ Wechat provides OAuth2.0 authentication method `wechat_oauth2`, possibly the easiest way, for the users who perfer using devise style authorization gems, [omniauth-wechat-oauth2](https://github.com/skinnyworm/omniauth-wechat-oauth2) can be a good option.
24
24
 
25
25
  There is official [weui](https://github.com/weui/weui), which corresponding Rails gems called [weui-rails](https://github.com/Eric-Guo/weui-rails) available, if you prefer following the same UI design as wechat.
26
26
 
27
- For web page only wechat application, using [`wechat_api`](#wechat_api---rails-controller-wechat-api), which only contain web feature compare with traditional message type [`wechat_responder`](#wechat_responder---rails-responder-controller-dsl).
27
+ For web page only wechat application, please use [`wechat_api`](#wechat_api---rails-controller-wechat-api), which only contains web feature compare with traditional message type [`wechat_responder`](#wechat_responder---rails-responder-controller-dsl).
28
28
 
29
29
  There is a more complete [wechat-starter](https://github.com/goofansu/wechat-starter) demo available, even include the payment SDK feature.
30
30
 
31
31
  ## Installation
32
32
 
33
- Using `gem install`
33
+ Use `gem install`
34
34
 
35
35
  ```
36
36
  gem install "wechat"
37
37
  ```
38
38
 
39
- Or add to your app's `Gemfile`:
39
+ Or add it to your app's `Gemfile`:
40
40
 
41
41
  ```
42
42
  gem 'wechat'
@@ -54,7 +54,7 @@ Run the generator:
54
54
  rails generate wechat:install
55
55
  ```
56
56
 
57
- `rails g wechat:install` will generated the initial `wechat.yml` configuration, example wechat controller and corresponding routes.
57
+ `rails g wechat:install` will generated the initial `wechat.yml` configuration file, including an example wechat controller and corresponding routes.
58
58
 
59
59
  Enable session record:
60
60
 
@@ -255,7 +255,9 @@ end
255
255
 
256
256
  `wechat_oauth2` already implement the necessory OAuth2.0 and cookie logic. userid defined as the enterprise member UserID. openid defined as the user who following the public account, also notice openid will be different for the same user for different following public account.
257
257
 
258
- Notice: If you use `wechat_responder` in your controller, you cannot use `create` and `show` action in your controller, otherwise will throw errors.
258
+ Notice:
259
+ * If you use `wechat_responder` in your controller, you cannot use `create` and `show` action in your controller, otherwise will throw errors.
260
+ * If you get *redirect_uri parameter error* message, make sure you set the correct callback site url value in wechat management console with path *Development center / Webpage service / Webpage authorization for retrieving user basic informaiton*.
259
261
 
260
262
 
261
263
  ## The API privilege
@@ -189,7 +189,7 @@ module Wechat
189
189
  render text: process_response(response_msg)
190
190
  end
191
191
  else
192
- render nothing: true, status: 200, content_type: 'text/html'
192
+ head :ok, content_type: 'text/html'
193
193
  end
194
194
 
195
195
  response_msg.save_session if response_msg.is_a?(Wechat::Message) && Wechat.config.have_session_class
@@ -223,12 +223,14 @@ module Wechat
223
223
  data = Hash.from_xml(content)
224
224
  end
225
225
 
226
+ data_hash = data.fetch('xml', {})
226
227
  if Rails::VERSION::MAJOR >= 5
227
- HashWithIndifferentAccess.new(data.fetch('xml', {})).tap do |msg|
228
+ data_hash = data_hash.to_unsafe_hash if data_hash.instance_of?(ActionController::Parameters)
229
+ HashWithIndifferentAccess.new(data_hash).tap do |msg|
228
230
  msg[:Event].downcase! if msg[:Event]
229
231
  end
230
232
  else
231
- HashWithIndifferentAccess.new_from_hash_copying_default(data.fetch('xml', {})).tap do |msg|
233
+ HashWithIndifferentAccess.new_from_hash_copying_default(data_hash).tap do |msg|
232
234
  msg[:Event].downcase! if msg[:Event]
233
235
  end
234
236
  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.14
4
+ version: 0.7.15
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-05-29 00:00:00.000000000 Z
12
+ date: 2016-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -85,28 +85,28 @@ dependencies:
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '3.4'
88
+ version: '3.5'
89
89
  type: :development
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '3.4'
95
+ version: '3.5'
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: rails
98
98
  requirement: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: '3.2'
102
+ version: '5'
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - ">="
108
108
  - !ruby/object:Gem::Version
109
- version: '3.2'
109
+ version: '5'
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: sqlite3
112
112
  requirement: !ruby/object:Gem::Requirement