wechat 0.17.4 → 0.17.6
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.tar.gz.sig +0 -0
- metadata +13 -13
- 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: 7f52a2187b27eeeefa75054f9918a0775220e8306e91da7abfa04de6e15d1dd3
|
4
|
+
data.tar.gz: 27c1d1a120fd0283bb585931b6798f2051acb4c72b4ecf6bd99171da77a9e8ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fd77e84ec3ab4a1d6369e6a2563f69f695bbb7613f9d74de699ffc696e1820476682e6612facb8291c7f4632e6ac3c0d0181e256c759696e677906022cfe544
|
7
|
+
data.tar.gz: f4027609c8a0148c7c0c9e22bc106b9a49d43bebdae94728c81992a569d837535cbb6978197c406bde8e90bb85f4d14d98cd13fa223fc8a3c6eb0e38a95d4cd7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.17.6 (released at 2024-10-25)
|
4
|
+
|
5
|
+
* Support Rails 8.0 now
|
6
|
+
|
7
|
+
## v0.17.5 (released at 2024-10-25)
|
8
|
+
|
9
|
+
* Remove `serialize :hash_store` in template as it's cause too many issue in different rails version.
|
10
|
+
|
3
11
|
## v0.17.4 (released at 2024-08-13)
|
4
12
|
|
5
13
|
* Fix private API ActiveSupport::Deprecation.warn called in Rails 7.2
|
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)
|
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.6
|
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-12-11 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activesupport
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
version: '6.0'
|
48
48
|
- - "<"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
50
|
+
version: '9'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version: '6.0'
|
58
58
|
- - "<"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '9'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: http
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,42 +140,42 @@ dependencies:
|
|
140
140
|
requirements:
|
141
141
|
- - "~>"
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: 1.
|
143
|
+
version: 1.68.0
|
144
144
|
type: :development
|
145
145
|
prerelease: false
|
146
146
|
version_requirements: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
148
|
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: 1.
|
150
|
+
version: 1.68.0
|
151
151
|
- !ruby/object:Gem::Dependency
|
152
152
|
name: rails
|
153
153
|
requirement: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
155
|
- - ">="
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
157
|
+
version: 8.0.0
|
158
158
|
type: :development
|
159
159
|
prerelease: false
|
160
160
|
version_requirements: !ruby/object:Gem::Requirement
|
161
161
|
requirements:
|
162
162
|
- - ">="
|
163
163
|
- !ruby/object:Gem::Version
|
164
|
-
version:
|
164
|
+
version: 8.0.0
|
165
165
|
- !ruby/object:Gem::Dependency
|
166
166
|
name: rspec-rails
|
167
167
|
requirement: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
169
|
- - "~>"
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
version: '
|
171
|
+
version: '7.1'
|
172
172
|
type: :development
|
173
173
|
prerelease: false
|
174
174
|
version_requirements: !ruby/object:Gem::Requirement
|
175
175
|
requirements:
|
176
176
|
- - "~>"
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
version: '
|
178
|
+
version: '7.1'
|
179
179
|
- !ruby/object:Gem::Dependency
|
180
180
|
name: rspec-mocks
|
181
181
|
requirement: !ruby/object:Gem::Requirement
|
@@ -263,8 +263,8 @@ licenses:
|
|
263
263
|
metadata:
|
264
264
|
bug_tracker_uri: https://github.com/Eric-Guo/wechat/issues
|
265
265
|
changelog_uri: https://github.com/Eric-Guo/wechat/releases
|
266
|
-
documentation_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.
|
267
|
-
source_code_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.
|
266
|
+
documentation_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.6#readme
|
267
|
+
source_code_uri: https://github.com/Eric-Guo/wechat/tree/v0.17.6
|
268
268
|
rubygems_mfa_required: 'true'
|
269
269
|
post_install_message:
|
270
270
|
rdoc_options: []
|
@@ -281,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
281
|
- !ruby/object:Gem::Version
|
282
282
|
version: 3.1.6
|
283
283
|
requirements: []
|
284
|
-
rubygems_version: 3.5.
|
284
|
+
rubygems_version: 3.5.23
|
285
285
|
signing_key:
|
286
286
|
specification_version: 4
|
287
287
|
summary: DSL for wechat message handling and API
|
metadata.gz.sig
CHANGED
Binary file
|