wei-backend 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wei-backend/main.rb +2 -2
- data/lib/wei-backend/version.rb +1 -1
- data/spec/wei_backend_spec.rb +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e71022dc9103d79911126ec2b08c09624105c1c
|
4
|
+
data.tar.gz: 2170b1c6de741b5e2eba156902b118a05067d014
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00c4f48060e0cc7238ac6d27c6d6bc736b857c515c9f53b0793cdf1d24b9a8b06e99b042cea348fdbc9cf38ffe19d23d8cda82c8601d158909160034089c0ec5
|
7
|
+
data.tar.gz: 5c72ee53f6bc9b12f1b49583e07e6d8f564528f06735f06a08404ebcc1fd1e24c1edb96e731165f0a65d056171a47a68734c962381f9f824eea70c83749a9ff5
|
data/lib/wei-backend/main.rb
CHANGED
@@ -16,11 +16,11 @@ token_proc = proc {
|
|
16
16
|
WeiBackend::MessageDispatcher.token
|
17
17
|
}
|
18
18
|
|
19
|
-
get '/', :access_token => token_proc do
|
19
|
+
get '/weixin', :access_token => token_proc do
|
20
20
|
params[:echostr]
|
21
21
|
end
|
22
22
|
|
23
|
-
post '/', :access_token => token_proc do
|
23
|
+
post '/weixin', :access_token => token_proc do
|
24
24
|
request.body.rewind
|
25
25
|
weixin_params = WeiBackend::Utils.parse_params request.body.read
|
26
26
|
handler = WeiBackend::MessageDispatcher.new
|
data/lib/wei-backend/version.rb
CHANGED
data/spec/wei_backend_spec.rb
CHANGED
@@ -3,7 +3,7 @@ describe 'app' do
|
|
3
3
|
include Rack::Test::Methods
|
4
4
|
|
5
5
|
it 'should echo string when request with echostr parameter' do
|
6
|
-
get '
|
6
|
+
get '/weixin?echostr=test'
|
7
7
|
last_response.body.should include 'test'
|
8
8
|
end
|
9
9
|
|
@@ -12,7 +12,7 @@ describe 'app' do
|
|
12
12
|
'hello world'
|
13
13
|
end
|
14
14
|
|
15
|
-
post '/', TEXT_MESSAGE_REQUEST, 'CONTENT_TYPE' => 'text/xml'
|
15
|
+
post '/weixin', TEXT_MESSAGE_REQUEST, 'CONTENT_TYPE' => 'text/xml'
|
16
16
|
last_response.body.should include '<ToUserName><![CDATA[fromUser]]></ToUserName>'
|
17
17
|
last_response.body.should include '<Content><![CDATA[hello world]]></Content>'
|
18
18
|
end
|
@@ -22,7 +22,7 @@ describe 'app' do
|
|
22
22
|
{:title => 'title', :description => 'desc', :picture_url => 'pic url', :url => 'url'}
|
23
23
|
end
|
24
24
|
|
25
|
-
post '/', TEXT_MESSAGE_REQUEST, 'CONTENT_TYPE' => 'text/xml'
|
25
|
+
post '/weixin', TEXT_MESSAGE_REQUEST, 'CONTENT_TYPE' => 'text/xml'
|
26
26
|
last_response.body.should include '<ToUserName><![CDATA[fromUser]]></ToUserName>'
|
27
27
|
last_response.body.should include '<Title><![CDATA[title]]></Title>'
|
28
28
|
end
|
@@ -43,7 +43,7 @@ describe 'app' do
|
|
43
43
|
}]
|
44
44
|
end
|
45
45
|
|
46
|
-
post '/', TEXT_MESSAGE_REQUEST, 'CONTENT_TYPE' => 'text/xml'
|
46
|
+
post '/weixin', TEXT_MESSAGE_REQUEST, 'CONTENT_TYPE' => 'text/xml'
|
47
47
|
last_response.body.should include '<ToUserName><![CDATA[fromUser]]></ToUserName>'
|
48
48
|
last_response.body.should include '<Title><![CDATA[title]]></Title>'
|
49
49
|
last_response.body.should include '<Title><![CDATA[title1]]></Title>'
|
@@ -54,7 +54,7 @@ describe 'app' do
|
|
54
54
|
"location event: #{params[:Latitude]}"
|
55
55
|
end
|
56
56
|
|
57
|
-
post '/', LOCATION_EVENT_REQUEST, 'CONTENT_TYPE' => 'text/xml'
|
57
|
+
post '/weixin', LOCATION_EVENT_REQUEST, 'CONTENT_TYPE' => 'text/xml'
|
58
58
|
last_response.body.should include '<ToUserName><![CDATA[fromUser]]></ToUserName>'
|
59
59
|
last_response.body.should include '<Content><![CDATA[location event: 23.137466]]></Content>'
|
60
60
|
end
|
@@ -64,7 +64,7 @@ describe 'app' do
|
|
64
64
|
'Thank you for subscribe!'
|
65
65
|
end
|
66
66
|
|
67
|
-
post '/', SUBSCRIBE_EVENT_REQUEST, 'CONTENT_TYPE' => 'text/xml'
|
67
|
+
post '/weixin', SUBSCRIBE_EVENT_REQUEST, 'CONTENT_TYPE' => 'text/xml'
|
68
68
|
last_response.body.should include '<ToUserName><![CDATA[fromUser]]></ToUserName>'
|
69
69
|
last_response.body.should include '<Content><![CDATA[Thank you for subscribe!]]></Content>'
|
70
70
|
end
|
@@ -76,7 +76,7 @@ describe 'app' do
|
|
76
76
|
|
77
77
|
WeiBackend::MessageDispatcher.token 'combustest'
|
78
78
|
|
79
|
-
post '
|
79
|
+
post '/weixin?signature=0d144fa22f4119dbb2f6fe9710f3b732fb45092b×tamp=1388674716&nonce=1388564676', SUBSCRIBE_EVENT_REQUEST, 'CONTENT_TYPE' => 'text/xml', 'token' => 'token'
|
80
80
|
last_response.body.should include '<ToUserName><![CDATA[fromUser]]></ToUserName>'
|
81
81
|
last_response.body.should include '<Content><![CDATA[Thank you for subscribe!]]></Content>'
|
82
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wei-backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wang Chao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|