CQHTTP 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/CQHTTP/version.rb +1 -1
- metadata +2 -3
- data/lib/CQHTTP/qq.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32f5a329e4ce5dc8b0472737f61d828a43e95c6f
|
4
|
+
data.tar.gz: 959f0d0984d8121fe4e525a618aba376f712cae9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d487d975cfcf243045d29bdaf35c7702907e7867d2074cb22d6f075bcfc30807a7a3f173bf6e9d68b9ac493e4f2d4fb41734c655d853b1a660ae7bbd19ed0f3
|
7
|
+
data.tar.gz: e02241186ec51057dd9b82636876503c1094e01f241a8cdeb11b0ac30a4df68714dcee21b8e4df5816505ac8681bf5b438b7db494b16eda5f4ea7f010b87357f
|
data/README.md
CHANGED
data/lib/CQHTTP/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: CQHTTP
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 71e6fd52
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,7 +73,6 @@ files:
|
|
73
73
|
- lib/CQHTTP/API.md
|
74
74
|
- lib/CQHTTP/api.rb
|
75
75
|
- lib/CQHTTP/network.rb
|
76
|
-
- lib/CQHTTP/qq.rb
|
77
76
|
- lib/CQHTTP/version.rb
|
78
77
|
homepage: https://github.com/71e6fd52/cqhttp-ruby
|
79
78
|
licenses: []
|
data/lib/CQHTTP/qq.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
#
|
2
|
-
class QQ
|
3
|
-
include QQAPI
|
4
|
-
attr_reader :json
|
5
|
-
|
6
|
-
def initialize(hostname: '0.0.0.0', port: 9455)
|
7
|
-
@server = TCPServer.new(hostname, port)
|
8
|
-
@event_method = []
|
9
|
-
end
|
10
|
-
|
11
|
-
def bind(func)
|
12
|
-
@event_method << func
|
13
|
-
end
|
14
|
-
|
15
|
-
def run
|
16
|
-
loop do
|
17
|
-
socket = @server.accept
|
18
|
-
|
19
|
-
head socket
|
20
|
-
|
21
|
-
socket.print "HTTP/1.1 204\r\nContent-Type: application/json\r\n\r\n"
|
22
|
-
data = socket.gets
|
23
|
-
@json = JSON.parse data
|
24
|
-
|
25
|
-
@event_method.each { |func| func.call self }
|
26
|
-
|
27
|
-
socket.close
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def head(socket)
|
34
|
-
puts 'head'
|
35
|
-
while (line = socket.gets) != "\r\n"
|
36
|
-
put line
|
37
|
-
end
|
38
|
-
puts 'end'
|
39
|
-
end
|
40
|
-
|
41
|
-
def put(text)
|
42
|
-
print ' '
|
43
|
-
puts text
|
44
|
-
end
|
45
|
-
end
|