wechat 0.17.1 → 0.17.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +9 -0
- data/lib/generators/wechat/templates/app/models/wechat_session.rb +1 -1
- data/lib/wechat/api_loader.rb +3 -3
- data/lib/wechat/corp_api.rb +10 -0
- data/lib/wechat/http_client.rb +2 -2
- data/lib/wechat/message.rb +1 -1
- data/lib/wechat/responder.rb +0 -2
- data/lib/wechat.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +26 -26
- 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: 497060e96871aaed2d484bf54a8f39701e67895add0fb2d456ad7722297db841
|
4
|
+
data.tar.gz: e7c029ef4bb8cf4018b81902999e54900df9f92dcfc9de1673f9a2b1514b48dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd6fa6017ade886d1e33de0971bfbea8abe4e05f8b01e15b91c256552bf9f6704a23c703ca3278867bfc65aed853adc1027d8841845d8d96eb9c1a14eb61d420
|
7
|
+
data.tar.gz: e786359f9835a52ddb6c7627115ffe1ea2151411c4c91374ae2343ef977a7eddb45d379c06b21ea10942dc583fe7666fbf710c52253d41c92e5ed1df6ba816af
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.17.3 (released at 2024-01-04)
|
4
|
+
|
5
|
+
* Add New CorpApi batch_get_by_user and follow_user_list. by @leepood #321
|
6
|
+
* Use JSON.parse handle response.body directly. by @leepood #322
|
7
|
+
|
8
|
+
## v0.17.2 (released at 2023-12-30)
|
9
|
+
|
10
|
+
* Fix no need the message type restrictions. by @leepood #319
|
11
|
+
|
3
12
|
## v0.17.1 (released at 2023-07-28)
|
4
13
|
|
5
14
|
* Add Record based token support. by @CoolDrinELiu #315
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Feel free to inherit from other class like ActiveModel::Model
|
5
5
|
class WechatSession < ActiveRecord::Base
|
6
6
|
validates :openid, presence: true, uniqueness: true
|
7
|
-
serialize :hash_store, Hash
|
7
|
+
serialize :hash_store, type: Hash
|
8
8
|
|
9
9
|
# called by wechat gems when user request session
|
10
10
|
def self.find_or_initialize_session(request_message)
|
data/lib/wechat/api_loader.rb
CHANGED
@@ -74,14 +74,14 @@ module Wechat
|
|
74
74
|
end
|
75
75
|
|
76
76
|
if defined?(::Rails)
|
77
|
-
configs.
|
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.
|
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')
|
@@ -124,7 +124,7 @@ module Wechat
|
|
124
124
|
return config
|
125
125
|
end
|
126
126
|
end
|
127
|
-
|
127
|
+
resolve_config_file(home_config_file, nil) if File.exist?(home_config_file)
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
data/lib/wechat/corp_api.rb
CHANGED
@@ -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
|
data/lib/wechat/http_client.rb
CHANGED
@@ -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
|
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
|
114
|
+
data = JSON.parse response.body
|
115
115
|
when :xml
|
116
116
|
data = Hash.from_xml(response.body.to_s)
|
117
117
|
else
|
data/lib/wechat/message.rb
CHANGED
@@ -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
|
-
[
|
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/responder.rb
CHANGED
@@ -19,8 +19,6 @@ module Wechat
|
|
19
19
|
attr_accessor :account_from_request
|
20
20
|
|
21
21
|
def on(message_type, with: nil, respond: nil, &block)
|
22
|
-
raise 'Unknow message type' unless %i[text image voice video shortvideo link event click view scan batch_job location label_location fallback].include?(message_type)
|
23
|
-
|
24
22
|
config = respond.nil? ? {} : { respond: respond }
|
25
23
|
config[:proc] = block if block_given?
|
26
24
|
|
data/lib/wechat.rb
CHANGED
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.
|
4
|
+
version: 0.17.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Skinnyworm
|
@@ -13,30 +13,30 @@ cert_chain:
|
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
14
|
MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMRMwEQYDVQQDDAplcmlj
|
15
15
|
Lmd1b2N6MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZFgNj
|
16
|
-
|
16
|
+
b20wHhcNMjMxMjMwMDgzMDQ1WhcNMjQxMjI5MDgzMDQ1WjBBMRMwEQYDVQQDDApl
|
17
17
|
cmljLmd1b2N6MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
/
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
18
|
+
FgNjb20wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDvLvsV0dygCIpJ
|
19
|
+
fi58762MvuxkFod1TEHkx2kmGbdazIrnS5uR1/H3dw+TY8tPp0/AdD4LYw2JOJy/
|
20
|
+
2T9LUAO5HRBFRVfQEBqpEiIix8TK1uu62Ba9DKBng0y+2hpcdMnQE7xgri8QN1QA
|
21
|
+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z042QSVcIw+5Q5wcmZpXL
|
36
|
+
uxhUIIN2A+qeUxOIoO9VfGAX5Q+cQ4J+EpKkDovIHaG0tJdNoA9EABD8yMMHgWgw
|
37
|
+
q9fk/nu08SjME28EsSxW0oLUQq1vHNKWUyZuHtihd0yBYGRJH7xdZivkUOs=
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date:
|
39
|
+
date: 2024-01-04 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activesupport
|
@@ -257,8 +257,8 @@ licenses:
|
|
257
257
|
metadata:
|
258
258
|
bug_tracker_uri: https://github.com/Eric-Guo/wechat/issues
|
259
259
|
changelog_uri: https://github.com/Eric-Guo/wechat/releases
|
260
|
-
documentation_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.
|
261
|
-
source_code_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.
|
260
|
+
documentation_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.3#readme
|
261
|
+
source_code_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.3
|
262
262
|
rubygems_mfa_required: 'true'
|
263
263
|
post_install_message:
|
264
264
|
rdoc_options: []
|
@@ -275,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
275
|
- !ruby/object:Gem::Version
|
276
276
|
version: 3.1.6
|
277
277
|
requirements: []
|
278
|
-
rubygems_version: 3.
|
278
|
+
rubygems_version: 3.5.3
|
279
279
|
signing_key:
|
280
280
|
specification_version: 4
|
281
281
|
summary: DSL for wechat message handling and API
|
metadata.gz.sig
CHANGED
Binary file
|