wechat 0.11.10 → 0.11.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bae019a8d3da8b0f78aba677ba633a46ecebdf975be517f09b5ec82050b2aee9
4
- data.tar.gz: 1bdb9f6dd87d72071071e3ff36d4d6334c0ddb0825d2ef5abe243b6298983ee2
3
+ metadata.gz: 0f0bb39391f507bdd4855e02eb9d56a1e7b110c6c9fd8c16b65a984af1d376f1
4
+ data.tar.gz: 673b26d9e77bf7d652fd0bfa30fdddf9516fc7b0a15bdf8b53e471fdb4db606c
5
5
  SHA512:
6
- metadata.gz: 0c87ecd9b34fc0c34538bd754e6b35e20cc6e87f138b7434fabf92c3f0ec2a0cfbbc44a7d0e7c88fa52237b293f1744408697043c3f7e624e5eba9c871ba2153
7
- data.tar.gz: 8a431320b86e529acd98de9482070052fbeb4dcf80538dc9e0d5c2e6a7507460fa848a0bb0c3692c68c89ef8b7dbd0243ef537442680a678b3e871ff4f4ec40f
6
+ metadata.gz: 841297efa8f80c68801a9348c253b7666b501f0cec535f39e42d268d6e5188c9c0f551c3d1af72282194cc97e9c65bcb1e30a9359b208d345a8a5e237c46858e
7
+ data.tar.gz: 31a0a90843b8ca7357563fc9cbf53cf795a1ef58d7292bae725caaf4b5868997975176b0cf26b9b2259c5378d04eee28053d3e91d6d26a057bdab5aaf29b39f9
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.11.11 (released at 09/13/2020)
4
+
5
+ * FIX: fix_load_controller_wechat not support MP type, by @Msms-NJ #281
6
+
3
7
  ## v0.11.10 (released at 09/02/2020)
4
8
 
5
9
  * ADD: Wechat::MpApi.wxa_msg_sec_check.
@@ -54,9 +54,11 @@ module ActionController
54
54
  Wechat::CorpApi.new(corpid, corpsecret, access_token, \
55
55
  agentid, timeout, skip_verify_ssl, jsapi_ticket)
56
56
  else
57
+ type = opts[:type] || cfg.type
57
58
  secret = opts[:secret] || cfg.secret
58
- Wechat::Api.new(appid, secret, access_token, \
59
- timeout, skip_verify_ssl, jsapi_ticket)
59
+ wechat_api_class = (type && type.to_sym == :mp ? Wechat::MpApi : Wechat::Api)
60
+ wechat_api_class.new(appid, secret, access_token, \
61
+ timeout, skip_verify_ssl, jsapi_ticket)
60
62
  end
61
63
  end
62
64
  end
@@ -19,6 +19,7 @@ module Wechat
19
19
  class InvalidCredentialError < StandardError; end
20
20
  class ResponseError < StandardError
21
21
  attr_reader :error_code
22
+
22
23
  def initialize(errcode, errmsg)
23
24
  @error_code = errcode
24
25
  super "#{errmsg}(#{error_code})"
@@ -10,7 +10,7 @@ module Wechat
10
10
  cipher.encrypt
11
11
 
12
12
  cipher.padding = 0
13
- key_data = Base64.decode64(encoding_aes_key + '=')
13
+ key_data = Base64.decode64("#{encoding_aes_key}=")
14
14
  cipher.key = key_data
15
15
  cipher.iv = [key_data].pack('H*')
16
16
 
@@ -22,7 +22,7 @@ module Wechat
22
22
  cipher.decrypt
23
23
 
24
24
  cipher.padding = 0
25
- key_data = Base64.decode64(encoding_aes_key + '=')
25
+ key_data = Base64.decode64("#{encoding_aes_key}=")
26
26
  cipher.key = key_data
27
27
  cipher.iv = [key_data].pack('H*')
28
28
 
@@ -10,6 +10,7 @@ module Wechat
10
10
  attr_reader :agentid
11
11
 
12
12
  def initialize(appid, secret, token_file, agentid, timeout, skip_verify_ssl, jsapi_ticket_file)
13
+ super()
13
14
  @client = HttpClient.new(QYAPI_BASE, timeout, skip_verify_ssl)
14
15
  @access_token = Token::CorpAccessToken.new(@client, appid, secret, token_file)
15
16
  @agentid = agentid
@@ -77,12 +77,12 @@ module Wechat
77
77
  def parse_response(response, as_type)
78
78
  content_type = response.headers[:content_type]
79
79
  parse_as = {
80
- %r{^application\/json} => :json,
81
- %r{^image\/.*} => :file,
82
- %r{^audio\/.*} => :file,
83
- %r{^voice\/.*} => :file,
84
- %r{^text\/html} => :xml,
85
- %r{^text\/plain} => :probably_json
80
+ %r{^application/json} => :json,
81
+ %r{^image/.*} => :file,
82
+ %r{^audio/.*} => :file,
83
+ %r{^voice/.*} => :file,
84
+ %r{^text/html} => :xml,
85
+ %r{^text/plain} => :probably_json
86
86
  }.each_with_object([]) { |match, memo| memo << match[1] if content_type =~ match[0] }.first || as_type || :text
87
87
 
88
88
  # try to parse response as json, fallback to user-specified format or text if failed
@@ -32,6 +32,7 @@ module Wechat
32
32
 
33
33
  class ArticleBuilder
34
34
  attr_reader :items
35
+
35
36
  delegate :count, to: :items
36
37
  def initialize
37
38
  @items = []
@@ -145,9 +145,10 @@ module Wechat
145
145
  next
146
146
  end
147
147
 
148
- if condition.is_a? Regexp
148
+ case condition
149
+ when Regexp
149
150
  memo[:scoped] ||= [responder] + $LAST_MATCH_INFO.captures if value =~ condition
150
- elsif value == condition
151
+ when value
151
152
  memo[:scoped] ||= [responder, value]
152
153
  end
153
154
  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.11.10
4
+ version: 0.11.11
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-09-02 00:00:00.000000000 Z
38
+ date: 2020-09-13 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: activesupport
metadata.gz.sig CHANGED
Binary file