steam-condenser 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +10 -7
- data/VERSION.yml +4 -0
- data/lib/byte_buffer.rb +28 -28
- data/lib/datagram_channel.rb +5 -4
- data/lib/exceptions/rcon_ban_exception.rb +12 -0
- data/lib/socket_channel.rb +21 -14
- data/lib/steam-condenser.rb +11 -0
- data/lib/steam/community/cacheable.rb +95 -0
- data/lib/steam/community/defense_grid/defense_grid_stats.rb +124 -0
- data/lib/steam/community/game_stats.rb +44 -26
- data/lib/steam/community/l4d/l4d_map.rb +3 -3
- data/lib/steam/community/steam_group.rb +77 -6
- data/lib/steam/community/steam_id.rb +127 -101
- data/lib/steam/community/tf2/tf2_stats.rb +5 -5
- data/lib/steam/packets/rcon/rcon_exec_response.rb +6 -8
- data/lib/steam/packets/s2a_rules_packet.rb +15 -8
- data/lib/steam/servers/game_server.rb +2 -4
- data/lib/steam/servers/goldsrc_server.rb +5 -5
- data/lib/steam/servers/source_server.rb +11 -11
- data/lib/steam/sockets/rcon_socket.rb +18 -17
- data/lib/steam/sockets/steam_socket.rb +5 -8
- data/lib/steam/steam_player.rb +5 -5
- data/test/byte_buffer_tests.rb +76 -0
- data/test/datagram_channel_tests.rb +42 -0
- data/test/query_tests.rb +1 -3
- data/test/rcon_tests.rb +1 -3
- data/test/socket_channel_tests.rb +43 -0
- data/test/steam/communtiy/steam_community_test_suite.rb +9 -0
- data/test/steam/communtiy/steam_group_tests.rb +43 -0
- data/test/steam/communtiy/steam_id_tests.rb +48 -0
- data/test/steam_community_tests.rb +17 -9
- metadata +27 -10
data/test/query_tests.rb
CHANGED
@@ -2,10 +2,8 @@
|
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
4
|
# Copyright (c) 2008-2009, Sebastian Staudt
|
5
|
-
#
|
6
|
-
# $Id$
|
7
5
|
|
8
|
-
$:.push File.join(File.dirname(__FILE__),
|
6
|
+
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
|
9
7
|
|
10
8
|
require "exceptions/timeout_exception"
|
11
9
|
require "ipaddr"
|
data/test/rcon_tests.rb
CHANGED
@@ -2,10 +2,8 @@
|
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
4
|
# Copyright (c) 2008-2009, Sebastian Staudt
|
5
|
-
#
|
6
|
-
# $Id$
|
7
5
|
|
8
|
-
$:.push File.join(File.dirname(__FILE__),
|
6
|
+
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
|
9
7
|
|
10
8
|
require "ipaddr"
|
11
9
|
require "steam/servers/goldsrc_server"
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under the
|
2
|
+
# terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2009, Sebastian Staudt
|
5
|
+
|
6
|
+
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
|
7
|
+
|
8
|
+
require 'test/unit'
|
9
|
+
|
10
|
+
require 'byte_buffer'
|
11
|
+
require 'socket_channel'
|
12
|
+
|
13
|
+
class SocketChannelTests < Test::Unit::TestCase
|
14
|
+
|
15
|
+
def test_read_write
|
16
|
+
port = rand(65536 - 1024) + 1024
|
17
|
+
|
18
|
+
server = TCPServer.new('localhost', port)
|
19
|
+
|
20
|
+
channel = SocketChannel.open
|
21
|
+
channel.connect Socket.getaddrinfo('localhost', port)
|
22
|
+
|
23
|
+
socket= server.accept
|
24
|
+
|
25
|
+
string = 'test'
|
26
|
+
|
27
|
+
buffer = ByteBuffer.wrap(string)
|
28
|
+
channel.write(buffer)
|
29
|
+
sent, socket_addr = socket.recvfrom(4)
|
30
|
+
socket.send(string, 0)
|
31
|
+
buffer = ByteBuffer.allocate(4)
|
32
|
+
channel.read(buffer)
|
33
|
+
|
34
|
+
channel.close
|
35
|
+
socket.close
|
36
|
+
|
37
|
+
received = buffer.array
|
38
|
+
|
39
|
+
assert_equal(string, sent)
|
40
|
+
assert_equal(string, received)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under the
|
2
|
+
# terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2009, Sebastian Staudt
|
5
|
+
|
6
|
+
$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
|
7
|
+
|
8
|
+
require "steam/community/steam_group"
|
9
|
+
require "test/unit"
|
10
|
+
|
11
|
+
class SteamGroupTests < Test::Unit::TestCase
|
12
|
+
|
13
|
+
def test_bypass_cache
|
14
|
+
SteamGroup.clear_cache
|
15
|
+
group = SteamGroup.new('valve')
|
16
|
+
fetch_time = group.fetch_time
|
17
|
+
sleep 1
|
18
|
+
group = SteamGroup.new('valve', true, true)
|
19
|
+
assert_operator(fetch_time, :<, group.fetch_time)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_cache
|
23
|
+
SteamGroup.clear_cache
|
24
|
+
group = SteamGroup.new('valve')
|
25
|
+
fetch_time = group.fetch_time
|
26
|
+
assert_equal(true, SteamGroup.cached?(103582791429521412))
|
27
|
+
assert_equal(true, SteamGroup.cached?('valve'))
|
28
|
+
sleep 1
|
29
|
+
group = SteamGroup.new('valve')
|
30
|
+
assert_equal(fetch_time, group.fetch_time)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_case_insensitivity
|
34
|
+
SteamGroup.clear_cache
|
35
|
+
group = SteamGroup.new('valve', false)
|
36
|
+
group2 = SteamGroup.new('Valve', false)
|
37
|
+
group3 = SteamGroup.new('VALVE', false)
|
38
|
+
assert_equal(true, SteamGroup.cached?('valve'))
|
39
|
+
assert_equal(group, group2)
|
40
|
+
assert_equal(group, group3)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under the
|
2
|
+
# terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2009, Sebastian Staudt
|
5
|
+
|
6
|
+
$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
|
7
|
+
|
8
|
+
require "steam/community/steam_id"
|
9
|
+
require "test/unit"
|
10
|
+
|
11
|
+
class SteamIdTests < Test::Unit::TestCase
|
12
|
+
|
13
|
+
def test_bypass_cache
|
14
|
+
SteamId.clear_cache
|
15
|
+
steam_id = SteamId.new('koraktor')
|
16
|
+
fetch_time = steam_id.fetch_time
|
17
|
+
sleep 1
|
18
|
+
steam_id = SteamId.new('koraktor', true, true)
|
19
|
+
assert_operator(fetch_time, :<, steam_id.fetch_time)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_cache
|
23
|
+
SteamId.clear_cache
|
24
|
+
steam_id = SteamId.new('koraktor')
|
25
|
+
fetch_time = steam_id.fetch_time
|
26
|
+
assert_equal(true, SteamId.cached?(76561197961384956))
|
27
|
+
assert_equal(true, SteamId.cached?('koraktor'))
|
28
|
+
sleep 1
|
29
|
+
steam_id = SteamId.new('koraktor')
|
30
|
+
assert_equal(fetch_time, steam_id.fetch_time)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_case_insensitivity
|
34
|
+
SteamId.clear_cache
|
35
|
+
steam_id = SteamId.new('koraktor', false)
|
36
|
+
steam_id2 = SteamId.new('Koraktor', false)
|
37
|
+
steam_id3 = SteamId.new('KORAKTOR', false)
|
38
|
+
assert_equal(true, SteamId.cached?('koraktor'))
|
39
|
+
assert_equal(steam_id, steam_id2)
|
40
|
+
assert_equal(steam_id, steam_id3)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_convert_steam_id_to_community_id
|
44
|
+
steam_id64 = SteamId.convert_steam_id_to_community_id('STEAM_0:0:12345')
|
45
|
+
assert_equal(76561197960290418, steam_id64)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -1,24 +1,32 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under the
|
2
2
|
# terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2008, Sebastian Staudt
|
5
|
-
#
|
6
|
-
# $Id$
|
4
|
+
# Copyright (c) 2008-2009, Sebastian Staudt
|
7
5
|
|
8
|
-
$:.push File.join(File.dirname(__FILE__),
|
6
|
+
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
|
9
7
|
|
10
8
|
require "steam/community/steam_id"
|
11
9
|
require "test/unit"
|
12
10
|
|
13
11
|
class SteamCommunityTests < Test::Unit::TestCase
|
14
|
-
|
12
|
+
|
13
|
+
def test_group_by_custom_url
|
14
|
+
group = SteamGroup.new('valve')
|
15
|
+
p group.member_count
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_group_by_groupid_64
|
19
|
+
group = SteamGroup.new(103582791429521412)
|
20
|
+
p group.member_count
|
21
|
+
end
|
22
|
+
|
15
23
|
# This test tries to aquire information from a online Steam ID by using the
|
16
24
|
# custom URL. This test only passes if the parsing of the XML document works
|
17
25
|
def test_steam_id_by_custom_url
|
18
26
|
assert_nothing_raised do
|
19
|
-
steam_id = SteamId.new
|
27
|
+
steam_id = SteamId.new('koraktor')
|
20
28
|
p steam_id
|
21
|
-
p steam_id.
|
29
|
+
p steam_id.game_stats('tf2')
|
22
30
|
end
|
23
31
|
end
|
24
32
|
|
@@ -27,9 +35,9 @@ class SteamCommunityTests < Test::Unit::TestCase
|
|
27
35
|
# document works
|
28
36
|
def test_steam_id_by_steamid_64
|
29
37
|
assert_nothing_raised do
|
30
|
-
steam_id = SteamId.new
|
38
|
+
steam_id = SteamId.new(76561197961384956)
|
31
39
|
p steam_id
|
32
|
-
p steam_id.
|
40
|
+
p steam_id.game_stats('tf2')
|
33
41
|
end
|
34
42
|
end
|
35
43
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steam-condenser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Staudt
|
@@ -9,11 +9,20 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-16 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hpricot
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0.6"
|
24
|
+
version:
|
25
|
+
description: A multi-language library for querying the Steam Community, Source, GoldSrc servers and Steam master servers
|
17
26
|
email: koraktor@gmail.com
|
18
27
|
executables: []
|
19
28
|
|
@@ -26,16 +35,20 @@ files:
|
|
26
35
|
- LICENSE
|
27
36
|
- README.md
|
28
37
|
- Rakefile
|
38
|
+
- VERSION.yml
|
29
39
|
- lib/abstract_class.rb
|
30
40
|
- lib/byte_buffer.rb
|
31
41
|
- lib/datagram_channel.rb
|
32
42
|
- lib/exceptions/buffer_underflow_exception.rb
|
33
43
|
- lib/exceptions/packet_format_exception.rb
|
44
|
+
- lib/exceptions/rcon_ban_exception.rb
|
34
45
|
- lib/exceptions/rcon_no_auth_exception.rb
|
35
46
|
- lib/exceptions/steam_condenser_exception.rb
|
36
47
|
- lib/exceptions/timeout_exception.rb
|
37
48
|
- lib/socket_channel.rb
|
38
49
|
- lib/steam-condenser.rb
|
50
|
+
- lib/steam/community/cacheable.rb
|
51
|
+
- lib/steam/community/defense_grid/defense_grid_stats.rb
|
39
52
|
- lib/steam/community/dods/dods_class.rb
|
40
53
|
- lib/steam/community/dods/dods_stats.rb
|
41
54
|
- lib/steam/community/dods/dods_weapon.rb
|
@@ -91,11 +104,17 @@ files:
|
|
91
104
|
- lib/steam/sockets/source_socket.rb
|
92
105
|
- lib/steam/sockets/steam_socket.rb
|
93
106
|
- lib/steam/steam_player.rb
|
107
|
+
- test/byte_buffer_tests.rb
|
108
|
+
- test/datagram_channel_tests.rb
|
94
109
|
- test/query_tests.rb
|
95
110
|
- test/rcon_tests.rb
|
111
|
+
- test/socket_channel_tests.rb
|
112
|
+
- test/steam/communtiy/steam_community_test_suite.rb
|
113
|
+
- test/steam/communtiy/steam_group_tests.rb
|
114
|
+
- test/steam/communtiy/steam_id_tests.rb
|
96
115
|
- test/steam_community_tests.rb
|
97
116
|
has_rdoc: true
|
98
|
-
homepage: http://github.com/
|
117
|
+
homepage: http://koraktor.github.com/steam-condenser
|
99
118
|
licenses: []
|
100
119
|
|
101
120
|
post_install_message:
|
@@ -126,7 +145,5 @@ rubygems_version: 1.3.5
|
|
126
145
|
signing_key:
|
127
146
|
specification_version: 3
|
128
147
|
summary: Steam Condenser - A Steam query library
|
129
|
-
test_files:
|
130
|
-
|
131
|
-
- test/rcon_tests.rb
|
132
|
-
- test/steam_community_tests.rb
|
148
|
+
test_files: []
|
149
|
+
|