wechat 0.11.6 → 0.11.7

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: 13a9ee494b1cd4d180d568534218b84c00d096d9437310e9535557b38957871c
4
- data.tar.gz: ae888cf17a643f439314fb30d283dc37a5ee6935a597f39db56344a6ced3e345
3
+ metadata.gz: ed7c19916af2b008eeb90cbd140261806457a679ac04fd1d7cafc741b5414494
4
+ data.tar.gz: a16c5a69bbd32d54263cf3fc15207a0c3278384f75239c3dc94fefa3952b8d68
5
5
  SHA512:
6
- metadata.gz: a5d2145947a65a320695573545c0c2e8e13c34b18a3805b9993194fdd64f3ce531b39e82285740d0be0b12886e597565fa70298eff406cb032741018599e2c90
7
- data.tar.gz: 420c2c2f98a1647da669c92509f30f2fd393738f2a6f51e6d3a8ad714c4dd650a987bf5f73501a936f1b2236e1c7ec8a1858d56313f59f70e7635e068cf61822
6
+ metadata.gz: 76379f62522cf5eff64c0772a127a7e9ed4be8ceed0eba6710acc47f641c20404bccf039ac6383d0e61148e38171edb704b02f28c4a325dd68f79b83e9ba3dc7
7
+ data.tar.gz: da56c9242149a5a636975ad59bec0f1cb735b2d25ca2c06fec6125a972127f16c68dbdb2f114d208be3cc91a55cc582ea03dcce74360c67aa5a6865adde79642
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.11.7 (released at 11/15/2019)
4
+
5
+ * ADD: Wechat::MpApi.subscribe_message_send. by @paicha #271
6
+ * FIX: FrozenError: can't modify frozen String. by @paicha #272
7
+ * New translatecontent support.
8
+
3
9
  ## v0.11.6 (released at 09/02/2019)
4
10
 
5
11
  * Fix private method `next_migration_number` introduced at #267, by @zpdsky #270
@@ -392,6 +392,7 @@ Wechat Public Account commands:
392
392
  wechat tag_update [TAG_ID, TAGNAME] # 更新标签名字
393
393
  wechat tags # 获取所有标签
394
394
  wechat template_message [OPENID, TEMPLATE_YAML_PATH] # 模板消息接口
395
+ wechat translatecontent [CONTENT] # AI开放接口-微信翻译
395
396
  wechat user [OPEN_ID] # 获取用户基本信息
396
397
  wechat user_batchget [OPEN_ID_LIST] # 批量获取用户基本信息
397
398
  wechat user_change_group [OPEN_ID, TO_GROUP_ID] # 移动用户分组
data/README.md CHANGED
@@ -423,6 +423,7 @@ Wechat Public Account commands:
423
423
  wechat tag_update [TAG_ID, TAGNAME] # 更新标签名字
424
424
  wechat tags # 获取所有标签
425
425
  wechat template_message [OPENID, TEMPLATE_YAML_PATH] # 模板消息接口
426
+ wechat translatecontent [CONTENT] # AI开放接口-微信翻译
426
427
  wechat user [OPEN_ID] # 获取用户基本信息
427
428
  wechat user_batchget [OPEN_ID_LIST] # 批量获取用户基本信息
428
429
  wechat user_change_group [OPEN_ID, TO_GROUP_ID] # 移动用户分组
data/bin/wechat CHANGED
@@ -315,6 +315,11 @@ class App < Thor
315
315
  def queryrecoresultfortext(voice_id)
316
316
  puts wechat_api.queryrecoresultfortext(voice_id)
317
317
  end
318
+
319
+ desc 'translatecontent [CONTENT]', 'AI开放接口-微信翻译'
320
+ def translatecontent(content)
321
+ puts wechat_api.translatecontent(content)
322
+ end
318
323
  end
319
324
 
320
325
  desc 'user [OPEN_ID]', '获取用户基本信息'
@@ -51,4 +51,4 @@ module Wechat
51
51
  end
52
52
  end
53
53
 
54
- ActionView::Base.send :include, Wechat::Helpers if defined? ActionView::Base
54
+ ActionView::Base.include Wechat::Helpers if defined? ActionView::Base
@@ -33,7 +33,7 @@ module Wechat
33
33
  # app_id or corp_id
34
34
  def pack(content, app_id)
35
35
  random = SecureRandom.hex(8)
36
- text = content.force_encoding('ASCII-8BIT')
36
+ text = content.dup.force_encoding('ASCII-8BIT')
37
37
  msg_len = [text.length].pack('N')
38
38
 
39
39
  encode_padding("#{random}#{msg_len}#{text}#{app_id}")
@@ -204,6 +204,10 @@ module Wechat
204
204
  post 'media/voice/queryrecoresultfortext', nil, params: { voice_id: voice_id, lang: lang }
205
205
  end
206
206
 
207
+ def translatecontent(from_content, lfrom = 'zh_CN', lto = 'en_US')
208
+ post 'media/voice/translatecontent', from_content, params: { lfrom: lfrom, lto: lto }
209
+ end
210
+
207
211
  def web_access_token(code)
208
212
  params = {
209
213
  appid: access_token.appid,
@@ -34,6 +34,10 @@ module Wechat
34
34
  post 'wxopen/template/del', JSON.generate(template_id: template_id)
35
35
  end
36
36
 
37
+ def subscribe_message_send(message)
38
+ post 'message/subscribe/send', message.to_json
39
+ end
40
+
37
41
  def jscode2session(code)
38
42
  params = {
39
43
  appid: access_token.appid,
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.11.6
4
+ version: 0.11.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Skinnyworm
@@ -35,7 +35,7 @@ cert_chain:
35
35
  2Gz/SZ1dgCkJpJU45GNrhatKx3kyg8eC5IHekNrEvJNJqPl0VdRIs/GtUkQyk+np
36
36
  3kTPkfLMsAZznXo3bzMe0V5TB4+a7pFEK1nN/htWrOVkIi/3
37
37
  -----END CERTIFICATE-----
38
- date: 2019-09-02 00:00:00.000000000 Z
38
+ date: 2019-11-15 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: activesupport
metadata.gz.sig CHANGED
Binary file