wechat 0.17.3 → 0.17.5
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 +8 -0
- data/README-CN.md +21 -0
- data/README.md +20 -0
- data/lib/generators/wechat/templates/app/models/wechat_session.rb +2 -1
- data/lib/wechat/concern/common.rb +1 -1
- data/lib/wechat/corp_api.rb +1 -1
- data/lib/wechat.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +21 -15
- 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: 2abb37f01abc3bcc8f7c9f0500f5a4f73c6877c36152b0e74ddb92fa630227e7
|
4
|
+
data.tar.gz: d08f8b4c5ddc18d3733ad331268733a5dc55ee41b684cdc810905583f32923fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ee8b7886ef537b146b3f4a5fbcf035a67effd8876f85ca167c10c6528102c653a076dc2b32a28897db378e0ea0422cbb37d988d520a321e62109e6306297d88
|
7
|
+
data.tar.gz: 77d3c1abb49ec7c7e4fa3597a676c02618db0aa2f6ed35f954de10dea11549802e5085fbb175b2861972db341fc657d1884048c6b5c1034c9c5ab781baacf7cf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.17.5 (released at 2024-10-25)
|
4
|
+
|
5
|
+
* Remove `serialize :hash_store` in template as it's cause too many issue in different rails version.
|
6
|
+
|
7
|
+
## v0.17.4 (released at 2024-08-13)
|
8
|
+
|
9
|
+
* Fix private API ActiveSupport::Deprecation.warn called in Rails 7.2
|
10
|
+
|
3
11
|
## v0.17.3 (released at 2024-01-04)
|
4
12
|
|
5
13
|
* Add New CorpApi batch_get_by_user and follow_user_list. by @leepood #321
|
data/README-CN.md
CHANGED
@@ -859,6 +859,27 @@ end
|
|
859
859
|
|
860
860
|
注意设置了[多客服消息转发](http://dkf.qq.com/)后,不能再添加默认文字信息 `responder`,否则文字消息将得不到转发。
|
861
861
|
|
862
|
+
|
863
|
+
### 无法处理给一个默认回答,一周内不要重复
|
864
|
+
|
865
|
+
```ruby
|
866
|
+
class WechatsController < ActionController::Base
|
867
|
+
on :fallback do |message|
|
868
|
+
Rails.logger.debug "YouApp_ToUserName: #{message.message_hash["FromUserName"]}"
|
869
|
+
session = WechatSession.find_by openid: message.message_hash["FromUserName"]
|
870
|
+
return message.reply.success if session.present? && session.greating_time.present? && session.greating_time >= 1.week.ago
|
871
|
+
|
872
|
+
images_path = Rails.root.join("public", "images", "default_help.jpg")
|
873
|
+
media_id = Wechat.api.media_create("image", images_path)["media_id"]
|
874
|
+
if session.present? && session.reload
|
875
|
+
# generate migration: add_column :wechat_sessions, :greating_time, :datetime
|
876
|
+
session.update(greating_time: Time.current)
|
877
|
+
end
|
878
|
+
message.reply.image(media_id)
|
879
|
+
end
|
880
|
+
end
|
881
|
+
```
|
882
|
+
|
862
883
|
### 通知
|
863
884
|
|
864
885
|
现支持以下通知:
|
data/README.md
CHANGED
@@ -894,6 +894,26 @@ end
|
|
894
894
|
|
895
895
|
Caution: do not set default text responder if you want to use [multiply human customer service](http://dkf.qq.com/), other will lead text message can not transfer.
|
896
896
|
|
897
|
+
### Give a default answer, do not repeat within a week
|
898
|
+
|
899
|
+
```ruby
|
900
|
+
class WechatsController < ActionController::Base
|
901
|
+
on :fallback do |message|
|
902
|
+
Rails.logger.debug "YouApp_ToUserName: #{message.message_hash["FromUserName"]}"
|
903
|
+
session = WechatSession.find_by openid: message.message_hash["FromUserName"]
|
904
|
+
return message.reply.success if session.present? && session.greating_time.present? && session.greating_time >= 1.week.ago
|
905
|
+
|
906
|
+
images_path = Rails.root.join("public", "images", "default_help.jpg")
|
907
|
+
media_id = Wechat.api.media_create("image", images_path)["media_id"]
|
908
|
+
if session.present? && session.reload
|
909
|
+
# generate migration: add_column :wechat_sessions, :greating_time, :datetime
|
910
|
+
session.update(greating_time: Time.current)
|
911
|
+
end
|
912
|
+
message.reply.image(media_id)
|
913
|
+
end
|
914
|
+
end
|
915
|
+
```
|
916
|
+
|
897
917
|
### Notifications
|
898
918
|
|
899
919
|
* `wechat.responder.after_create` data includes request <Wechat::Message> and response <Wechat::Message>.
|
@@ -4,7 +4,8 @@
|
|
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
|
7
|
+
# don't using serialize if possible, see README `on :fallback`
|
8
|
+
serialize :hash_store, type: Hash, coder: YAML, yaml: { permitted_classes: [String] }
|
8
9
|
|
9
10
|
# called by wechat gems when user request session
|
10
11
|
def self.find_or_initialize_session(request_message)
|
@@ -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
|
data/lib/wechat/corp_api.rb
CHANGED
@@ -171,7 +171,7 @@ module Wechat
|
|
171
171
|
end
|
172
172
|
|
173
173
|
def material(media_id)
|
174
|
-
ActiveSupport::Deprecation.warn('material is deprecated. use get_material instead.')
|
174
|
+
ActiveSupport::Deprecation.new.warn('material is deprecated. use get_material instead.')
|
175
175
|
|
176
176
|
post 'material/get_material', JSON.generate(media_id: media_id), params: { agentid: agentid }, as: :file
|
177
177
|
end
|
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.5
|
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: 2024-
|
39
|
+
date: 2024-10-25 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:
|
143
|
+
version: 1.66.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:
|
150
|
+
version: 1.66.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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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: '
|
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: '
|
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.
|
261
|
-
source_code_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.
|
266
|
+
documentation_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.5#readme
|
267
|
+
source_code_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.5
|
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.
|
284
|
+
rubygems_version: 3.5.22
|
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
|