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.
@@ -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 || 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 :weixin_token, "your-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
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'
@@ -1,6 +1,6 @@
1
1
  module Sinatra
2
2
  module WeiXinRobot
3
- VERSION = '0.0.1' unless const_defined? :VERSION
3
+ VERSION = '0.0.2' unless const_defined? :VERSION
4
4
  def self.version
5
5
  "Sinatra::WeiXinRobot v#{VERSION}"
6
6
  end
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.1
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 for sinatra
46
+ summary: WeiXin Robot
47
47
  test_files: []