wechat 0.7.17 → 0.7.18
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.tar.gz.sig +0 -0
- data/CHANGELOG.md +5 -0
- data/README-CN.md +6 -0
- data/README.md +6 -0
- data/lib/wechat/responder.rb +9 -1
- metadata +25 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0b12575c8ffeebc966babb8c7cf0655f68ca248
|
4
|
+
data.tar.gz: c070e35dcee44d50d598d28d8b7c87a840bf43a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1e9cdc976df510d35e93c06d538867729d690a3e2d1b8783459757d4e548643ccc11677a42bcd90b854ff2e15ed476093f9d2884092c3f5bca25aa39650c187
|
7
|
+
data.tar.gz: 37689d8404fec0b04d5a8eba6e80f128826bd027940407356259980f18628f1d5b0282a4bed792ab276ebae905a40407c39324ba4af435cc13ecaab56b8ef94f
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.7.18 (released at 8/21/2016)
|
4
|
+
|
5
|
+
* Support label_location message, similar to location event, but sent by user with Label. #144
|
6
|
+
* Add gem signature as additional security methods.
|
7
|
+
|
3
8
|
## v0.7.17 (released at 8/18/2016)
|
4
9
|
|
5
10
|
* Allow declare wechat_api at ApplicationController, but using wechat at sub controller. #104
|
data/README-CN.md
CHANGED
@@ -616,6 +616,11 @@ class WechatsController < ActionController::Base
|
|
616
616
|
request.reply.video(request[:MediaId], title: '回声', description: "#{nickname}发来的视频请求") #直接视频返回给用户
|
617
617
|
end
|
618
618
|
|
619
|
+
# 处理地理位置消息
|
620
|
+
on :label_location do |request|
|
621
|
+
request.reply.text("Label: #{request[:Label]} Location_X: #{request[:Location_X]} Location_Y: #{request[:Location_Y]} Scale: #{request[:Scale]}")
|
622
|
+
end
|
623
|
+
|
619
624
|
# 处理上报地理位置事件
|
620
625
|
on :location do |request|
|
621
626
|
request.reply.text("Latitude: #{request[:Latitude]} Longitude: #{request[:Longitude]} Precision: #{request[:Precision]}")
|
@@ -673,6 +678,7 @@ end
|
|
673
678
|
- :voice 响应语音消息
|
674
679
|
- :shortvideo 响应短视频消息
|
675
680
|
- :video 响应视频消息
|
681
|
+
- :label_location 响应地理位置消息
|
676
682
|
- :link 响应链接消息
|
677
683
|
- :event 响应事件消息, 可以用`:with`参数来匹配事件类型,同文字消息类似,支持正则表达式匹配
|
678
684
|
- :click 虚拟响应事件消息, 微信传入:event,但gem内部会单独处理
|
data/README.md
CHANGED
@@ -631,6 +631,11 @@ class WechatsController < ActionController::Base
|
|
631
631
|
request.reply.video(request[:MediaId], title: 'Echo', description: "Got #{nickname} sent video") # Echo the sent video to user
|
632
632
|
end
|
633
633
|
|
634
|
+
# When user sent location message with label
|
635
|
+
on :label_location do |request|
|
636
|
+
request.reply.text("Label: #{request[:Label]} Location_X: #{request[:Location_X]} Location_Y: #{request[:Location_Y]} Scale: #{request[:Scale]}")
|
637
|
+
end
|
638
|
+
|
634
639
|
# When user sent location
|
635
640
|
on :location do |request|
|
636
641
|
request.reply.text("Latitude: #{request[:Latitude]} Longitude: #{request[:Longitude]} Precision: #{request[:Precision]}")
|
@@ -688,6 +693,7 @@ Below is current supported message_type:
|
|
688
693
|
- :voice voice message
|
689
694
|
- :shortvideo shortvideo message
|
690
695
|
- :video video message
|
696
|
+
- :label_location location message with label
|
691
697
|
- :link link message
|
692
698
|
- :event event message, using `:with` to match particular event, support regular expression match similr to text message.
|
693
699
|
- :click virtual event message, wechat still sent event message,but gems will mapping to menu click event.
|
data/lib/wechat/responder.rb
CHANGED
@@ -28,7 +28,7 @@ module Wechat
|
|
28
28
|
|
29
29
|
module ClassMethods
|
30
30
|
def on(message_type, with: nil, respond: nil, &block)
|
31
|
-
raise 'Unknow message type' unless [:text, :image, :voice, :video, :shortvideo, :link, :event, :click, :view, :scan, :batch_job, :location, :fallback].include?(message_type)
|
31
|
+
raise 'Unknow message type' unless [:text, :image, :voice, :video, :shortvideo, :link, :event, :click, :view, :scan, :batch_job, :location, :label_location, :fallback].include?(message_type)
|
32
32
|
config = respond.nil? ? {} : { respond: respond }
|
33
33
|
config[:proc] = block if block_given?
|
34
34
|
|
@@ -57,6 +57,8 @@ module Wechat
|
|
57
57
|
user_defined_scan_responders << config
|
58
58
|
when :location
|
59
59
|
user_defined_location_responders << config
|
60
|
+
when :label_location
|
61
|
+
user_defined_label_location_responders << config
|
60
62
|
else
|
61
63
|
user_defined_responders(message_type) << config
|
62
64
|
end
|
@@ -87,6 +89,10 @@ module Wechat
|
|
87
89
|
@location_responders ||= []
|
88
90
|
end
|
89
91
|
|
92
|
+
def user_defined_label_location_responders
|
93
|
+
@label_location_responders ||= []
|
94
|
+
end
|
95
|
+
|
90
96
|
def user_defined_responders(type)
|
91
97
|
@responders ||= {}
|
92
98
|
@responders[type] ||= []
|
@@ -115,6 +121,8 @@ module Wechat
|
|
115
121
|
else
|
116
122
|
yield(* match_responders(responders, message[:Event]))
|
117
123
|
end
|
124
|
+
when :location
|
125
|
+
yield(* user_defined_label_location_responders, message)
|
118
126
|
else
|
119
127
|
yield(responders.first)
|
120
128
|
end
|
metadata
CHANGED
@@ -1,15 +1,37 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wechat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Skinnyworm
|
8
8
|
- Eric Guo
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
|
-
cert_chain:
|
12
|
-
|
11
|
+
cert_chain:
|
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pqGIL65VctVjqVzD4RTvDrsFhVICL5o0rLYpC4Qm5jBpx+E2s/akJSDsQcOO12
|
29
|
+
qk+IDlQHJjhf7DOg0+XAIj1/QTvq8s3QrrD8NRoIvGcAXVzqAafcG9NOGIXpqFS1
|
30
|
+
ZdwgixrYZK4p/Z+qIJFiuGvBauegUn0x7WDln52cWXgb+a/oYPBjGtBAZznhSy+R
|
31
|
+
R5k6Ma92sW8jupX4cqbSu9rntdVQkNRpoHIrfU0MZT0cKsg/D1zMteylxrO3KMsz
|
32
|
+
SPQRv+nrI1J0zevFqb8010heoR8SDyUA0Mm3+Q==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2016-08-21 00:00:00.000000000 Z
|
13
35
|
dependencies:
|
14
36
|
- !ruby/object:Gem::Dependency
|
15
37
|
name: activesupport
|
metadata.gz.sig
ADDED
Binary file
|