wechat 0.10.3 → 0.11.0
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 +8 -0
- data/README-CN.md +2 -0
- data/README.md +4 -1
- data/bin/wechat +15 -0
- data/lib/wechat/api_base.rb +4 -0
- data/lib/wechat/concern/common.rb +9 -0
- data/lib/wechat/http_client.rb +5 -1
- data/lib/wechat/message.rb +11 -1
- metadata +5 -6
- 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: 7b383f8c031c63e1314dc28869389f1f69e0bad4f1dd7821bc1a0169fdf28905
|
4
|
+
data.tar.gz: 9f62ed282adbd93ab022974ac5650e70349768480613ba429c7f528d6805a7ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55258c585033c225b36962c9520642ca72c5e84ef75be0b14d0243f0f4dfa973b97760dcc3ef8a1c69ac1c3dd2074b46ffe90b393c016ca26757369f463897b5
|
7
|
+
data.tar.gz: bcfc4f5ae3f3e135f7254705b9deb28ac7fada1401b77301a1a37beba2e0bd32d3fa7d8ea09c73399715d7b90d259ce81ef547d587b624ae4ad55d9c3ab9f64c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.11.0 (released at 01/22/2019)
|
4
|
+
|
5
|
+
* Support Ruby 2.6.0 official
|
6
|
+
* Bump http gem to 4.0
|
7
|
+
* New clear quota API by @3014zhangshuo #244
|
8
|
+
* Wechat::Message support textcard by @hophacker #249
|
9
|
+
* New getusersummary and getusercumulate API #247
|
10
|
+
|
3
11
|
## v0.10.3 (released at 10/07/2018)
|
4
12
|
|
5
13
|
* Fix new share problem in iOS by @killernova #242
|
data/README-CN.md
CHANGED
@@ -407,6 +407,8 @@ Wechat Enterprise Account commands:
|
|
407
407
|
wechat department_create [NAME, PARENT_ID] # 创建部门
|
408
408
|
wechat department_delete [DEPARTMENT_ID] # 删除部门
|
409
409
|
wechat department_update [DEPARTMENT_ID, NAME] # 更新部门
|
410
|
+
wechat getusercumulate [BEGIN_DATE, END_DATE] # 获取累计用户数据
|
411
|
+
wechat getusersummary [BEGIN_DATE, END_DATE] # 获取用户增减数据
|
410
412
|
wechat invite_user [USER_ID] # 邀请成员关注
|
411
413
|
wechat material [MEDIA_ID, PATH] # 永久媒体下载
|
412
414
|
wechat material_add [MEDIA_TYPE, PATH] # 永久媒体上传
|
data/README.md
CHANGED
@@ -217,7 +217,7 @@ For wechat mini program, can specified by the item `type`:
|
|
217
217
|
appid: "my_appid"
|
218
218
|
secret: "my_secret"
|
219
219
|
# `mp` is short for **mini program**
|
220
|
-
type: 'mp'
|
220
|
+
type: 'mp'
|
221
221
|
```
|
222
222
|
|
223
223
|
#### Database wechat account configuration
|
@@ -412,6 +412,7 @@ Wechat Public Account commands:
|
|
412
412
|
wechat user_update_remark [OPEN_ID, REMARK] # 设置备注名
|
413
413
|
wechat users # 关注者列表
|
414
414
|
wechat wxacode_download [WXA_CODE_PIC_PATH, PATH, WIDTH] # 下载小程序码
|
415
|
+
wechat clear_quota # 接口调用次数清零
|
415
416
|
```
|
416
417
|
|
417
418
|
#### Enterprise account command line
|
@@ -436,6 +437,8 @@ Wechat Enterprise Account commands:
|
|
436
437
|
wechat department_create [NAME, PARENT_ID] # 创建部门
|
437
438
|
wechat department_delete [DEPARTMENT_ID] # 删除部门
|
438
439
|
wechat department_update [DEPARTMENT_ID, NAME] # 更新部门
|
440
|
+
wechat getusercumulate [BEGIN_DATE, END_DATE] # 获取累计用户数据
|
441
|
+
wechat getusersummary [BEGIN_DATE, END_DATE] # 获取用户增减数据
|
439
442
|
wechat invite_user [USER_ID] # 邀请成员关注
|
440
443
|
wechat material [MEDIA_ID, PATH] # 永久媒体下载
|
441
444
|
wechat material_add [MEDIA_TYPE, PATH] # 永久媒体上传
|
data/bin/wechat
CHANGED
@@ -515,6 +515,21 @@ class App < Thor
|
|
515
515
|
def tag(tagid)
|
516
516
|
puts wechat_api.tag tagid
|
517
517
|
end
|
518
|
+
|
519
|
+
desc 'getusersummary [BEGIN_DATE, END_DATE]', '获取用户增减数据'
|
520
|
+
def getusersummary(begin_date, end_date)
|
521
|
+
puts wechat_api.getusersummary(begin_date, end_date)
|
522
|
+
end
|
523
|
+
|
524
|
+
desc 'getusercumulate [BEGIN_DATE, END_DATE]', '获取累计用户数据'
|
525
|
+
def getusercumulate(begin_date, end_date)
|
526
|
+
puts wechat_api.getusercumulate(begin_date, end_date)
|
527
|
+
end
|
528
|
+
|
529
|
+
desc 'clear_quota', '接口调用次数清零'
|
530
|
+
def clear_quota
|
531
|
+
puts wechat_api.clear_quota
|
532
|
+
end
|
518
533
|
end
|
519
534
|
|
520
535
|
App.start
|
data/lib/wechat/api_base.rb
CHANGED
@@ -4,6 +4,7 @@ module Wechat
|
|
4
4
|
WXA_BASE = 'https://api.weixin.qq.com/wxa/'.freeze
|
5
5
|
API_BASE = 'https://api.weixin.qq.com/cgi-bin/'.freeze
|
6
6
|
OAUTH2_BASE = 'https://api.weixin.qq.com/sns/'.freeze
|
7
|
+
DATACUBE_BASE = 'https://api.weixin.qq.com/datacube/'.freeze
|
7
8
|
|
8
9
|
def initialize(appid, secret, token_file, timeout, skip_verify_ssl, jsapi_ticket_file)
|
9
10
|
@client = HttpClient.new(API_BASE, timeout, skip_verify_ssl)
|
@@ -186,6 +187,14 @@ module Wechat
|
|
186
187
|
post 'user/tag/get', JSON.generate(tagid: tagid, next_openid: next_openid)
|
187
188
|
end
|
188
189
|
|
190
|
+
def getusersummary(begin_date, end_date)
|
191
|
+
post 'getusersummary', JSON.generate(begin_date: begin_date, end_date: end_date), base: DATACUBE_BASE
|
192
|
+
end
|
193
|
+
|
194
|
+
def getusercumulate(begin_date, end_date)
|
195
|
+
post 'getusercumulate', JSON.generate(begin_date: begin_date, end_date: end_date), base: DATACUBE_BASE
|
196
|
+
end
|
197
|
+
|
189
198
|
def web_access_token(code)
|
190
199
|
params = {
|
191
200
|
appid: access_token.appid,
|
data/lib/wechat/http_client.rb
CHANGED
@@ -6,7 +6,11 @@ module Wechat
|
|
6
6
|
|
7
7
|
def initialize(base, timeout, skip_verify_ssl)
|
8
8
|
@base = base
|
9
|
-
@httprb = HTTP.
|
9
|
+
@httprb = if HTTP::VERSION.to_i >= 4
|
10
|
+
HTTP.timeout(write: timeout, connect: timeout, read: timeout)
|
11
|
+
else
|
12
|
+
HTTP.timeout(:global, write: timeout, connect: timeout, read: timeout)
|
13
|
+
end
|
10
14
|
@ssl_context = OpenSSL::SSL::SSLContext.new
|
11
15
|
@ssl_context.ssl_version = :TLSv1
|
12
16
|
@ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE if skip_verify_ssl
|
data/lib/wechat/message.rb
CHANGED
@@ -104,6 +104,15 @@ module Wechat
|
|
104
104
|
update(MsgType: 'text', Content: content)
|
105
105
|
end
|
106
106
|
|
107
|
+
def textcard(title, description, url, btntxt)
|
108
|
+
update(MsgType: 'textcard', TextCard: {
|
109
|
+
title: title,
|
110
|
+
description: description,
|
111
|
+
url: url,
|
112
|
+
btntxt: btntxt
|
113
|
+
})
|
114
|
+
end
|
115
|
+
|
107
116
|
def transfer_customer_service(kf_account = nil)
|
108
117
|
if kf_account
|
109
118
|
update(MsgType: 'transfer_customer_service', TransInfo: { KfAccount: kf_account })
|
@@ -187,6 +196,7 @@ module Wechat
|
|
187
196
|
end
|
188
197
|
|
189
198
|
TO_JSON_KEY_MAP = {
|
199
|
+
'TextCard' => 'textcard',
|
190
200
|
'ToUserName' => 'touser',
|
191
201
|
'ToWxName' => 'towxname',
|
192
202
|
'MediaId' => 'media_id',
|
@@ -198,7 +208,7 @@ module Wechat
|
|
198
208
|
'ShowCoverPic' => 'show_cover_pic'
|
199
209
|
}.freeze
|
200
210
|
|
201
|
-
TO_JSON_ALLOWED = %w[touser msgtype content image voice video file
|
211
|
+
TO_JSON_ALLOWED = %w[touser msgtype content image voice video file textcard
|
202
212
|
music news articles template agentid filter
|
203
213
|
send_ignore_reprint mpnews towxname].freeze
|
204
214
|
|
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.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Skinnyworm
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
ivoox98/nhOs6bHcSFPsxXdxUihcCfCzj+zcaHNEqpvTI/36Bnl2XW6dUJNaFQDc
|
36
36
|
oWOyq5ZkxqnYrYXactjW0+vcPv6WHoHXmjv4dF7iFp8r0mvK
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2019-01-22 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: activesupport
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
version: 1.0.4
|
67
67
|
- - "<"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '5'
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: 1.0.4
|
77
77
|
- - "<"
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: '
|
79
|
+
version: '5'
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: nokogiri
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
@@ -214,8 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
|
-
|
218
|
-
rubygems_version: 2.7.7
|
217
|
+
rubygems_version: 3.0.2
|
219
218
|
signing_key:
|
220
219
|
specification_version: 4
|
221
220
|
summary: DSL for wechat message handling and API
|
metadata.gz.sig
CHANGED
Binary file
|