gfd_wechat 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +321 -0
- data/LICENSE +21 -0
- data/README-CN.md +815 -0
- data/README.md +844 -0
- data/bin/wechat +520 -0
- data/lib/action_controller/wechat_responder.rb +72 -0
- data/lib/generators/wechat/config_generator.rb +36 -0
- data/lib/generators/wechat/install_generator.rb +20 -0
- data/lib/generators/wechat/menu_generator.rb +21 -0
- data/lib/generators/wechat/redis_store_generator.rb +16 -0
- data/lib/generators/wechat/session_generator.rb +36 -0
- data/lib/generators/wechat/templates/MENU_README +3 -0
- data/lib/generators/wechat/templates/app/controllers/wechats_controller.rb +12 -0
- data/lib/generators/wechat/templates/app/models/wechat_config.rb +46 -0
- data/lib/generators/wechat/templates/app/models/wechat_session.rb +17 -0
- data/lib/generators/wechat/templates/config/initializers/wechat_redis_store.rb +42 -0
- data/lib/generators/wechat/templates/config/wechat.yml +72 -0
- data/lib/generators/wechat/templates/config/wechat_menu.yml +6 -0
- data/lib/generators/wechat/templates/config/wechat_menu_android.yml +15 -0
- data/lib/generators/wechat/templates/db/config_migration.rb.erb +40 -0
- data/lib/generators/wechat/templates/db/session_migration.rb.erb +10 -0
- data/lib/wechat/api.rb +54 -0
- data/lib/wechat/api_base.rb +63 -0
- data/lib/wechat/api_loader.rb +145 -0
- data/lib/wechat/cipher.rb +66 -0
- data/lib/wechat/concern/common.rb +217 -0
- data/lib/wechat/controller_api.rb +96 -0
- data/lib/wechat/corp_api.rb +168 -0
- data/lib/wechat/helpers.rb +47 -0
- data/lib/wechat/http_client.rb +112 -0
- data/lib/wechat/message.rb +265 -0
- data/lib/wechat/mp_api.rb +46 -0
- data/lib/wechat/responder.rb +308 -0
- data/lib/wechat/signature.rb +10 -0
- data/lib/wechat/ticket/corp_jsapi_ticket.rb +14 -0
- data/lib/wechat/ticket/jsapi_base.rb +84 -0
- data/lib/wechat/ticket/public_jsapi_ticket.rb +14 -0
- data/lib/wechat/token/access_token_base.rb +53 -0
- data/lib/wechat/token/corp_access_token.rb +13 -0
- data/lib/wechat/token/public_access_token.rb +13 -0
- data/lib/wechat.rb +52 -0
- metadata +195 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 338d5066057a01d9933b7e9c11de3f763e966fc2
|
4
|
+
data.tar.gz: 6abca0ce372f0c500f1ee43800267bff99518c1c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 266da7b2027099d40cbd2d3523d163ec971a8713bf9827be5d253577943235c96eff4fe49ed4ad345dcaf8c633824de11eef84e6863ac128474ca2d0a4baff61
|
7
|
+
data.tar.gz: 8d102abb0c0f71f452c70fb67cfcce1f2333a43aa258f3b099d8eab2fcc36e6c87edc3870557609540d3fb5c141a82ff1014da8854b09fce1d5035100c351a91
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,321 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## v0.10.3 (released at 10/07/2018)
|
4
|
+
|
5
|
+
* Fix new share problem in iOS by @killernova #242
|
6
|
+
|
7
|
+
## v0.10.2 (released at 8/27/2018)
|
8
|
+
|
9
|
+
* Fix incompatible with Rails 5.2.1 by @chloerei #239
|
10
|
+
|
11
|
+
## v0.10.1 (released at 7/1/2018)
|
12
|
+
|
13
|
+
* Allow custom_message_send using Hash as message, previous only allow Wechat::Message. by @zuoliang0 and @fogisland #234
|
14
|
+
|
15
|
+
## v0.10.0 (released at 5/31/2018)
|
16
|
+
|
17
|
+
* Support multi wechat account at wechat_responder. by @tuliren #223
|
18
|
+
* Support wechat mini program apis & signature check. by @oiahoon #225
|
19
|
+
* Support sent template message with miniprogram. by @falm #228
|
20
|
+
* Fix request_content could be nil. by @paicha #229
|
21
|
+
|
22
|
+
## v0.9.0 (released at 4/15/2018)
|
23
|
+
|
24
|
+
* Support multi wechat account dynamically loading from DB. by @tuliren #222
|
25
|
+
* user_create API for enterprise account. #206
|
26
|
+
* Will ignore template_message_send error 43004 by @insub #214
|
27
|
+
* using template with version if the migration version available by @killernova #220
|
28
|
+
* Remove Deprecation oauth2_url
|
29
|
+
* Remove Ruby 2.2 support, add Rails 5.2 and http v3 support
|
30
|
+
|
31
|
+
## v0.8.12 (released at 9/13/2017)
|
32
|
+
|
33
|
+
* Read oauth2_state from ticket store every time to avoid invalid oauth2_state by @xiewenwei #196
|
34
|
+
|
35
|
+
## v0.8.11 (released at 7/25/2017)
|
36
|
+
|
37
|
+
* oauth2 state code not refresh at the same time of jsapi tickets refresh bug, many thanks @xiewenwei #192
|
38
|
+
* Add string type scene support for qrcode_create_scene. by @libuchao #191
|
39
|
+
|
40
|
+
## v0.8.10 (released at 6/19/2017)
|
41
|
+
|
42
|
+
* fix material_delete correctly.
|
43
|
+
|
44
|
+
## v0.8.9 (released at 6/18/2017)
|
45
|
+
|
46
|
+
* wechat material_delete failed to work, thanks @Victorialice report #78
|
47
|
+
|
48
|
+
## v0.8.8 (released at 5/18/2017)
|
49
|
+
|
50
|
+
* Better support multiple account. by @xiewenwei #187
|
51
|
+
* Allow load figaro via RAILS_ENV. by @goofansu #186
|
52
|
+
|
53
|
+
## v0.8.7 (released at 4/23/2017)
|
54
|
+
|
55
|
+
* Support new wxa_get_wxacode API for miniapp.
|
56
|
+
* Add InvalidCredentialError, support audio/amr, voice/speex as file and text/plain as json. by @acenqiu #184
|
57
|
+
|
58
|
+
## v0.8.6 (released at 3/17/2017)
|
59
|
+
|
60
|
+
* Support Rails 5.1 officially.
|
61
|
+
* make sure the formfile can be created outside. by @mechiland #181
|
62
|
+
|
63
|
+
## v0.8.5 (released at 3/14/2017)
|
64
|
+
|
65
|
+
* Support mass send API #176
|
66
|
+
* Support new media_hq API
|
67
|
+
* Support new createwxaqrcode API for miniapp
|
68
|
+
* Fix wechat_responder not proper injected in rails 5 API #165
|
69
|
+
* parse response support XML return, by @zhangbin #167
|
70
|
+
* WeChat only allow 8 article per one news, by @kikyous #175
|
71
|
+
* Store token at cookies, by @jstdoit #174
|
72
|
+
|
73
|
+
## v0.8.4 (released at 1/12/2017)
|
74
|
+
|
75
|
+
* Support Ruby 2.4.0
|
76
|
+
* Add support of Enterprise RedPacket API, by @zhangbin #169
|
77
|
+
|
78
|
+
## v0.8.3 (released at 11/26/2016)
|
79
|
+
|
80
|
+
* Fix wechat template key has camelCase problem, by @RyanChenDji #159
|
81
|
+
* Fix long time of oauth2_state bug for wechat_oauth2 methods, by @IvanChou #162
|
82
|
+
|
83
|
+
## v0.8.2 (released at 11/2/2016)
|
84
|
+
|
85
|
+
* Bug which if not using multi-account but using web login.
|
86
|
+
|
87
|
+
## v0.8.1 (released at 11/2/2016)
|
88
|
+
|
89
|
+
* After allow sub controller using wechat_api, it's possible not initialise at first time. by @IvanChou #155
|
90
|
+
* Support web application login scope snsapi_login.
|
91
|
+
* Add unionid support for public account.
|
92
|
+
* Remove OpenId in Enterprise OAuth2 as it's not supported by Tecent.
|
93
|
+
|
94
|
+
## v0.8.0 (released at 10/24/2016)
|
95
|
+
|
96
|
+
* Complete support multi-wechat public account. by @xiewenwei #150
|
97
|
+
* Support loading configure value from Figaro if application.yml exist.
|
98
|
+
|
99
|
+
## v0.7.20 (released at 8/29/2016)
|
100
|
+
|
101
|
+
* Apply opt and config together when loading controller_wechat, to simplify wechat_responder params. by @bzhang443 #147
|
102
|
+
|
103
|
+
## v0.7.19 (released at 8/25/2016)
|
104
|
+
|
105
|
+
* Enterprise account now custom_image/voice/file works now. by @zymiboxpay #145
|
106
|
+
* Fix timeout setting no effective since introduct HTTP. found by @hsluo #74
|
107
|
+
|
108
|
+
## v0.7.18 (released at 8/21/2016)
|
109
|
+
|
110
|
+
* Support label_location message, similar to location event, but sent by user with Label. #144
|
111
|
+
* Add gem signature as additional security methods.
|
112
|
+
|
113
|
+
## v0.7.17 (released at 8/18/2016)
|
114
|
+
|
115
|
+
* Allow declare wechat_api at ApplicationController, but using wechat at sub controller. #104
|
116
|
+
|
117
|
+
## v0.7.16 (released at 7/27/2016)
|
118
|
+
|
119
|
+
* FIX: consider '' in params as equal with nil, in ControllerApi#wechat_public_oauth2, by @snow #135
|
120
|
+
* New tag API for public account, by @pynixwang #127
|
121
|
+
* fix SSLv3 error by use TLSv1_client, by @IvanChou #133
|
122
|
+
|
123
|
+
## v0.7.15 (released at 7/03/2016)
|
124
|
+
|
125
|
+
* RSpec testing case on Rails 5 now.
|
126
|
+
* Resolve Rails 5 ActionController::Parameters issue.
|
127
|
+
|
128
|
+
## v0.7.14 (released at 5/29/2016)
|
129
|
+
|
130
|
+
* Fix when access_token failed lead ticket can not refresh problem.
|
131
|
+
* Default duration should be 1 hours instead of 0 seconds for wechat_oauth2.
|
132
|
+
* New short_url allowing convert from long URL to short.
|
133
|
+
|
134
|
+
## v0.7.13 (released at 5/14/2016)
|
135
|
+
|
136
|
+
* Wechat.config.oauth2_cookie_duration need convert to secondes, found by @gabrieltong #111
|
137
|
+
|
138
|
+
## v0.7.12 (released at 5/12/2016)
|
139
|
+
|
140
|
+
* Fix web_userinfo wrong URL, found by @gabrieltong #110
|
141
|
+
|
142
|
+
## v0.7.11 (released at 4/18/2016)
|
143
|
+
|
144
|
+
* To cover wrong release 0.7.10, nothing change
|
145
|
+
|
146
|
+
## v0.7.10 (released at 4/18/2016) (yanked)
|
147
|
+
|
148
|
+
## v0.7.9 (released at 4/12/2016)
|
149
|
+
|
150
|
+
* wechat_oauth2 support public account now.
|
151
|
+
* Refresh and store state on jsapi ticket, using it on oauth2_url to more secure.
|
152
|
+
* Remove extra sending payload in message template send json
|
153
|
+
* Allow setting oauth2_cookie_duration in config
|
154
|
+
|
155
|
+
## v0.7.8 (released at 3/31/2016)
|
156
|
+
|
157
|
+
* New wechat_api, similar to wechat_responder, but without messange handle DSL, support web page only wechat application
|
158
|
+
* New media_uploadimg API.
|
159
|
+
* New file type of Message.
|
160
|
+
* Improved multi account support per different controller.
|
161
|
+
|
162
|
+
## v0.7.7 (released at 3/18/2016)
|
163
|
+
|
164
|
+
* New wechat_oauth2, only support enterprise account still.
|
165
|
+
* fix 'skip_before_action :verify_authenticity_token' bug for v5.0.0.beta3 by @vkill #97
|
166
|
+
* Support Rails 3.2 again after support Rails 5.0, by @guange2015 #96
|
167
|
+
|
168
|
+
## v0.7.6 (released at 3/05/2016)
|
169
|
+
|
170
|
+
* Support wechat public account conditional menu. #95
|
171
|
+
|
172
|
+
## v0.7.5 (released at 2/21/2016)
|
173
|
+
|
174
|
+
* New wechat_config_js to simplify the Wechat jsapi config.
|
175
|
+
* Support sent shortvideo.
|
176
|
+
|
177
|
+
## v0.7.4 (released at 1/23/2016)
|
178
|
+
|
179
|
+
* Add Redis store token/ticket support, close #76, #60
|
180
|
+
* Rails 5 support without deprecate warning or other not necessory call. #82
|
181
|
+
|
182
|
+
## v0.7.3 (released at 1/19/2016)
|
183
|
+
|
184
|
+
* Allow transfer_customer_service to specific account.
|
185
|
+
* New customservice_getonlinekflist API.
|
186
|
+
* session support class WechatSession no need table_exists? methods exist.
|
187
|
+
|
188
|
+
## v0.7.2 (released at 1/18/2016)
|
189
|
+
|
190
|
+
* Optional session support by @zfben #81, #88, #91
|
191
|
+
* Replace after_wechat_response with Rails Nofications facility, by @zfben, original issue is #79
|
192
|
+
* New user_batchget API. #89
|
193
|
+
* Support Rails 3.2 again after support Rails 5.0. by @guange2015 #87
|
194
|
+
* Fetch setting from RAILS_ENV first, then fetch default. by @kikyous #85
|
195
|
+
* Warning not support on :scan with regular expression, reason see #84
|
196
|
+
|
197
|
+
## v0.7.1 (released at 1/11/2016)
|
198
|
+
|
199
|
+
* Fix after using http, upload file function break. #78
|
200
|
+
* Add callback function after_wechat_response support. by @zfben #79
|
201
|
+
* Should using department_id instead of departmentid at enterprise api: user_simplelist/user_list.
|
202
|
+
|
203
|
+
## v0.7.0 (released at 1/1/2016)
|
204
|
+
|
205
|
+
* Using [http](https://github.com/httprb/http) instead of rest-client for performance reason. (not support upload file yet)
|
206
|
+
|
207
|
+
## v0.6.10 (released at 1/17/2016)
|
208
|
+
|
209
|
+
* Support Rails 3.2 again after support Rails 5.0. by @guange2015 #87
|
210
|
+
* Fetch setting from RAILS_ENV first, then fetch default. by @kikyous #85
|
211
|
+
* Warning not support on :scan with regular expression. by @kikyous #84
|
212
|
+
|
213
|
+
## v0.6.9 (released at 1/6/2016)
|
214
|
+
|
215
|
+
* Fix token refresh bug on multi worker. #76
|
216
|
+
* Rewrite the token relative code to add more storage support in future.
|
217
|
+
|
218
|
+
## v0.6.8 (released at 12/25/2015)
|
219
|
+
|
220
|
+
* Support Rails 5.0.0.beta1.
|
221
|
+
* English README available
|
222
|
+
* Fix oauth2_url calling error, fix #75
|
223
|
+
|
224
|
+
## v0.6.7 (released at 12/18/2015)
|
225
|
+
|
226
|
+
* Add timeout configuration option, close #74
|
227
|
+
* New getuserinfo and oauth2_url to support getting FromUserName from web page.
|
228
|
+
|
229
|
+
## v0.6.6 (released at 12/15/2015)
|
230
|
+
|
231
|
+
* Add jsapi_ticket support for Enterprise Account
|
232
|
+
* Default generated WechatsController < ActionController::Base, as many Rails application may having #authenticate_user or #set_current_user in ApplicationController, so easily affect the first time using experience.
|
233
|
+
* New syntax `on :view, with: 'VIEW_URL'` support.
|
234
|
+
* New command `upload_replaceparty` which combine three sub command to make uploading department easier.
|
235
|
+
* New command `upload_replaceuser` which combine three sub command to make uploading user easier.
|
236
|
+
|
237
|
+
## v0.6.5 (released at 11/24/2015)
|
238
|
+
|
239
|
+
* Handle 48001 error if token is expire/not valid, close #71
|
240
|
+
* ApiLoader will do config reading and initialize the api instead of spreading the logic.
|
241
|
+
|
242
|
+
## v0.6.4 (released at 11/16/2015)
|
243
|
+
|
244
|
+
* Command mode now display different command set based on enterprise/public account setting
|
245
|
+
* Move config logic in command/wechat to ApiLoader class
|
246
|
+
* Unsubscribe can only reply plain text 'success' #68
|
247
|
+
* Fix 404 qrcode download problem, by @huangxiangdan #69
|
248
|
+
|
249
|
+
## v0.6.3 (released at 11/14/2015)
|
250
|
+
|
251
|
+
* Official testing and support public encrypt mode, also fix one cipher bug, many thanks to @hlltc #67
|
252
|
+
* hlltc report public account FILE_BASE no longer needs, clean code #67
|
253
|
+
* Media command line reflect recent Tecent json schema change. #67
|
254
|
+
|
255
|
+
## v0.6.2 (released at 11/05/2015)
|
256
|
+
|
257
|
+
* Tecent report location API changed, so change wechat gems also. #64
|
258
|
+
|
259
|
+
## v0.6.1 (released at 10/20/2015)
|
260
|
+
|
261
|
+
* Handle 40001, invalid credential, access_token is invalid or not latest hint # 57
|
262
|
+
* Support at Rails 4.2.1 wechat can not run #58
|
263
|
+
|
264
|
+
## v0.6.0 (released at 10/08/2015)
|
265
|
+
|
266
|
+
### Scan and Batch job are BREAK CHANGE!
|
267
|
+
|
268
|
+
* Scan 2D barcode using new syntax `on :scan, with: 'BINDING_QR_CODE' ` instead of `on :event, with: 'BINDING_QR_CODE' ` in previous version #55
|
269
|
+
Which will fix can not using `on :event, with: "scan" ` problem
|
270
|
+
* Batch job using new syntax `on :batch_job, with: 'replace_user' `
|
271
|
+
instead of previous `on :event, with: 'replace_user' `.
|
272
|
+
* Click menu support new syntax `on :click, with: 'BOOK_LUNCH' `, but `on :event, with: 'BOOK_LUNCH' ` still supported. perfer `on :click` because it running faster and more nature expression.
|
273
|
+
* Wechat::Responder using Hash for new :client and :batch_job event, avoid time consuming Array match responder
|
274
|
+
* Fix refresh token not working problem under ruby 2.0.0 #54
|
275
|
+
* New department_update, user_batchdelete, convert_to_openid API
|
276
|
+
|
277
|
+
## v0.5.0 (released at 9/25/2015)
|
278
|
+
|
279
|
+
* Only relay on activesupport on run time, so will greatly improve wechat cli startup time
|
280
|
+
* Add rails generator support `rails g wechat:install`
|
281
|
+
* Add batch job support for enterprise account like batch create user/department, both API, callback responder and CLI
|
282
|
+
* Add material management API and CLI
|
283
|
+
* Add tag API and CLI for enterprise account
|
284
|
+
* Add QR code scene function for public account
|
285
|
+
|
286
|
+
## v0.4.2 (released at 9/7/2015)
|
287
|
+
|
288
|
+
* Fix wrong number of arguments at Wechat::Responder.on by using arity #47
|
289
|
+
* Fix can not access wechat method after using instance level context.
|
290
|
+
* Fix skip_verify_ssl parameter error.
|
291
|
+
|
292
|
+
## v0.4.1 (released at 9/6/2015)
|
293
|
+
|
294
|
+
* Limit news articles collection to 10, close #5
|
295
|
+
* Resolve the conflict with gem "responders" by @seamon #45
|
296
|
+
|
297
|
+
## v0.4.0 (released at 9/5/2015)
|
298
|
+
|
299
|
+
* Enable the verify SSL for enterprise mode by default, as security is more importent than speed, but still can switch off by configure
|
300
|
+
* Support scancode_push/scancode_waitmsg event.
|
301
|
+
* New API method can get wechat server IP list
|
302
|
+
* New API to query/create department/media/material
|
303
|
+
* Fix can not read token_file in mingw bug, which introduce at #43
|
304
|
+
|
305
|
+
## v0.3.0 (released at 8/30/2015)
|
306
|
+
|
307
|
+
* New user group management API
|
308
|
+
* Allow transfer to customer service on fallback. #42
|
309
|
+
* Read and write access_token properly using file locking, #43
|
310
|
+
|
311
|
+
## v0.2.0 (released at 8/27/2015)
|
312
|
+
|
313
|
+
* Add wechat enterprise account support
|
314
|
+
* Make responder execute in action context, by @lazing #15
|
315
|
+
* jsapi_ticket support, by @feitian124 #27
|
316
|
+
* Rename gems to wechat and ambitious to being #1 gems about development wechat. thanks Xiaoning transfer this gem name.
|
317
|
+
* Original gem `wechat-rails` author skinnyworm trasfer to Eric-Guo as maintainer
|
318
|
+
|
319
|
+
## v0.1.1
|
320
|
+
|
321
|
+
* Initial release from [wechat-rails](https://github.com/skinnyworm/wechat-rails).
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 skinnyworm
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|