wechat 0.12.2 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +4 -392
- data/README-CN.md +4 -0
- data/README.md +4 -0
- data/bin/wechat +0 -3
- data/lib/action_controller/wechat_responder.rb +0 -11
- data/lib/generators/wechat/config_generator.rb +1 -1
- data/lib/generators/wechat/session_generator.rb +1 -1
- data/lib/wechat.rb +23 -11
- data/lib/wechat/api.rb +0 -6
- data/lib/wechat/cipher.rb +1 -1
- data/lib/wechat/controller_api.rb +2 -2
- data/lib/wechat/corp_api.rb +0 -5
- data/lib/wechat/mp_api.rb +0 -8
- data/lib/wechat/responder.rb +9 -41
- data/lib/wechat/ticket/corp_jsapi_ticket.rb +0 -2
- data/lib/wechat/ticket/public_jsapi_ticket.rb +0 -2
- data/lib/wechat/token/corp_access_token.rb +0 -2
- data/lib/wechat/token/public_access_token.rb +0 -2
- metadata +22 -8
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 983ca9ebf1007ad2f68e079d7ed625c59a10e78198992abf84a5b9718592ff26
|
4
|
+
data.tar.gz: 976751bb11aba9a0fa30674a39eaef432eb39c177a315b396d95c458c0afde45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeee17ba746530fbab18470172d83df90ff995ebdfa9ec92866361bbeacda03848e11a8ea278db6544ea57774513754b2dd914e7891154ca1344a03f8c5c4288
|
7
|
+
data.tar.gz: c22640b41f4d4d2d2cc01b7dd3568c76d6896f976d79f3d65c2ffb9dff975cb7ed6e0463b62b1f2991b6ec80494f96e263a3d330ee5661446dec7a075e063fc7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,396 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## v0.
|
3
|
+
## v0.13.0 (released at 3/3/2021)
|
4
4
|
|
5
|
-
*
|
5
|
+
* Support zeitwerk only and Rails 6+ only.
|
6
|
+
* Support Ruby 2.6+ only.
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
* Support Ruby 3.0.
|
10
|
-
* Qcloud_token support.
|
11
|
-
* CRUD of tencent cloud DB for miniapp
|
12
|
-
* TCB storage API support.
|
13
|
-
* Set default branch to *main*.
|
14
|
-
|
15
|
-
## v0.11.11 (released at 09/13/2020)
|
16
|
-
|
17
|
-
* FIX: fix_load_controller_wechat not support MP type, by @Msms-NJ #281
|
18
|
-
|
19
|
-
## v0.11.10 (released at 09/02/2020)
|
20
|
-
|
21
|
-
* ADD: Wechat::MpApi.wxa_msg_sec_check.
|
22
|
-
|
23
|
-
## v0.11.9 (released at 04/29/2020)
|
24
|
-
|
25
|
-
* CHG: upgrade ssl_version to 1.2 by @paicha #276
|
26
|
-
|
27
|
-
## v0.11.8 (released at 03/09/2020)
|
28
|
-
|
29
|
-
* ADD: Wechat::CorpApi.news_message_send
|
30
|
-
* FIX: Wechat API Change material/get_material. reported by @0000sir #275
|
31
|
-
|
32
|
-
## v0.11.7 (released at 11/15/2019)
|
33
|
-
|
34
|
-
* ADD: Wechat::MpApi.subscribe_message_send. by @paicha #271
|
35
|
-
* FIX: FrozenError: can't modify frozen String. by @paicha #272
|
36
|
-
* New translatecontent support.
|
37
|
-
|
38
|
-
## v0.11.6 (released at 09/02/2019)
|
39
|
-
|
40
|
-
* Fix private method `next_migration_number` introduced at #267, by @zpdsky #270
|
41
|
-
* Give more clear warning about missing Rails in console. by @emtfe #268
|
42
|
-
|
43
|
-
## v0.11.5 (released at 08/30/2019)
|
44
|
-
|
45
|
-
* Add rubocop check in CI by @hophacker #267
|
46
|
-
* Support Rails 6 and Windows at #266
|
47
|
-
|
48
|
-
## v0.11.4 (released at 08/15/2019)
|
49
|
-
|
50
|
-
* rails 6 redirect_to use allow_other_host: true by @Chen-George-Zhen #263
|
51
|
-
|
52
|
-
## v0.11.3 (released at 07/02/2019)
|
53
|
-
|
54
|
-
* New addvoicetorecofortext and queryrecoresultfortext support.
|
55
|
-
* improve existing class detect by @3014zhangshuo #261
|
56
|
-
* new wxa_get_wxacode_unlimit API for miniapp by @paicha #260
|
57
|
-
|
58
|
-
## v0.11.2 (released at 05/08/2019)
|
59
|
-
|
60
|
-
* bugfix short_url to shorturl in wechat console tool by @yuanxinyu #259
|
61
|
-
* allow a message to be sent to a party (department) by @hophacker #256
|
62
|
-
|
63
|
-
## v0.11.1 (released at 03/01/2019)
|
64
|
-
|
65
|
-
* Let Message support markdown, text included; allow textcard btntxt to be omitted by @hophacker #251
|
66
|
-
* Enterprise account add checkin api by @hophacker #254
|
67
|
-
* Suggest use secret to differentiate different acces_tokens and tickets in Enterprise account by @hophacker #255
|
68
|
-
|
69
|
-
|
70
|
-
## v0.11.0 (released at 01/22/2019)
|
71
|
-
|
72
|
-
* Support Ruby 2.6.0 official
|
73
|
-
* Bump http gem to 4.0
|
74
|
-
* New clear quota API by @3014zhangshuo #244
|
75
|
-
* Wechat::Message support textcard by @hophacker #249
|
76
|
-
* New getusersummary and getusercumulate API #247
|
77
|
-
|
78
|
-
## v0.10.3 (released at 10/07/2018)
|
79
|
-
|
80
|
-
* Fix new share problem in iOS by @killernova #242
|
81
|
-
|
82
|
-
## v0.10.2 (released at 8/27/2018)
|
83
|
-
|
84
|
-
* Fix incompatible with Rails 5.2.1 by @chloerei #239
|
85
|
-
|
86
|
-
## v0.10.1 (released at 7/1/2018)
|
87
|
-
|
88
|
-
* Allow custom_message_send using Hash as message, previous only allow Wechat::Message. by @zuoliang0 and @fogisland #234
|
89
|
-
|
90
|
-
## v0.10.0 (released at 5/31/2018)
|
91
|
-
|
92
|
-
* Support multi wechat account at wechat_responder. by @tuliren #223
|
93
|
-
* Support wechat mini program apis & signature check. by @oiahoon #225
|
94
|
-
* Support sent template message with miniprogram. by @falm #228
|
95
|
-
* Fix request_content could be nil. by @paicha #229
|
96
|
-
|
97
|
-
## v0.9.0 (released at 4/15/2018)
|
98
|
-
|
99
|
-
* Support multi wechat account dynamically loading from DB. by @tuliren #222
|
100
|
-
* user_create API for enterprise account. #206
|
101
|
-
* Will ignore template_message_send error 43004 by @insub #214
|
102
|
-
* using template with version if the migration version available by @killernova #220
|
103
|
-
* Remove Deprecation oauth2_url
|
104
|
-
* Remove Ruby 2.2 support, add Rails 5.2 and http v3 support
|
105
|
-
|
106
|
-
## v0.8.12 (released at 9/13/2017)
|
107
|
-
|
108
|
-
* Read oauth2_state from ticket store every time to avoid invalid oauth2_state by @xiewenwei #196
|
109
|
-
|
110
|
-
## v0.8.11 (released at 7/25/2017)
|
111
|
-
|
112
|
-
* oauth2 state code not refresh at the same time of jsapi tickets refresh bug, many thanks @xiewenwei #192
|
113
|
-
* Add string type scene support for qrcode_create_scene. by @libuchao #191
|
114
|
-
|
115
|
-
## v0.8.10 (released at 6/19/2017)
|
116
|
-
|
117
|
-
* fix material_delete correctly.
|
118
|
-
|
119
|
-
## v0.8.9 (released at 6/18/2017)
|
120
|
-
|
121
|
-
* wechat material_delete failed to work, thanks @Victorialice report #78
|
122
|
-
|
123
|
-
## v0.8.8 (released at 5/18/2017)
|
124
|
-
|
125
|
-
* Better support multiple account. by @xiewenwei #187
|
126
|
-
* Allow load figaro via RAILS_ENV. by @goofansu #186
|
127
|
-
|
128
|
-
## v0.8.7 (released at 4/23/2017)
|
129
|
-
|
130
|
-
* Support new wxa_get_wxacode API for miniapp.
|
131
|
-
* Add InvalidCredentialError, support audio/amr, voice/speex as file and text/plain as json. by @acenqiu #184
|
132
|
-
|
133
|
-
## v0.8.6 (released at 3/17/2017)
|
134
|
-
|
135
|
-
* Support Rails 5.1 officially.
|
136
|
-
* make sure the formfile can be created outside. by @mechiland #181
|
137
|
-
|
138
|
-
## v0.8.5 (released at 3/14/2017)
|
139
|
-
|
140
|
-
* Support mass send API #176
|
141
|
-
* Support new media_hq API
|
142
|
-
* Support new createwxaqrcode API for miniapp
|
143
|
-
* Fix wechat_responder not proper injected in rails 5 API #165
|
144
|
-
* parse response support XML return, by @zhangbin #167
|
145
|
-
* WeChat only allow 8 article per one news, by @kikyous #175
|
146
|
-
* Store token at cookies, by @jstdoit #174
|
147
|
-
|
148
|
-
## v0.8.4 (released at 1/12/2017)
|
149
|
-
|
150
|
-
* Support Ruby 2.4.0
|
151
|
-
* Add support of Enterprise RedPacket API, by @zhangbin #169
|
152
|
-
|
153
|
-
## v0.8.3 (released at 11/26/2016)
|
154
|
-
|
155
|
-
* Fix wechat template key has camelCase problem, by @RyanChenDji #159
|
156
|
-
* Fix long time of oauth2_state bug for wechat_oauth2 methods, by @IvanChou #162
|
157
|
-
|
158
|
-
## v0.8.2 (released at 11/2/2016)
|
159
|
-
|
160
|
-
* Bug which if not using multi-account but using web login.
|
161
|
-
|
162
|
-
## v0.8.1 (released at 11/2/2016)
|
163
|
-
|
164
|
-
* After allow sub controller using wechat_api, it's possible not initialise at first time. by @IvanChou #155
|
165
|
-
* Support web application login scope snsapi_login.
|
166
|
-
* Add unionid support for public account.
|
167
|
-
* Remove OpenId in Enterprise OAuth2 as it's not supported by Tecent.
|
168
|
-
|
169
|
-
## v0.8.0 (released at 10/24/2016)
|
170
|
-
|
171
|
-
* Complete support multi-wechat public account. by @xiewenwei #150
|
172
|
-
* Support loading configure value from Figaro if application.yml exist.
|
173
|
-
|
174
|
-
## v0.7.20 (released at 8/29/2016)
|
175
|
-
|
176
|
-
* Apply opt and config together when loading controller_wechat, to simplify wechat_responder params. by @bzhang443 #147
|
177
|
-
|
178
|
-
## v0.7.19 (released at 8/25/2016)
|
179
|
-
|
180
|
-
* Enterprise account now custom_image/voice/file works now. by @zymiboxpay #145
|
181
|
-
* Fix timeout setting no effective since introduct HTTP. found by @hsluo #74
|
182
|
-
|
183
|
-
## v0.7.18 (released at 8/21/2016)
|
184
|
-
|
185
|
-
* Support label_location message, similar to location event, but sent by user with Label. #144
|
186
|
-
* Add gem signature as additional security methods.
|
187
|
-
|
188
|
-
## v0.7.17 (released at 8/18/2016)
|
189
|
-
|
190
|
-
* Allow declare wechat_api at ApplicationController, but using wechat at sub controller. #104
|
191
|
-
|
192
|
-
## v0.7.16 (released at 7/27/2016)
|
193
|
-
|
194
|
-
* FIX: consider '' in params as equal with nil, in ControllerApi#wechat_public_oauth2, by @snow #135
|
195
|
-
* New tag API for public account, by @pynixwang #127
|
196
|
-
* fix SSLv3 error by use TLSv1_client, by @IvanChou #133
|
197
|
-
|
198
|
-
## v0.7.15 (released at 7/03/2016)
|
199
|
-
|
200
|
-
* RSpec testing case on Rails 5 now.
|
201
|
-
* Resolve Rails 5 ActionController::Parameters issue.
|
202
|
-
|
203
|
-
## v0.7.14 (released at 5/29/2016)
|
204
|
-
|
205
|
-
* Fix when access_token failed lead ticket can not refresh problem.
|
206
|
-
* Default duration should be 1 hours instead of 0 seconds for wechat_oauth2.
|
207
|
-
* New shorturl allowing convert from long URL to short.
|
208
|
-
|
209
|
-
## v0.7.13 (released at 5/14/2016)
|
210
|
-
|
211
|
-
* Wechat.config.oauth2_cookie_duration need convert to secondes, found by @gabrieltong #111
|
212
|
-
|
213
|
-
## v0.7.12 (released at 5/12/2016)
|
214
|
-
|
215
|
-
* Fix web_userinfo wrong URL, found by @gabrieltong #110
|
216
|
-
|
217
|
-
## v0.7.11 (released at 4/18/2016)
|
218
|
-
|
219
|
-
* To cover wrong release 0.7.10, nothing change
|
220
|
-
|
221
|
-
## v0.7.10 (released at 4/18/2016) (yanked)
|
222
|
-
|
223
|
-
## v0.7.9 (released at 4/12/2016)
|
224
|
-
|
225
|
-
* wechat_oauth2 support public account now.
|
226
|
-
* Refresh and store state on jsapi ticket, using it on oauth2_url to more secure.
|
227
|
-
* Remove extra sending payload in message template send json
|
228
|
-
* Allow setting oauth2_cookie_duration in config
|
229
|
-
|
230
|
-
## v0.7.8 (released at 3/31/2016)
|
231
|
-
|
232
|
-
* New wechat_api, similar to wechat_responder, but without messange handle DSL, support web page only wechat application
|
233
|
-
* New media_uploadimg API.
|
234
|
-
* New file type of Message.
|
235
|
-
* Improved multi account support per different controller.
|
236
|
-
|
237
|
-
## v0.7.7 (released at 3/18/2016)
|
238
|
-
|
239
|
-
* New wechat_oauth2, only support enterprise account still.
|
240
|
-
* fix 'skip_before_action :verify_authenticity_token' bug for v5.0.0.beta3 by @vkill #97
|
241
|
-
* Support Rails 3.2 again after support Rails 5.0, by @guange2015 #96
|
242
|
-
|
243
|
-
## v0.7.6 (released at 3/05/2016)
|
244
|
-
|
245
|
-
* Support wechat public account conditional menu. #95
|
246
|
-
|
247
|
-
## v0.7.5 (released at 2/21/2016)
|
248
|
-
|
249
|
-
* New wechat_config_js to simplify the Wechat jsapi config.
|
250
|
-
* Support sent shortvideo.
|
251
|
-
|
252
|
-
## v0.7.4 (released at 1/23/2016)
|
253
|
-
|
254
|
-
* Add Redis store token/ticket support, close #76, #60
|
255
|
-
* Rails 5 support without deprecate warning or other not necessory call. #82
|
256
|
-
|
257
|
-
## v0.7.3 (released at 1/19/2016)
|
258
|
-
|
259
|
-
* Allow transfer_customer_service to specific account.
|
260
|
-
* New customservice_getonlinekflist API.
|
261
|
-
* session support class WechatSession no need table_exists? methods exist.
|
262
|
-
|
263
|
-
## v0.7.2 (released at 1/18/2016)
|
264
|
-
|
265
|
-
* Optional session support by @zfben #81, #88, #91
|
266
|
-
* Replace after_wechat_response with Rails Nofications facility, by @zfben, original issue is #79
|
267
|
-
* New user_batchget API. #89
|
268
|
-
* Support Rails 3.2 again after support Rails 5.0. by @guange2015 #87
|
269
|
-
* Fetch setting from RAILS_ENV first, then fetch default. by @kikyous #85
|
270
|
-
* Warning not support on :scan with regular expression, reason see #84
|
271
|
-
|
272
|
-
## v0.7.1 (released at 1/11/2016)
|
273
|
-
|
274
|
-
* Fix after using http, upload file function break. #78
|
275
|
-
* Add callback function after_wechat_response support. by @zfben #79
|
276
|
-
* Should using department_id instead of departmentid at enterprise api: user_simplelist/user_list.
|
277
|
-
|
278
|
-
## v0.7.0 (released at 1/1/2016)
|
279
|
-
|
280
|
-
* Using [http](https://github.com/httprb/http) instead of rest-client for performance reason. (not support upload file yet)
|
281
|
-
|
282
|
-
## v0.6.10 (released at 1/17/2016)
|
283
|
-
|
284
|
-
* Support Rails 3.2 again after support Rails 5.0. by @guange2015 #87
|
285
|
-
* Fetch setting from RAILS_ENV first, then fetch default. by @kikyous #85
|
286
|
-
* Warning not support on :scan with regular expression. by @kikyous #84
|
287
|
-
|
288
|
-
## v0.6.9 (released at 1/6/2016)
|
289
|
-
|
290
|
-
* Fix token refresh bug on multi worker. #76
|
291
|
-
* Rewrite the token relative code to add more storage support in future.
|
292
|
-
|
293
|
-
## v0.6.8 (released at 12/25/2015)
|
294
|
-
|
295
|
-
* Support Rails 5.0.0.beta1.
|
296
|
-
* English README available
|
297
|
-
* Fix oauth2_url calling error, fix #75
|
298
|
-
|
299
|
-
## v0.6.7 (released at 12/18/2015)
|
300
|
-
|
301
|
-
* Add timeout configuration option, close #74
|
302
|
-
* New getuserinfo and oauth2_url to support getting FromUserName from web page.
|
303
|
-
|
304
|
-
## v0.6.6 (released at 12/15/2015)
|
305
|
-
|
306
|
-
* Add jsapi_ticket support for Enterprise Account
|
307
|
-
* 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.
|
308
|
-
* New syntax `on :view, with: 'VIEW_URL'` support.
|
309
|
-
* New command `upload_replaceparty` which combine three sub command to make uploading department easier.
|
310
|
-
* New command `upload_replaceuser` which combine three sub command to make uploading user easier.
|
311
|
-
|
312
|
-
## v0.6.5 (released at 11/24/2015)
|
313
|
-
|
314
|
-
* Handle 48001 error if token is expire/not valid, close #71
|
315
|
-
* ApiLoader will do config reading and initialize the api instead of spreading the logic.
|
316
|
-
|
317
|
-
## v0.6.4 (released at 11/16/2015)
|
318
|
-
|
319
|
-
* Command mode now display different command set based on enterprise/public account setting
|
320
|
-
* Move config logic in command/wechat to ApiLoader class
|
321
|
-
* Unsubscribe can only reply plain text 'success' #68
|
322
|
-
* Fix 404 qrcode download problem, by @huangxiangdan #69
|
323
|
-
|
324
|
-
## v0.6.3 (released at 11/14/2015)
|
325
|
-
|
326
|
-
* Official testing and support public encrypt mode, also fix one cipher bug, many thanks to @hlltc #67
|
327
|
-
* hlltc report public account FILE_BASE no longer needs, clean code #67
|
328
|
-
* Media command line reflect recent Tecent json schema change. #67
|
329
|
-
|
330
|
-
## v0.6.2 (released at 11/05/2015)
|
331
|
-
|
332
|
-
* Tecent report location API changed, so change wechat gems also. #64
|
333
|
-
|
334
|
-
## v0.6.1 (released at 10/20/2015)
|
335
|
-
|
336
|
-
* Handle 40001, invalid credential, access_token is invalid or not latest hint # 57
|
337
|
-
* Support at Rails 4.2.1 wechat can not run #58
|
338
|
-
|
339
|
-
## v0.6.0 (released at 10/08/2015)
|
340
|
-
|
341
|
-
### Scan and Batch job are BREAK CHANGE!
|
342
|
-
|
343
|
-
* Scan 2D barcode using new syntax `on :scan, with: 'BINDING_QR_CODE' ` instead of `on :event, with: 'BINDING_QR_CODE' ` in previous version #55
|
344
|
-
Which will fix can not using `on :event, with: "scan" ` problem
|
345
|
-
* Batch job using new syntax `on :batch_job, with: 'replace_user' `
|
346
|
-
instead of previous `on :event, with: 'replace_user' `.
|
347
|
-
* 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.
|
348
|
-
* Wechat::Responder using Hash for new :client and :batch_job event, avoid time consuming Array match responder
|
349
|
-
* Fix refresh token not working problem under ruby 2.0.0 #54
|
350
|
-
* New department_update, user_batchdelete, convert_to_openid API
|
351
|
-
|
352
|
-
## v0.5.0 (released at 9/25/2015)
|
353
|
-
|
354
|
-
* Only relay on activesupport on run time, so will greatly improve wechat cli startup time
|
355
|
-
* Add rails generator support `rails g wechat:install`
|
356
|
-
* Add batch job support for enterprise account like batch create user/department, both API, callback responder and CLI
|
357
|
-
* Add material management API and CLI
|
358
|
-
* Add tag API and CLI for enterprise account
|
359
|
-
* Add QR code scene function for public account
|
360
|
-
|
361
|
-
## v0.4.2 (released at 9/7/2015)
|
362
|
-
|
363
|
-
* Fix wrong number of arguments at Wechat::Responder.on by using arity #47
|
364
|
-
* Fix can not access wechat method after using instance level context.
|
365
|
-
* Fix skip_verify_ssl parameter error.
|
366
|
-
|
367
|
-
## v0.4.1 (released at 9/6/2015)
|
368
|
-
|
369
|
-
* Limit news articles collection to 10, close #5
|
370
|
-
* Resolve the conflict with gem "responders" by @seamon #45
|
371
|
-
|
372
|
-
## v0.4.0 (released at 9/5/2015)
|
373
|
-
|
374
|
-
* Enable the verify SSL for enterprise mode by default, as security is more importent than speed, but still can switch off by configure
|
375
|
-
* Support scancode_push/scancode_waitmsg event.
|
376
|
-
* New API method can get wechat server IP list
|
377
|
-
* New API to query/create department/media/material
|
378
|
-
* Fix can not read token_file in mingw bug, which introduce at #43
|
379
|
-
|
380
|
-
## v0.3.0 (released at 8/30/2015)
|
381
|
-
|
382
|
-
* New user group management API
|
383
|
-
* Allow transfer to customer service on fallback. #42
|
384
|
-
* Read and write access_token properly using file locking, #43
|
385
|
-
|
386
|
-
## v0.2.0 (released at 8/27/2015)
|
387
|
-
|
388
|
-
* Add wechat enterprise account support
|
389
|
-
* Make responder execute in action context, by @lazing #15
|
390
|
-
* jsapi_ticket support, by @feitian124 #27
|
391
|
-
* Rename gems to wechat and ambitious to being #1 gems about development wechat. thanks Xiaoning transfer this gem name.
|
392
|
-
* Original gem `wechat-rails` author skinnyworm trasfer to Eric-Guo as maintainer
|
393
|
-
|
394
|
-
## v0.1.1
|
395
|
-
|
396
|
-
* Initial release from [wechat-rails](https://github.com/skinnyworm/wechat-rails).
|
8
|
+
Previous changelog see https://github.com/Eric-Guo/wechat/blob/master/CHANGELOG_OLD.md
|
data/README-CN.md
CHANGED
@@ -27,12 +27,16 @@ WeChat gem帮助开发者方便地在Rails环境中集成[微信公众平台](ht
|
|
27
27
|
|
28
28
|
```
|
29
29
|
gem install "wechat"
|
30
|
+
# 如果使用 Ruby 版本小于 2.6
|
31
|
+
# gem install wechat -v 0.12.2
|
30
32
|
```
|
31
33
|
|
32
34
|
或者添加下面这行到 `Gemfile`:
|
33
35
|
|
34
36
|
```
|
35
37
|
gem 'wechat'
|
38
|
+
# 如果使用 Rails 版本小于 6
|
39
|
+
# gem 'wechat', '~> 0.12.2'
|
36
40
|
```
|
37
41
|
|
38
42
|
运行下面这行代码来安装:
|
data/README.md
CHANGED
@@ -34,12 +34,16 @@ Use `gem install`
|
|
34
34
|
|
35
35
|
```
|
36
36
|
gem install "wechat"
|
37
|
+
# If your ruby version < 2.6
|
38
|
+
# gem install wechat -v 0.12.2
|
37
39
|
```
|
38
40
|
|
39
41
|
Or add it to your app's `Gemfile`:
|
40
42
|
|
41
43
|
```
|
42
44
|
gem 'wechat'
|
45
|
+
# If your rails version < 6.0
|
46
|
+
# gem 'wechat', '~> 0.12.2'
|
43
47
|
```
|
44
48
|
|
45
49
|
Run the following command to install it:
|
data/bin/wechat
CHANGED
@@ -6,13 +6,10 @@ $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
|
10
|
-
require 'active_support/dependencies/autoload'
|
11
9
|
require 'active_support/core_ext'
|
12
10
|
require 'active_support/json'
|
13
11
|
require 'fileutils'
|
14
12
|
require 'yaml'
|
15
|
-
require 'wechat/api_loader'
|
16
13
|
require 'cgi'
|
17
14
|
|
18
15
|
class App < Thor
|
data/lib/wechat.rb
CHANGED
@@ -1,20 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'zeitwerk'
|
4
|
+
loader = Zeitwerk::Loader.for_gem
|
5
|
+
loader.ignore("#{__dir__}/generators/**/*.rb")
|
6
|
+
loader.setup
|
7
|
+
|
3
8
|
require 'base64'
|
4
9
|
require 'openssl/cipher'
|
5
|
-
require 'wechat/api_loader'
|
6
|
-
require 'wechat/api'
|
7
|
-
require 'wechat/mp_api'
|
8
|
-
require 'wechat/corp_api'
|
9
|
-
require 'wechat/helpers'
|
10
|
-
require 'action_controller/wechat_responder'
|
11
10
|
|
12
11
|
module Wechat
|
13
|
-
autoload :Message, 'wechat/message'
|
14
|
-
autoload :Responder, 'wechat/responder'
|
15
|
-
autoload :Cipher, 'wechat/cipher'
|
16
|
-
autoload :ControllerApi, 'wechat/controller_api'
|
17
|
-
|
18
12
|
class AccessTokenExpiredError < StandardError; end
|
19
13
|
|
20
14
|
class InvalidCredentialError < StandardError; end
|
@@ -55,3 +49,21 @@ module Wechat
|
|
55
49
|
end
|
56
50
|
|
57
51
|
ActionView::Base.include Wechat::Helpers if defined? ActionView::Base
|
52
|
+
require 'action_controller/wechat_responder' # To make wechat_api and wechat_responder available
|
53
|
+
|
54
|
+
module ActionController
|
55
|
+
if defined? Base
|
56
|
+
ActiveSupport.on_load(:action_controller_base) do
|
57
|
+
class << Base
|
58
|
+
include WechatResponder
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
if defined? API
|
63
|
+
ActiveSupport.on_load(:action_controller_api) do
|
64
|
+
class << API
|
65
|
+
include WechatResponder
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/lib/wechat/api.rb
CHANGED
@@ -1,11 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'wechat/api_base'
|
4
|
-
require 'wechat/http_client'
|
5
|
-
require 'wechat/token/public_access_token'
|
6
|
-
require 'wechat/ticket/public_jsapi_ticket'
|
7
|
-
require 'wechat/concern/common'
|
8
|
-
|
9
3
|
module Wechat
|
10
4
|
class Api < ApiBase
|
11
5
|
def initialize(appid, secret, token_file, timeout, skip_verify_ssl, jsapi_ticket_file)
|
data/lib/wechat/cipher.rb
CHANGED
@@ -58,7 +58,7 @@ module Wechat
|
|
58
58
|
cookies.signed_or_encrypted[:we_access_token] = { value: access_info['access_token'], expires: self.class.oauth2_cookie_duration.from_now }
|
59
59
|
yield access_info['openid'], access_info
|
60
60
|
else
|
61
|
-
|
61
|
+
redirect_to generate_oauth2_url(oauth2_params), allow_other_host: true
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -73,7 +73,7 @@ module Wechat
|
|
73
73
|
cookies.signed_or_encrypted[:we_deviceid] = { value: userinfo['DeviceId'], expires: self.class.oauth2_cookie_duration.from_now }
|
74
74
|
yield userinfo['UserId'], userinfo
|
75
75
|
else
|
76
|
-
|
76
|
+
redirect_to generate_oauth2_url(oauth2_params), allow_other_host: true
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
data/lib/wechat/corp_api.rb
CHANGED
data/lib/wechat/mp_api.rb
CHANGED
@@ -1,13 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'wechat/api_base'
|
4
|
-
require 'wechat/http_client'
|
5
|
-
require 'wechat/token/public_access_token'
|
6
|
-
require 'wechat/ticket/public_jsapi_ticket'
|
7
|
-
require 'wechat/qcloud/token'
|
8
|
-
require 'wechat/concern/common'
|
9
|
-
require 'wechat/concern/qcloud'
|
10
|
-
|
11
3
|
module Wechat
|
12
4
|
class MpApi < ApiBase
|
13
5
|
def initialize(appid, secret, token_file, timeout, skip_verify_ssl, jsapi_ticket_file, qcloud_env, qcloud_token_file, qcloud_token_lifespan)
|
data/lib/wechat/responder.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'English'
|
4
4
|
require 'rexml/document'
|
5
|
-
require 'wechat/signature'
|
6
5
|
|
7
6
|
module Wechat
|
8
7
|
module Responder
|
@@ -11,24 +10,9 @@ module Wechat
|
|
11
10
|
include Cipher
|
12
11
|
|
13
12
|
included do
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
skip_before_action :verify_authenticity_token
|
18
|
-
else
|
19
|
-
# Rails 5 API mode won't define verify_authenticity_token
|
20
|
-
# https://github.com/rails/rails/blob/v5.0.0.beta3/actionpack/lib/abstract_controller/callbacks.rb#L66
|
21
|
-
# https://github.com/rails/rails/blob/v5.0.0.beta3/activesupport/lib/active_support/callbacks.rb#L640
|
22
|
-
skip_before_action :verify_authenticity_token, raise: false
|
23
|
-
end
|
24
|
-
|
25
|
-
before_action :config_account, only: %i[show create]
|
26
|
-
before_action :verify_signature, only: %i[show create]
|
27
|
-
else
|
28
|
-
skip_before_filter :verify_authenticity_token
|
29
|
-
before_filter :config_account, only: %i[show create]
|
30
|
-
before_filter :verify_signature, only: %i[show create]
|
31
|
-
end
|
13
|
+
skip_before_action :verify_authenticity_token, raise: false
|
14
|
+
before_action :config_account, only: %i[show create]
|
15
|
+
before_action :verify_signature, only: %i[show create]
|
32
16
|
end
|
33
17
|
|
34
18
|
module ClassMethods
|
@@ -180,15 +164,9 @@ module Wechat
|
|
180
164
|
def show
|
181
165
|
if @we_corpid.present?
|
182
166
|
echostr, _corp_id = unpack(decrypt(Base64.decode64(params[:echostr]), @we_encoding_aes_key))
|
183
|
-
|
184
|
-
render plain: echostr
|
185
|
-
else
|
186
|
-
render text: echostr
|
187
|
-
end
|
188
|
-
elsif Rails::VERSION::MAJOR >= 4
|
189
|
-
render plain: params[:echostr]
|
167
|
+
render plain: echostr
|
190
168
|
else
|
191
|
-
render
|
169
|
+
render plain: params[:echostr]
|
192
170
|
end
|
193
171
|
end
|
194
172
|
|
@@ -197,11 +175,7 @@ module Wechat
|
|
197
175
|
response_msg = run_responder(request_msg)
|
198
176
|
|
199
177
|
if response_msg.respond_to? :to_xml
|
200
|
-
|
201
|
-
render plain: process_response(response_msg)
|
202
|
-
else
|
203
|
-
render text: process_response(response_msg)
|
204
|
-
end
|
178
|
+
render plain: process_response(response_msg)
|
205
179
|
else
|
206
180
|
head :ok, content_type: 'text/html'
|
207
181
|
end
|
@@ -248,15 +222,9 @@ module Wechat
|
|
248
222
|
end
|
249
223
|
|
250
224
|
data_hash = data.fetch('xml', {})
|
251
|
-
if
|
252
|
-
|
253
|
-
|
254
|
-
msg[:Event]&.downcase!
|
255
|
-
end
|
256
|
-
else
|
257
|
-
HashWithIndifferentAccess.new_from_hash_copying_default(data_hash).tap do |msg|
|
258
|
-
msg[:Event]&.downcase!
|
259
|
-
end
|
225
|
+
data_hash = data_hash.to_unsafe_hash if data_hash.instance_of?(ActionController::Parameters)
|
226
|
+
HashWithIndifferentAccess.new(data_hash).tap do |msg|
|
227
|
+
msg[:Event]&.downcase!
|
260
228
|
end
|
261
229
|
end
|
262
230
|
|
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.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Skinnyworm
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '6.0'
|
47
47
|
- - "<"
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '7'
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
requirements:
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '
|
56
|
+
version: '6.0'
|
57
57
|
- - "<"
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '7'
|
@@ -119,34 +119,48 @@ dependencies:
|
|
119
119
|
- - ">="
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
|
+
- !ruby/object:Gem::Dependency
|
123
|
+
name: zeitwerk
|
124
|
+
requirement: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - "~>"
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '2.4'
|
129
|
+
type: :runtime
|
130
|
+
prerelease: false
|
131
|
+
version_requirements: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - "~>"
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '2.4'
|
122
136
|
- !ruby/object:Gem::Dependency
|
123
137
|
name: rubocop
|
124
138
|
requirement: !ruby/object:Gem::Requirement
|
125
139
|
requirements:
|
126
140
|
- - "~>"
|
127
141
|
- !ruby/object:Gem::Version
|
128
|
-
version: '1.
|
142
|
+
version: '1.9'
|
129
143
|
type: :development
|
130
144
|
prerelease: false
|
131
145
|
version_requirements: !ruby/object:Gem::Requirement
|
132
146
|
requirements:
|
133
147
|
- - "~>"
|
134
148
|
- !ruby/object:Gem::Version
|
135
|
-
version: '1.
|
149
|
+
version: '1.9'
|
136
150
|
- !ruby/object:Gem::Dependency
|
137
151
|
name: rails
|
138
152
|
requirement: !ruby/object:Gem::Requirement
|
139
153
|
requirements:
|
140
154
|
- - ">="
|
141
155
|
- !ruby/object:Gem::Version
|
142
|
-
version: '
|
156
|
+
version: '6.0'
|
143
157
|
type: :development
|
144
158
|
prerelease: false
|
145
159
|
version_requirements: !ruby/object:Gem::Requirement
|
146
160
|
requirements:
|
147
161
|
- - ">="
|
148
162
|
- !ruby/object:Gem::Version
|
149
|
-
version: '
|
163
|
+
version: '6.0'
|
150
164
|
- !ruby/object:Gem::Dependency
|
151
165
|
name: rspec-rails
|
152
166
|
requirement: !ruby/object:Gem::Requirement
|
@@ -237,7 +251,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
237
251
|
requirements:
|
238
252
|
- - ">="
|
239
253
|
- !ruby/object:Gem::Version
|
240
|
-
version: '2.
|
254
|
+
version: '2.6'
|
241
255
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
256
|
requirements:
|
243
257
|
- - ">="
|
metadata.gz.sig
CHANGED
Binary file
|