wechat 0.17.2 → 0.17.4

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: 116d4ce16cfc0cab641c2f15bbfb112259f55fdc4ef92c802137412cb7bb5302
4
- data.tar.gz: 12b1d3fa3ec0adfed6df712ee767d6c6a4cd35dad4c6f45cc1cca6791d61fa3f
3
+ metadata.gz: c7d465a4950bcf9d672e465f6df611380a6ea2f8a7a97609a198db0fc6780078
4
+ data.tar.gz: 168f9ac6817424838d68f9fceb240e3509da81bad2927c603ebfb840541a6d3c
5
5
  SHA512:
6
- metadata.gz: 4cc56dd5145757fda475a8652c01c58f2e650df30cf9bfe7ac3fc4a5df2917fd82236ade96d29ad69bdccb495f19f223c93e7fe688e11e98621a747ae3efedab
7
- data.tar.gz: 7b07126c3d6aaae770c2b8bb9c33d133ba489d9387743a2ddcc752e9ba2b89cebcc6203930a447cfcf229e06851af31fe09ff87b2f6cad64740b0c60f5dfd10e
6
+ metadata.gz: 17dbc1a4799625793717db99df15e1572342a73cc30d189436c1ab146b632ae86a356a4d943b67811844e6969abd55af2b14562915cf18998d23a2ed0e5c767a
7
+ data.tar.gz: bb86b6f6871166000718d217bd4e134072e6c4933dc76e579ffde8004f2f17d9661438b4a50bda76a21e432285329446d4b43705c7c97b9419d9a060da482e6c
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.17.4 (released at 2024-08-13)
4
+
5
+ * Fix private API ActiveSupport::Deprecation.warn called in Rails 7.2
6
+
7
+ ## v0.17.3 (released at 2024-01-04)
8
+
9
+ * Add New CorpApi batch_get_by_user and follow_user_list. by @leepood #321
10
+ * Use JSON.parse handle response.body directly. by @leepood #322
11
+
3
12
  ## v0.17.2 (released at 2023-12-30)
4
13
 
5
14
  * Fix no need the message type restrictions. by @leepood #319
@@ -74,14 +74,14 @@ module Wechat
74
74
  end
75
75
 
76
76
  if defined?(::Rails)
77
- configs.each do |_, cfg|
77
+ configs.each_value do |cfg|
78
78
  cfg[:access_token] ||= Rails.root.try(:join, 'tmp/access_token').try(:to_path)
79
79
  cfg[:jsapi_ticket] ||= Rails.root.try(:join, 'tmp/jsapi_ticket').try(:to_path)
80
80
  cfg[:qcloud_token] ||= Rails.root.try(:join, 'tmp/qcloud_token').try(:to_path)
81
81
  end
82
82
  end
83
83
 
84
- configs.each do |_, cfg|
84
+ configs.each_value do |cfg|
85
85
  cfg[:timeout] ||= 20
86
86
  cfg[:qcloud_token_lifespan] ||= 7200
87
87
  cfg[:have_session_class] ||= class_exists?('WechatSession')
@@ -145,7 +145,7 @@ module Wechat
145
145
  end
146
146
 
147
147
  def material(media_id)
148
- ActiveSupport::Deprecation.warn('material is deprecated. use get_material instead.')
148
+ ActiveSupport::Deprecation.new.warn('material is deprecated. use get_material instead.')
149
149
 
150
150
  post 'material/get_material', JSON.generate(media_id: media_id), as: :file
151
151
  end
@@ -18,6 +18,16 @@ module Wechat
18
18
  get 'externalcontact/get', params: { external_userid: external_userid, cursor: cursor }
19
19
  end
20
20
 
21
+ def follow_user_list
22
+ # https://developer.work.weixin.qq.com/document/path/92576
23
+ get 'externalcontact/get_follow_user_list'
24
+ end
25
+
26
+ def batch_get_by_user(userid_list, cursor: nil, limit: nil)
27
+ # https://developer.work.weixin.qq.com/document/path/93010
28
+ post 'externalcontact/batch/get_by_user', JSON.generate(userid_list: userid_list, cursor: cursor, limit: limit)
29
+ end
30
+
21
31
  def agent_list
22
32
  get 'agent/list'
23
33
  end
@@ -161,7 +171,7 @@ module Wechat
161
171
  end
162
172
 
163
173
  def material(media_id)
164
- ActiveSupport::Deprecation.warn('material is deprecated. use get_material instead.')
174
+ ActiveSupport::Deprecation.new.warn('material is deprecated. use get_material instead.')
165
175
 
166
176
  post 'material/get_material', JSON.generate(media_id: media_id), params: { agentid: agentid }, as: :file
167
177
  end
@@ -88,7 +88,7 @@ module Wechat
88
88
  %r{^voice/.*} => :file,
89
89
  %r{^text/html} => :xml,
90
90
  %r{^text/plain} => :probably_json
91
- }.each_with_object([]) { |match, memo| memo << match[1] if content_type =~ match[0] }.first || as_type || :text
91
+ }.each_with_object([]) { |match, memo| memo << match[1] if content_type.match?(match[0]) }.first || as_type || :text
92
92
 
93
93
  # try to parse response as json, fallback to user-specified format or text if failed
94
94
  if parse_as == :probably_json
@@ -111,7 +111,7 @@ module Wechat
111
111
  data = file
112
112
 
113
113
  when :json
114
- data = JSON.parse response.body.to_s.gsub(/[\u0000-\u001f]+/, '')
114
+ data = JSON.parse response.body
115
115
  when :xml
116
116
  data = Hash.from_xml(response.body.to_s)
117
117
  else
@@ -236,7 +236,7 @@ module Wechat
236
236
  keep_camel_case_key = message_hash[:MsgType] == 'template'
237
237
  json_hash = deep_recursive(message_hash) do |key, value|
238
238
  key = key.to_s
239
- [(TO_JSON_KEY_MAP[key] || (keep_camel_case_key ? key : key.downcase)), value]
239
+ [TO_JSON_KEY_MAP[key] || (keep_camel_case_key ? key : key.downcase), value]
240
240
  end
241
241
  json_hash = json_hash.transform_keys(&:downcase).select { |k, _v| TO_JSON_ALLOWED.include? k }
242
242
 
data/lib/wechat.rb CHANGED
@@ -8,6 +8,7 @@ loader.setup
8
8
 
9
9
  require 'base64'
10
10
  require 'openssl/cipher'
11
+ require 'ostruct'
11
12
 
12
13
  module Wechat
13
14
  class AccessTokenExpiredError < StandardError; end
@@ -19,7 +20,7 @@ module Wechat
19
20
 
20
21
  def initialize(errcode, errmsg)
21
22
  @error_code = errcode
22
- super "#{errmsg}(#{error_code})"
23
+ super("#{errmsg}(#{error_code})")
23
24
  end
24
25
  end
25
26
 
data.tar.gz.sig CHANGED
Binary file
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.17.2
4
+ version: 0.17.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Skinnyworm
@@ -36,7 +36,7 @@ cert_chain:
36
36
  uxhUIIN2A+qeUxOIoO9VfGAX5Q+cQ4J+EpKkDovIHaG0tJdNoA9EABD8yMMHgWgw
37
37
  q9fk/nu08SjME28EsSxW0oLUQq1vHNKWUyZuHtihd0yBYGRJH7xdZivkUOs=
38
38
  -----END CERTIFICATE-----
39
- date: 2023-12-30 00:00:00.000000000 Z
39
+ date: 2024-08-13 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activesupport
@@ -45,6 +45,9 @@ dependencies:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '6.0'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '8'
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +55,9 @@ dependencies:
52
55
  - - ">="
53
56
  - !ruby/object:Gem::Version
54
57
  version: '6.0'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '8'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: http
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -134,70 +140,70 @@ dependencies:
134
140
  requirements:
135
141
  - - "~>"
136
142
  - !ruby/object:Gem::Version
137
- version: '1.9'
143
+ version: 1.64.1
138
144
  type: :development
139
145
  prerelease: false
140
146
  version_requirements: !ruby/object:Gem::Requirement
141
147
  requirements:
142
148
  - - "~>"
143
149
  - !ruby/object:Gem::Version
144
- version: '1.9'
150
+ version: 1.64.1
145
151
  - !ruby/object:Gem::Dependency
146
152
  name: rails
147
153
  requirement: !ruby/object:Gem::Requirement
148
154
  requirements:
149
155
  - - ">="
150
156
  - !ruby/object:Gem::Version
151
- version: 7.0.0
157
+ version: 7.2.0
152
158
  type: :development
153
159
  prerelease: false
154
160
  version_requirements: !ruby/object:Gem::Requirement
155
161
  requirements:
156
162
  - - ">="
157
163
  - !ruby/object:Gem::Version
158
- version: 7.0.0
164
+ version: 7.2.0
159
165
  - !ruby/object:Gem::Dependency
160
166
  name: rspec-rails
161
167
  requirement: !ruby/object:Gem::Requirement
162
168
  requirements:
163
169
  - - "~>"
164
170
  - !ruby/object:Gem::Version
165
- version: '6.0'
171
+ version: '6.1'
166
172
  type: :development
167
173
  prerelease: false
168
174
  version_requirements: !ruby/object:Gem::Requirement
169
175
  requirements:
170
176
  - - "~>"
171
177
  - !ruby/object:Gem::Version
172
- version: '6.0'
178
+ version: '6.1'
173
179
  - !ruby/object:Gem::Dependency
174
180
  name: rspec-mocks
175
181
  requirement: !ruby/object:Gem::Requirement
176
182
  requirements:
177
183
  - - "~>"
178
184
  - !ruby/object:Gem::Version
179
- version: '3.12'
185
+ version: '3.13'
180
186
  type: :development
181
187
  prerelease: false
182
188
  version_requirements: !ruby/object:Gem::Requirement
183
189
  requirements:
184
190
  - - "~>"
185
191
  - !ruby/object:Gem::Version
186
- version: '3.12'
192
+ version: '3.13'
187
193
  - !ruby/object:Gem::Dependency
188
194
  name: sqlite3
189
195
  requirement: !ruby/object:Gem::Requirement
190
196
  requirements:
191
197
  - - "~>"
192
198
  - !ruby/object:Gem::Version
193
- version: '1.5'
199
+ version: '2.0'
194
200
  type: :development
195
201
  prerelease: false
196
202
  version_requirements: !ruby/object:Gem::Requirement
197
203
  requirements:
198
204
  - - "~>"
199
205
  - !ruby/object:Gem::Version
200
- version: '1.5'
206
+ version: '2.0'
201
207
  description: API, command and message handling for WeChat in Rails
202
208
  email: eric.guocz@gmail.com
203
209
  executables:
@@ -257,8 +263,8 @@ licenses:
257
263
  metadata:
258
264
  bug_tracker_uri: https://github.com/Eric-Guo/wechat/issues
259
265
  changelog_uri: https://github.com/Eric-Guo/wechat/releases
260
- documentation_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.2#readme
261
- source_code_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.2
266
+ documentation_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.4#readme
267
+ source_code_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.4
262
268
  rubygems_mfa_required: 'true'
263
269
  post_install_message:
264
270
  rdoc_options: []
@@ -275,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
281
  - !ruby/object:Gem::Version
276
282
  version: 3.1.6
277
283
  requirements: []
278
- rubygems_version: 3.5.3
284
+ rubygems_version: 3.5.17
279
285
  signing_key:
280
286
  specification_version: 4
281
287
  summary: DSL for wechat message handling and API
metadata.gz.sig CHANGED
Binary file