sinatra-weixin-robot 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sinatra/weixin-robot.rb +6 -6
- data/lib/sinatra-weixin-robot.rb +1 -1
- metadata +2 -2
data/lib/sinatra/weixin-robot.rb
CHANGED
@@ -7,7 +7,7 @@ module Sinatra
|
|
7
7
|
module WeiXinRobot
|
8
8
|
module RobotHelpers
|
9
9
|
def generate_signature(token=nil)
|
10
|
-
weixin_token = settings.wexin_token
|
10
|
+
weixin_token = token || settings.wexin_token
|
11
11
|
signature, timestamp, nonce = params[:signature], params[:timestamp], params[:nonce]
|
12
12
|
weixin_sha1 = [token, timestamp.to_s, nonce.to_s].sort!.join
|
13
13
|
Digest::SHA1.hexdigest(weixin_sha1)
|
@@ -175,12 +175,12 @@ module Sinatra
|
|
175
175
|
to_xml
|
176
176
|
self
|
177
177
|
end
|
178
|
-
end
|
178
|
+
end #Reply
|
179
179
|
def self.registered(robot)
|
180
|
-
robot.set
|
181
|
-
robot.set
|
182
|
-
robot.set
|
183
|
-
robot.helpers
|
180
|
+
robot.set :weixin_token, ""
|
181
|
+
robot.set :weixin_uri, "http://wwww.your-weixin-bot-url.com/"
|
182
|
+
robot.set :weixin_path, URI(robot.settings.weixin_uri).path.to_s
|
183
|
+
robot.helpers RobotHelpers
|
184
184
|
robot.before "#{robot.settings.weixin_path}" do
|
185
185
|
if request.request_method == "POST"
|
186
186
|
content_type 'application/xml'
|
data/lib/sinatra-weixin-robot.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-weixin-robot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -43,5 +43,5 @@ rubyforge_project:
|
|
43
43
|
rubygems_version: 1.8.25
|
44
44
|
signing_key:
|
45
45
|
specification_version: 3
|
46
|
-
summary: WeiXin Robot
|
46
|
+
summary: WeiXin Robot
|
47
47
|
test_files: []
|