wechat 0.12.1 → 0.12.2

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
  SHA256:
3
- metadata.gz: f7dfe45f7c68aafa5b96a2a3178ae2108f9989bb5594b6ae35d1e7dcc358219a
4
- data.tar.gz: 25a51c65de855682ec12ee332241d9acd47c8cc8c2376995c8d8f0512825e899
3
+ metadata.gz: f9e5954c81e1297f27d583c6e0df58714d5ab47489bef715ddacc4fb8dd23839
4
+ data.tar.gz: 1753d132e3207da06427214efa61b498ba06ea5ca23b7b6f5a6f74a0fb235932
5
5
  SHA512:
6
- metadata.gz: '080ada4dbb3191ed4d10d51d4cef85de0cfc469af61f636ee99b03be92e487060fa454a37ef54a8386d77d1ebede360d2819c64d59f0d1ca2a202ba199e1a31e'
7
- data.tar.gz: f3482024b4e35f91924c384ca27819748341444047c135362552b460ccf15243fcd5fd1c896e0c15eb00e392aa73ce1c750854b78e6e0c52af0176482e4939cb
6
+ metadata.gz: 945c4b637ba60360c1447765a0e6e4b87f121d0a5dac1aecfc0a74c8fd92f365d273a7ea56ab30ebe67ad07d1791dfa2444685f81b8d7957d0046e14a4f0dd36
7
+ data.tar.gz: dc760927b6a6f5836af1ff3e2e9f1b722c87db80994b8c8b0f0ed83cc154ebdb4395670cb4108ef71ff865f3df784f1fe3ca622d14f6484b47cb23321a9cb2cb
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.12.2 (released at 3/3/2021)
4
+
5
+ * New convert_to_userid API
6
+
3
7
  ## v0.12.1 (released at 28/12/2020)
4
8
 
5
9
  * Support Ruby 3.0.
data/README-CN.md CHANGED
@@ -1,4 +1,4 @@
1
- WeChat [![Gem Version](https://badge.fury.io/rb/wechat.svg)](https://rubygems.org/gems/wechat) [![Build Status](https://travis-ci.org/Eric-Guo/wechat.svg)](https://travis-ci.org/Eric-Guo/wechat) [![Maintainability](https://api.codeclimate.com/v1/badges/12885358487c13e91e00/maintainability)](https://codeclimate.com/github/Eric-Guo/wechat/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/12885358487c13e91e00/test_coverage)](https://codeclimate.com/github/Eric-Guo/wechat/test_coverage)
1
+ WeChat [![Gem Version](https://badge.fury.io/rb/wechat.svg)](https://rubygems.org/gems/wechat) [![Build Status](https://travis-ci.com/Eric-Guo/wechat.svg)](https://travis-ci.com/github/Eric-Guo/wechat) [![Maintainability](https://api.codeclimate.com/v1/badges/12885358487c13e91e00/maintainability)](https://codeclimate.com/github/Eric-Guo/wechat/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/12885358487c13e91e00/test_coverage)](https://codeclimate.com/github/Eric-Guo/wechat/test_coverage)
2
2
  ======
3
3
 
4
4
  [![Join the chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Eric-Guo/wechat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -416,6 +416,7 @@ Wechat Enterprise Account commands:
416
416
  wechat callbackip # 获取微信服务器IP地址
417
417
  wechat clear_quota # 接口调用次数清零
418
418
  wechat convert_to_openid [USER_ID] # userid转换成openid
419
+ wechat convert_to_userid [OPENID] # openid转换成userid
419
420
  wechat custom_image [OPENID, IMAGE_PATH] # 发送图片客服消息
420
421
  wechat custom_music [OPENID, THUMBNAIL_PATH, MUSIC_URL] # 发送音乐客服消息
421
422
  wechat custom_news [OPENID, NEWS_YAML_PATH] # 发送图文客服消息
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- WeChat [![Gem Version](https://badge.fury.io/rb/wechat.svg)](https://rubygems.org/gems/wechat) [![Build Status](https://travis-ci.org/Eric-Guo/wechat.svg)](https://travis-ci.org/Eric-Guo/wechat) [![Maintainability](https://api.codeclimate.com/v1/badges/12885358487c13e91e00/maintainability)](https://codeclimate.com/github/Eric-Guo/wechat/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/12885358487c13e91e00/test_coverage)](https://codeclimate.com/github/Eric-Guo/wechat/test_coverage)
1
+ WeChat [![Gem Version](https://badge.fury.io/rb/wechat.svg)](https://rubygems.org/gems/wechat) [![Build Status](https://travis-ci.com/Eric-Guo/wechat.svg)](https://travis-ci.com/github/Eric-Guo/wechat) [![Maintainability](https://api.codeclimate.com/v1/badges/12885358487c13e91e00/maintainability)](https://codeclimate.com/github/Eric-Guo/wechat/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/12885358487c13e91e00/test_coverage)](https://codeclimate.com/github/Eric-Guo/wechat/test_coverage)
2
2
  ======
3
3
 
4
4
  [![Join the chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Eric-Guo/wechat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -448,6 +448,7 @@ Wechat Enterprise Account commands:
448
448
  wechat callbackip # 获取微信服务器IP地址
449
449
  wechat clear_quota # 接口调用次数清零
450
450
  wechat convert_to_openid [USER_ID] # userid转换成openid
451
+ wechat convert_to_userid [OPENID] # openid转换成userid
451
452
  wechat custom_image [OPENID, IMAGE_PATH] # 发送图片客服消息
452
453
  wechat custom_music [OPENID, THUMBNAIL_PATH, MUSIC_URL] # 发送音乐客服消息
453
454
  wechat custom_news [OPENID, NEWS_YAML_PATH] # 发送图文客服消息
data/bin/wechat CHANGED
@@ -187,6 +187,11 @@ class App < Thor
187
187
  puts wechat_api.convert_to_openid(userid)
188
188
  end
189
189
 
190
+ desc 'convert_to_userid [OPENID]', 'openid转换成userid'
191
+ def convert_to_userid(openid)
192
+ puts wechat_api.convert_to_userid(openid)
193
+ end
194
+
190
195
  desc 'agent_list', '获取应用概况列表'
191
196
  def agent_list
192
197
  r = wechat_api.agent_list
data/lib/wechat.rb CHANGED
@@ -50,7 +50,7 @@ module Wechat
50
50
  decrypted_data = Base64.decode64(encrypted_data)
51
51
  JSON.parse(cipher.update(decrypted_data) + cipher.final)
52
52
  rescue StandardError => e
53
- { 'errcode': 41003, 'errmsg': e.message }
53
+ { errcode: 41003, errmsg: e.message }
54
54
  end
55
55
  end
56
56
 
data/lib/wechat/cipher.rb CHANGED
@@ -43,7 +43,7 @@ module Wechat
43
43
  msg = decode_padding(msg)
44
44
  msg_len = msg[16, 4].reverse.unpack1('V')
45
45
  content = msg[20, msg_len]
46
- app_id = msg[(20 + msg_len)..-1]
46
+ app_id = msg[(msg_len + 20)..-1]
47
47
 
48
48
  [content, app_id]
49
49
  end
@@ -47,6 +47,10 @@ module Wechat
47
47
  post 'user/convert_to_openid', JSON.generate(userid: userid, agentid: agentid)
48
48
  end
49
49
 
50
+ def convert_to_userid(openid)
51
+ post 'user/convert_to_userid', JSON.generate(openid: openid)
52
+ end
53
+
50
54
  def invite_user(userid)
51
55
  post 'invite/send', JSON.generate(userid: userid)
52
56
  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.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Skinnyworm
@@ -35,7 +35,7 @@ cert_chain:
35
35
  spvOK5/LPXWX6ZGc2SR8SH/s7ftYH2EkeM1VUbtemow08NdgCwJ4IG+fRQ9dcrJ+
36
36
  L9TbpLHvVrCe1w8duMqNeUmqj+M1iC/5Zst2vIe14QcOTuAh
37
37
  -----END CERTIFICATE-----
38
- date: 2020-12-28 00:00:00.000000000 Z
38
+ date: 2021-03-03 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: activesupport
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  - !ruby/object:Gem::Version
245
245
  version: '0'
246
246
  requirements: []
247
- rubygems_version: 3.2.3
247
+ rubygems_version: 3.2.12
248
248
  signing_key:
249
249
  specification_version: 4
250
250
  summary: DSL for wechat message handling and API
metadata.gz.sig CHANGED
Binary file