wechat-callback 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +35 -0
- data/README.md +75 -3
- data/ROADMAP.md +9 -0
- data/_config.yml +1 -0
- data/bin/console +3 -3
- data/lib/wechat/callback.rb +0 -1
- data/lib/wechat/callback/message_decryption.rb +9 -0
- data/lib/wechat/callback/message_encryption.rb +9 -0
- data/lib/wechat/callback/message_signature.rb +13 -1
- data/lib/wechat/callback/random_byte_array.rb +12 -1
- data/lib/wechat/callback/secure_message.rb +20 -3
- data/lib/wechat/callback/signature.rb +13 -1
- data/lib/wechat/callback/version.rb +1 -1
- data/lib/wechat/callback/xml_document.rb +15 -1
- data/wechat-callback.gemspec +10 -14
- metadata +10 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef105a6836e585949081a3fcf3a7de5b1b0f81e1
|
4
|
+
data.tar.gz: 2e6cb59a7cae41d9828772043df9a93fd0e937fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cfef766eb57bd9d01016c30a45976e35eb9003b1e10c6a0bf655b27f625f9f77b82910d61829bf4717030b043b8031c780e2a9395f331d3baea3d0844ef44bd
|
7
|
+
data.tar.gz: 5c87cb1b46cd6496ce808e4b1eba4c1788c6917a49f292c9af32a8c1ee063c58bc5b9c78df15984c516cefdac8ee1c7ae2af1d5b1e1ce06121e64c3d1a540229
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -12,3 +12,12 @@
|
|
12
12
|
## v0.3
|
13
13
|
1. Random Byte Array class
|
14
14
|
2. Secure Message class
|
15
|
+
|
16
|
+
## v0.4
|
17
|
+
1. Improve the Message Decryption class for the argument validation
|
18
|
+
2. Improve the Message Encryption class for the argument validation
|
19
|
+
3. Improve the Message Signature class for the argument validation
|
20
|
+
4. Improve the Random Byte Array class for the argument validation
|
21
|
+
5. Improve the Secure Message class for the argument validation
|
22
|
+
6. Improve the Signature class for the argument validation
|
23
|
+
7. Improve the Xml Document class for the argument validation
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
wechat-callback (0.4)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.3)
|
10
|
+
rake (11.3.0)
|
11
|
+
rspec (3.5.0)
|
12
|
+
rspec-core (~> 3.5.0)
|
13
|
+
rspec-expectations (~> 3.5.0)
|
14
|
+
rspec-mocks (~> 3.5.0)
|
15
|
+
rspec-core (3.5.4)
|
16
|
+
rspec-support (~> 3.5.0)
|
17
|
+
rspec-expectations (3.5.0)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.5.0)
|
20
|
+
rspec-mocks (3.5.0)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.5.0)
|
23
|
+
rspec-support (3.5.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 1.11)
|
30
|
+
rake (~> 11.0)
|
31
|
+
rspec (~> 3.0)
|
32
|
+
wechat-callback!
|
33
|
+
|
34
|
+
BUNDLED WITH
|
35
|
+
1.13.6
|
data/README.md
CHANGED
@@ -1,10 +1,22 @@
|
|
1
1
|
# Wechat Callback 微信回调库
|
2
2
|
|
3
|
+
[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/wechat-callback/frames)
|
3
4
|
[![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
|
5
|
+
|
4
6
|
[![Gem Version](https://badge.fury.io/rb/wechat-callback.svg)](https://badge.fury.io/rb/wechat-callback)
|
7
|
+
[![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/wechat-callback.svg)](https://gemnasium.com/github.com/topbitdu/wechat-callback)
|
5
8
|
|
6
9
|
Wechat Callback Library is a code base to handle the callbacks from the Wechat servers.
|
7
|
-
|
10
|
+
微信回调库用于处理微信主动向服务器传回事件通知、即时消息等。
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
## Recent Update
|
15
|
+
|
16
|
+
Check out the [Road Map](ROADMAP.md) to find out what's the next.
|
17
|
+
Check out the [Change Log](CHANGELOG.md) to find out what's new.
|
18
|
+
|
19
|
+
|
8
20
|
|
9
21
|
## Installation
|
10
22
|
|
@@ -22,28 +34,88 @@ Or install it yourself as:
|
|
22
34
|
|
23
35
|
$ gem install wechat-callback
|
24
36
|
|
37
|
+
|
38
|
+
|
25
39
|
## Usage
|
26
40
|
|
41
|
+
__Gengerate Signature 生成参数签名__
|
27
42
|
```ruby
|
28
43
|
signature = Wechat::Callback::Signature.create token, timestamp, nonce, text_1, text_2, text_3
|
44
|
+
```
|
45
|
+
|
46
|
+
__Generate Message Signature 生成消息题签名__
|
47
|
+
```ruby
|
29
48
|
message_signature = Wechat::Callback::MessageSignature.create encoded_message, token, timestamp, nonce
|
49
|
+
```
|
30
50
|
|
51
|
+
__Parse XML Text into Hash 将XML文本解析成Hash__
|
52
|
+
```ruby
|
31
53
|
xml_document = Wechat::Callback::XmlDocument.load '<xml><FromUserID>FUID</FromUserID></xml>'
|
32
|
-
xml_text = Wechat::Callback::XmlDocument.create FromUserID: 'FUID', ToUserID: 'TUID' # <xml><FromUserID>FUID</FromUserID><ToUserID>TUID</ToUserID></xml>
|
33
54
|
```
|
34
55
|
|
56
|
+
__Convert Hash into XML Text 将Hash转换成XML文本__
|
57
|
+
```ruby
|
58
|
+
xml_text = Wechat::Callback::XmlDocument.create FromUserID: 'FUID', ToUserID: 'TUID'
|
59
|
+
```
|
60
|
+
The generated xml_text looks like
|
61
|
+
```xml
|
62
|
+
<xml><FromUserID>FUID</FromUserID><ToUserID>TUID</ToUserID></xml>
|
63
|
+
```
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
__Real Example for handling Wechat Message for Rails__
|
68
|
+
__微信上的“消息加解密方式”必须是“安全模式”,不能是“明文模式”或者“兼容模式”__
|
69
|
+
```ruby
|
70
|
+
if Wechat::Callback::Signature.create(wechat_token, timestamp, nonce)==params[:signature]
|
71
|
+
encoded_message = Wechat::Callback::XmlDocument.load(request.body.read)['Encrypt']
|
72
|
+
if Wechat::Callback::MessageSignature.create(encoded_message, Rails.application.secrets.wechat_validation_token, params[:timestamp], params[:nonce])==message_signature
|
73
|
+
message = Wechat::Callback::MessageDecryption.create encoded_message, Rails.application.secrets.wechat_encoding_aes_keys
|
74
|
+
random_bytes, xml_size, xml_text, app_id, padding_bytes = Wechat::Callback::SecureMessage.load message
|
75
|
+
if Rails.application.secrets.wechat_app_id==app_id
|
76
|
+
pairs = Wechat::Callback::XmlDocument.load xml_text
|
77
|
+
replying_pairs = {
|
78
|
+
'ToUserName' => pairs['FromUserName'],
|
79
|
+
'FromUserName' => pairs['ToUserName'],
|
80
|
+
'CreateTime' => Time.now.to_i,
|
81
|
+
'MsgType' => 'text',
|
82
|
+
'Content' => '您好!'
|
83
|
+
}
|
84
|
+
replying_xml_text = Wechat::Callback::XmlDocument.create replying_pairs
|
85
|
+
|
86
|
+
random_bytes = Wechat::Callback::RandomByteArray.create 16
|
87
|
+
plain_text = Wechat::Callback::SecureMessage.create random_bytes, replying_xml_text, Rails.application.secrets.wechat_app_id
|
88
|
+
encrypted = Wechat::Callback::MessageEncryption.create plain_text, Rails.application.secrets.wechat_encoding_aes_keys
|
89
|
+
replying_singature = Wechat::Callback::Signature.create Rails.application.secrets.wechat_validation_token, params[:timestamp], params[:nonce], encrypted
|
90
|
+
encrypted_replying_pairs = {
|
91
|
+
'Encrypt' => encrypted,
|
92
|
+
'MsgSignature' => replying_singature,
|
93
|
+
'TimeStamp' => params[:timestamp],
|
94
|
+
'Nonce' => params[:nonce]
|
95
|
+
}
|
96
|
+
replying_xml_text = Wechat::Callback::XmlDocument.create encrypted_replying_pairs
|
97
|
+
render status: 200, xml: replying_xml_text
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
```
|
102
|
+
|
103
|
+
|
104
|
+
|
35
105
|
## Development
|
36
106
|
|
37
107
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
38
108
|
|
39
109
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
40
110
|
|
111
|
+
|
112
|
+
|
41
113
|
## Contributing
|
42
114
|
|
43
115
|
Bug reports and pull requests are welcome on GitHub at https://github.com/topbitdu/wechat-callback. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
44
116
|
|
45
117
|
|
118
|
+
|
46
119
|
## License
|
47
120
|
|
48
121
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
49
|
-
|
data/ROADMAP.md
CHANGED
@@ -12,3 +12,12 @@
|
|
12
12
|
## v0.3
|
13
13
|
1. Random Byte Array class
|
14
14
|
2. Secure Message class
|
15
|
+
|
16
|
+
## v0.4
|
17
|
+
1. Improve the Message Decryption class for the argument validation
|
18
|
+
2. Improve the Message Encryption class for the argument validation
|
19
|
+
3. Improve the Message Signature class for the argument validation
|
20
|
+
4. Improve the Random Byte Array class for the argument validation
|
21
|
+
5. Improve the Secure Message class for the argument validation
|
22
|
+
6. Improve the Signature class for the argument validation
|
23
|
+
7. Improve the Xml Document class for the argument validation
|
data/_config.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
markdown: kramdown
|
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'wechat/callback'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "wechat/callback"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
data/lib/wechat/callback.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
+
##
|
2
|
+
# Message Decryption 是消息解密类。
|
3
|
+
|
1
4
|
class Wechat::Callback::MessageDecryption
|
2
5
|
|
6
|
+
extend Wechat::Core::Common
|
7
|
+
|
8
|
+
##
|
3
9
|
# 消息加解密
|
4
10
|
# http://mp.weixin.qq.com/wiki/6/90f7259c0d0739bbb41d9f4c4c8e59a2.html
|
5
11
|
#
|
@@ -9,6 +15,9 @@ class Wechat::Callback::MessageDecryption
|
|
9
15
|
#
|
10
16
|
def self.create(encoded_message, encoded_aes_keys)
|
11
17
|
|
18
|
+
assert_present! :encoded_message, encoded_message
|
19
|
+
assert_present! :encoded_aes_keys, encoded_aes_keys
|
20
|
+
|
12
21
|
encrypted_message = Base64.decode64(encoded_message).bytes.inject('') do |buffer, byte| buffer += [ byte ].pack 'C' end
|
13
22
|
aes_keys = encoded_aes_keys.map { |encoded_aes_key| Base64.decode64 "#{encoded_aes_key}=" }
|
14
23
|
|
@@ -1,5 +1,11 @@
|
|
1
|
+
##
|
2
|
+
# Message Encryption 是消息加密类。
|
3
|
+
|
1
4
|
class Wechat::Callback::MessageEncryption
|
2
5
|
|
6
|
+
extend Wechat::Core::Common
|
7
|
+
|
8
|
+
##
|
3
9
|
# 消息加解密
|
4
10
|
# http://mp.weixin.qq.com/wiki/6/90f7259c0d0739bbb41d9f4c4c8e59a2.html
|
5
11
|
#
|
@@ -7,6 +13,9 @@ class Wechat::Callback::MessageEncryption
|
|
7
13
|
# msg_encrypt=Base64_Encode(AES_Encrypt [random(16B)+ msg_len(4B) + msg + $AppId])
|
8
14
|
def self.create(plain_text, encoded_aes_keys)
|
9
15
|
|
16
|
+
assert_present! :plain_text, plain_text
|
17
|
+
assert_present! :encoded_aes_keys, encoded_aes_keys
|
18
|
+
|
10
19
|
cipher = OpenSSL::Cipher::AES.new(256, 'CBC')
|
11
20
|
cipher.encrypt
|
12
21
|
cipher.padding = 0
|
@@ -1,5 +1,10 @@
|
|
1
|
+
##
|
2
|
+
# Message Signature 是消息签名类。
|
3
|
+
|
1
4
|
class Wechat::Callback::MessageSignature
|
2
5
|
|
6
|
+
extend Wechat::Core::Common
|
7
|
+
|
3
8
|
# 消息加解密 技术方案
|
4
9
|
# http://mp.weixin.qq.com/wiki/6/90f7259c0d0739bbb41d9f4c4c8e59a2.html
|
5
10
|
#
|
@@ -12,7 +17,14 @@ class Wechat::Callback::MessageSignature
|
|
12
17
|
# nonce URL上原有参数,随机数
|
13
18
|
#
|
14
19
|
def self.create(encoded_message, token, timestamp, nonce)
|
15
|
-
|
20
|
+
|
21
|
+
assert_present! :encoded_message, encoded_message
|
22
|
+
assert_present! :token, token
|
23
|
+
assert_present! :timestamp, timestamp
|
24
|
+
assert_present! :nonce, nonce
|
25
|
+
|
26
|
+
Digest::SHA1.hexdigest [ token, timestamp, nonce, encoded_message ].sort.join
|
27
|
+
|
16
28
|
end
|
17
29
|
|
18
30
|
end
|
@@ -1,9 +1,20 @@
|
|
1
|
+
##
|
2
|
+
# Random Byte Array 用于生成指定长度的随机数组。
|
3
|
+
|
1
4
|
class Wechat::Callback::RandomByteArray
|
2
5
|
|
6
|
+
extend Wechat::Core::Common
|
7
|
+
|
3
8
|
LENGTH = 16
|
4
9
|
|
5
|
-
|
10
|
+
##
|
11
|
+
# 常见一个指定长度的随机字节数组。
|
12
|
+
def self.create(length = LENGTH)
|
13
|
+
|
14
|
+
assert_present! :length, length
|
15
|
+
|
6
16
|
[*0..255].sample length
|
17
|
+
|
7
18
|
end
|
8
19
|
|
9
20
|
end
|
@@ -1,16 +1,24 @@
|
|
1
|
+
##
|
2
|
+
# Secure Message 用于组合或者分解安全消息。
|
3
|
+
|
1
4
|
class Wechat::Callback::SecureMessage
|
2
5
|
|
6
|
+
extend Wechat::Core::Common
|
7
|
+
|
3
8
|
RANDOM_LENGTH = 16
|
4
9
|
XML_SIZE_LENGTH = 4
|
5
10
|
|
11
|
+
##
|
6
12
|
# 消息加解密
|
7
13
|
# http://mp.weixin.qq.com/wiki/6/90f7259c0d0739bbb41d9f4c4c8e59a2.html
|
8
14
|
#
|
9
15
|
# random(16B) + msg_len(4B) + msg + $AppId + padding
|
10
|
-
# padding: AES采用CBC模式,秘钥长度为32个字节,数据采用PKCS#7填充;PKCS#7:K为秘钥字节数(采用32),buf为待加密的内容,N为其字节数。Buf需要被填充为K的整数倍。在buf的尾部填充(K-N%K)个字节,每个字节的内容是(K- N%K);
|
16
|
+
# padding: AES采用CBC模式,秘钥长度为32个字节,数据采用PKCS#7填充;PKCS#7:K为秘钥字节数(采用32),buf为待加密的内容,N为其字节数。Buf需要被填充为K的整数倍。在buf的尾部填充(K-N%K)个字节,每个字节的内容是(K- N%K);
|
11
17
|
# 去掉rand_msg头部的16个随机字节,4个字节的msg_len,和尾部的$AppId即为最终的xml消息体
|
12
18
|
def self.load(message_decryption)
|
13
19
|
|
20
|
+
assert_present! :message_decryption, message_decryption
|
21
|
+
|
14
22
|
random_bytes = message_decryption[0..(RANDOM_LENGTH-1)].bytes
|
15
23
|
xml_size = message_decryption[RANDOM_LENGTH..(RANDOM_LENGTH+XML_SIZE_LENGTH-1)].reverse.unpack('l').first
|
16
24
|
|
@@ -27,11 +35,16 @@ class Wechat::Callback::SecureMessage
|
|
27
35
|
|
28
36
|
# 消息加解密
|
29
37
|
# http://mp.weixin.qq.com/wiki/6/90f7259c0d0739bbb41d9f4c4c8e59a2.html
|
30
|
-
#
|
38
|
+
#
|
31
39
|
# random(16B) + msg_len(4B) + msg + $AppId + padding
|
32
|
-
# padding: AES采用CBC模式,秘钥长度为32个字节,数据采用PKCS#7填充;PKCS#7:K为秘钥字节数(采用32),buf为待加密的内容,N为其字节数。Buf需要被填充为K的整数倍。在buf的尾部填充(K-N%K)个字节,每个字节的内容是(K- N%K);
|
40
|
+
# padding: AES采用CBC模式,秘钥长度为32个字节,数据采用PKCS#7填充;PKCS#7:K为秘钥字节数(采用32),buf为待加密的内容,N为其字节数。Buf需要被填充为K的整数倍。在buf的尾部填充(K-N%K)个字节,每个字节的内容是(K- N%K);
|
33
41
|
# 去掉rand_msg头部的16个随机字节,4个字节的msg_len,和尾部的$AppId即为最终的xml消息体
|
34
42
|
def self.create(random_bytes, xml_text, app_id)
|
43
|
+
|
44
|
+
assert_present! :random_bytes, random_bytes
|
45
|
+
assert_present! :xml_text, xml_text
|
46
|
+
assert_present! :app_id, app_id
|
47
|
+
|
35
48
|
xml_size_bytes = [ xml_text.bytes.length ].pack('l').reverse.bytes
|
36
49
|
buffer = random_bytes+xml_size_bytes+xml_text.bytes+app_id.bytes
|
37
50
|
padding_length = 32-buffer.length%32
|
@@ -40,6 +53,10 @@ class Wechat::Callback::SecureMessage
|
|
40
53
|
end
|
41
54
|
|
42
55
|
def self.byte_array_to_string(bytes)
|
56
|
+
|
57
|
+
assert_present! :bytes, bytes
|
58
|
+
#raise ArgumentError.new('The bytes argument is required.') if bytes.blank?
|
59
|
+
|
43
60
|
bytes.inject('') do |buffer, byte| buffer += [ byte ].pack 'C' end
|
44
61
|
end
|
45
62
|
|
@@ -1,5 +1,11 @@
|
|
1
|
+
##
|
2
|
+
# Singature 用于生成参数签名。
|
3
|
+
|
1
4
|
class Wechat::Callback::Signature
|
2
5
|
|
6
|
+
extend Wechat::Core::Common
|
7
|
+
|
8
|
+
##
|
3
9
|
# 验证服务器地址的有效性
|
4
10
|
# http://mp.weixin.qq.com/wiki/17/2d4265491f12608cd170a95559800f2d.html#.E7.AC.AC.E4.BA.8C.E6.AD.A5.EF.BC.9A.E9.AA.8C.E8.AF.81.E6.9C.8D.E5.8A.A1.E5.99.A8.E5.9C.B0.E5.9D.80.E7.9A.84.E6.9C.89.E6.95.88.E6.80.A7
|
5
11
|
#
|
@@ -13,7 +19,13 @@ class Wechat::Callback::Signature
|
|
13
19
|
# 3. 开发者获得加密后的字符串可与signature对比,标识该请求来源于微信
|
14
20
|
#
|
15
21
|
def self.create(token, timestamp, nonce, *args)
|
16
|
-
|
22
|
+
|
23
|
+
assert_present! :token, token
|
24
|
+
assert_present! :timestamp, timestamp
|
25
|
+
assert_present! :nonce, nonce
|
26
|
+
|
27
|
+
Digest::SHA1.hexdigest [ token, nonce, timestamp, *args ].sort.join
|
28
|
+
|
17
29
|
end
|
18
30
|
|
19
31
|
end
|
@@ -1,20 +1,34 @@
|
|
1
|
+
##
|
2
|
+
# XML Document 用于转换 Hash 格式的数据结构和 XML 文档。
|
3
|
+
|
1
4
|
class Wechat::Callback::XmlDocument
|
2
5
|
|
6
|
+
extend Wechat::Core::Common
|
7
|
+
|
8
|
+
##
|
3
9
|
# 消息加解密 技术方案
|
4
10
|
# http://mp.weixin.qq.com/wiki/6/90f7259c0d0739bbb41d9f4c4c8e59a2.html
|
5
11
|
def self.load(xml_text)
|
12
|
+
|
13
|
+
assert_present! :xml_text, xml_text
|
14
|
+
|
6
15
|
pairs = {}
|
7
|
-
|
16
|
+
Nokogiri::XML(xml_text).xpath('/xml').first.children.each do |element| pairs[element.name] = element.text end
|
8
17
|
pairs
|
18
|
+
|
9
19
|
end
|
10
20
|
|
11
21
|
# 消息加解密 技术方案
|
12
22
|
# http://mp.weixin.qq.com/wiki/6/90f7259c0d0739bbb41d9f4c4c8e59a2.html
|
13
23
|
def self.create(pairs)
|
24
|
+
|
25
|
+
assert_present! :pairs, pairs
|
26
|
+
|
14
27
|
xml = '<xml>'
|
15
28
|
pairs.each do |name, value| xml << "<#{name}><![CDATA[#{value}]]></#{name}>" end
|
16
29
|
xml << '</xml>'
|
17
30
|
xml
|
31
|
+
|
18
32
|
end
|
19
33
|
|
20
34
|
end
|
data/wechat-callback.gemspec
CHANGED
@@ -4,16 +4,14 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'wechat/callback/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
|
8
|
-
spec.
|
9
|
-
spec.
|
10
|
-
spec.
|
11
|
-
spec.
|
12
|
-
|
13
|
-
spec.
|
14
|
-
spec.
|
15
|
-
spec.homepage = "https://github.com/topbitdu/wechat-callback"
|
16
|
-
spec.license = 'MIT'
|
7
|
+
spec.name = 'wechat-callback'
|
8
|
+
spec.version = Wechat::Callback::VERSION
|
9
|
+
spec.authors = [ 'Topbit Du' ]
|
10
|
+
spec.email = [ 'topbit.du@gmail.com' ]
|
11
|
+
spec.summary = 'Wechat Callback Library 微信回调库'
|
12
|
+
spec.description = 'Wechat Callback Library is a code base to handle the remote calls from the Wechat servers. 微信回调库用于处理微信服务器发出的请求。'
|
13
|
+
spec.homepage = 'https://github.com/topbitdu/wechat-callback'
|
14
|
+
spec.license = 'MIT'
|
17
15
|
|
18
16
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
19
17
|
# delete this section to allow pushing this gem to any host.
|
@@ -29,9 +27,7 @@ Gem::Specification.new do |spec|
|
|
29
27
|
spec.require_paths = [ 'lib' ]
|
30
28
|
|
31
29
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
32
|
-
spec.add_development_dependency 'rake',
|
33
|
-
spec.add_development_dependency 'rspec',
|
34
|
-
|
35
|
-
spec.add_dependency 'httpclient', '~> 2.7'
|
30
|
+
spec.add_development_dependency 'rake', '~> 11.0'
|
31
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
36
32
|
|
37
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wechat-callback
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '11.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '11.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,22 +52,8 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
|
56
|
-
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '2.7'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '2.7'
|
69
|
-
description: The Wechat Callback Library is a code base to handle the remote calls
|
70
|
-
from the Wechat servers.
|
55
|
+
description: Wechat Callback Library is a code base to handle the remote calls from
|
56
|
+
the Wechat servers. 微信回调库用于处理微信服务器发出的请求。
|
71
57
|
email:
|
72
58
|
- topbit.du@gmail.com
|
73
59
|
executables: []
|
@@ -80,10 +66,12 @@ files:
|
|
80
66
|
- CHANGELOG.md
|
81
67
|
- CODE_OF_CONDUCT.md
|
82
68
|
- Gemfile
|
69
|
+
- Gemfile.lock
|
83
70
|
- LICENSE.txt
|
84
71
|
- README.md
|
85
72
|
- ROADMAP.md
|
86
73
|
- Rakefile
|
74
|
+
- _config.yml
|
87
75
|
- bin/console
|
88
76
|
- bin/setup
|
89
77
|
- lib/wechat/callback.rb
|
@@ -116,8 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
104
|
version: '0'
|
117
105
|
requirements: []
|
118
106
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.4
|
107
|
+
rubygems_version: 2.6.4
|
120
108
|
signing_key:
|
121
109
|
specification_version: 4
|
122
|
-
summary: Wechat Callback Library
|
110
|
+
summary: Wechat Callback Library 微信回调库
|
123
111
|
test_files: []
|