steam-condenser 0.14.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/Gemfile +3 -0
  2. data/Gemfile.lock +22 -0
  3. data/LICENSE +1 -1
  4. data/README.md +14 -6
  5. data/Rakefile +35 -0
  6. data/lib/{stringio_additions.rb → core_ext/stringio.rb} +1 -1
  7. data/lib/{exceptions/packet_format_exception.rb → errors/packet_format_error.rb} +5 -5
  8. data/lib/{exceptions/rcon_ban_exception.rb → errors/rcon_ban_error.rb} +5 -5
  9. data/lib/{exceptions/rcon_no_auth_exception.rb → errors/rcon_no_auth_error.rb} +5 -5
  10. data/lib/{exceptions/steam_condenser_exception.rb → errors/steam_condenser_error.rb} +3 -3
  11. data/lib/errors/timeout_error.rb +28 -0
  12. data/lib/{exceptions/web_api_exception.rb → errors/web_api_error.rb} +8 -8
  13. data/lib/steam/community/alien_swarm/alien_swarm_mission.rb +86 -11
  14. data/lib/steam/community/alien_swarm/alien_swarm_stats.rb +38 -15
  15. data/lib/steam/community/alien_swarm/alien_swarm_weapon.rb +29 -8
  16. data/lib/steam/community/app_news.rb +91 -27
  17. data/lib/steam/community/cacheable.rb +65 -21
  18. data/lib/steam/community/css/css_map.rb +39 -9
  19. data/lib/steam/community/css/css_stats.rb +32 -12
  20. data/lib/steam/community/css/css_weapon.rb +46 -10
  21. data/lib/steam/community/defense_grid/defense_grid_stats.rb +129 -17
  22. data/lib/steam/community/dods/dods_class.rb +66 -10
  23. data/lib/steam/community/dods/dods_stats.rb +20 -7
  24. data/lib/steam/community/dods/dods_weapon.rb +35 -24
  25. data/lib/steam/community/game_achievement.rb +50 -19
  26. data/lib/steam/community/game_class.rb +16 -5
  27. data/lib/steam/community/game_inventory.rb +37 -4
  28. data/lib/steam/community/game_item.rb +64 -3
  29. data/lib/steam/community/game_stats.rb +81 -16
  30. data/lib/steam/community/game_weapon.rb +29 -11
  31. data/lib/steam/community/l4d/abstract_l4d_stats.rb +91 -65
  32. data/lib/steam/community/l4d/abstract_l4d_weapon.rb +38 -8
  33. data/lib/steam/community/l4d/l4d2_map.rb +30 -5
  34. data/lib/steam/community/l4d/l4d2_stats.rb +83 -45
  35. data/lib/steam/community/l4d/l4d2_weapon.rb +20 -6
  36. data/lib/steam/community/l4d/l4d_explosive.rb +13 -5
  37. data/lib/steam/community/l4d/l4d_map.rb +35 -7
  38. data/lib/steam/community/l4d/l4d_stats.rb +23 -10
  39. data/lib/steam/community/l4d/l4d_weapon.rb +11 -7
  40. data/lib/steam/community/portal2/portal2_inventory.rb +4 -0
  41. data/lib/steam/community/portal2/portal2_item.rb +13 -1
  42. data/lib/steam/community/portal2/portal2_stats.rb +10 -6
  43. data/lib/steam/community/steam_game.rb +74 -0
  44. data/lib/steam/community/steam_group.rb +48 -14
  45. data/lib/steam/community/steam_id.rb +295 -64
  46. data/lib/steam/community/tf2/tf2_class.rb +66 -7
  47. data/lib/steam/community/tf2/tf2_class_factory.rb +14 -7
  48. data/lib/steam/community/tf2/tf2_engineer.rb +26 -6
  49. data/lib/steam/community/tf2/tf2_golden_wrench.rb +37 -10
  50. data/lib/steam/community/tf2/tf2_inventory.rb +4 -0
  51. data/lib/steam/community/tf2/tf2_item.rb +13 -1
  52. data/lib/steam/community/tf2/tf2_medic.rb +20 -5
  53. data/lib/steam/community/tf2/tf2_sniper.rb +15 -5
  54. data/lib/steam/community/tf2/tf2_spy.rb +20 -6
  55. data/lib/steam/community/tf2/tf2_stats.rb +20 -6
  56. data/lib/steam/community/web_api.rb +50 -32
  57. data/lib/steam/packets/c2m_checkmd5_packet.rb +1 -1
  58. data/lib/steam/packets/m2a_server_batch_packet.rb +3 -2
  59. data/lib/steam/packets/m2s_requestrestart_packet.rb +3 -3
  60. data/lib/steam/packets/rcon/rcon_packet_factory.rb +4 -4
  61. data/lib/steam/packets/request_with_challenge.rb +1 -1
  62. data/lib/steam/packets/s2a_info_base_packet.rb +1 -1
  63. data/lib/steam/packets/s2a_info_detailed_packet.rb +10 -10
  64. data/lib/steam/packets/s2a_player_packet.rb +5 -1
  65. data/lib/steam/packets/s2a_rules_packet.rb +4 -3
  66. data/lib/steam/packets/s2m_heartbeat2_packet.rb +2 -2
  67. data/lib/steam/packets/steam_packet.rb +1 -1
  68. data/lib/steam/packets/steam_packet_factory.rb +12 -16
  69. data/lib/steam/servers/game_server.rb +38 -32
  70. data/lib/steam/servers/goldsrc_server.rb +10 -1
  71. data/lib/steam/servers/master_server.rb +42 -21
  72. data/lib/steam/servers/server.rb +4 -5
  73. data/lib/steam/servers/source_server.rb +20 -5
  74. data/lib/steam/sockets/goldsrc_socket.rb +53 -22
  75. data/lib/steam/sockets/master_server_socket.rb +14 -4
  76. data/lib/steam/sockets/rcon_socket.rb +39 -6
  77. data/lib/steam/sockets/source_socket.rb +19 -15
  78. data/lib/steam/sockets/steam_socket.rb +33 -23
  79. data/lib/steam/steam_player.rb +86 -11
  80. data/lib/steam-condenser/community.rb +24 -24
  81. data/lib/steam-condenser/servers.rb +2 -2
  82. data/lib/steam-condenser/version.rb +3 -3
  83. data/steam-condenser.gemspec +23 -0
  84. data/test/query_tests.rb +12 -12
  85. data/test/rcon_tests.rb +3 -3
  86. data/test/steam/communtiy/steam_community_test_suite.rb +12 -0
  87. data/test/steam/communtiy/steam_group_tests.rb +6 -5
  88. data/test/steam/communtiy/steam_id_tests.rb +6 -5
  89. data/test/steam_community_tests.rb +3 -3
  90. data/test/stringio_additions_tests.rb +7 -7
  91. metadata +61 -43
  92. data/lib/exceptions/timeout_exception.rb +0 -24
  93. data/test/datagram_channel_tests.rb +0 -42
  94. data/test/socket_channel_tests.rb +0 -43
@@ -1,20 +1,41 @@
1
- # This code is free software; you can redistribute it and/or modify it under the
2
- # terms of the new BSD License.
1
+ # This code is free software; you can redistribute it and/or modify it under
2
+ # the terms of the new BSD License.
3
3
  #
4
- # Copyright (c) 2010, Sebastian Staudt
4
+ # Copyright (c) 2010-2011, Sebastian Staudt
5
5
 
6
6
  require 'steam/community/game_weapon'
7
7
 
8
- # AlienSwarmWeapon holds statistical information about weapons used by a player
9
- # in Alien Swarm.
8
+ # This class holds statistical information about weapons used by a player
9
+ # in Alien Swarm
10
+ #
11
+ # @author Sebastian Staudt
10
12
  class AlienSwarmWeapon
11
13
 
12
14
  include GameWeapon
13
15
 
14
- attr_reader :accuracy, :damage, :friendly_fire, :name, :shots
16
+ # Returns the accuracy of the player with this weapon
17
+ #
18
+ # @return [Float] The accuracy of the player with this weapon
19
+ attr_reader :accuracy
20
+
21
+ # Returns the damage achieved with this weapon
22
+ #
23
+ # @return [Fixnum] The damage achieved with this weapon
24
+ attr_reader :damage
25
+
26
+ # Returns the damage dealt to team mates with this weapon
27
+ #
28
+ # @return [Fixnum] The damage dealt to team mates with this weapon
29
+ attr_reader :friendly_fire
30
+
31
+ # Returns the name of this weapon
32
+ #
33
+ # @return [String] The name of this weapon
34
+ attr_reader :name
15
35
 
16
- # Creates a new instance of AlienSwarmWeapon based on the assigned weapon
17
- # XML data
36
+ # Creates a new weapon instance based on the assigned weapon XML data
37
+ #
38
+ # @param [REXML::Element] weapon_data The data representing this weapon
18
39
  def initialize(weapon_data)
19
40
  super
20
41
 
@@ -1,61 +1,125 @@
1
- # This code is free software; you can redistribute it and/or modify it under the
2
- # terms of the new BSD License.
1
+ # This code is free software; you can redistribute it and/or modify it under
2
+ # the terms of the new BSD License.
3
3
  #
4
- # Copyright (c) 2010, Sebastian Staudt
4
+ # Copyright (c) 2010-2011, Sebastian Staudt
5
5
 
6
- require 'json'
6
+ require 'multi_json'
7
7
 
8
8
  require 'steam/community/web_api'
9
9
 
10
- # The AppNews class is a representation of Steam news and can be used to load
11
- # current news about specific games
10
+ # This class represents Steam news and can be used to load a list of current
11
+ # news about specific games
12
+ #
13
+ # @author Sebastian Staudt
12
14
  class AppNews
13
15
 
14
- attr_reader :app_id, :author, :contents, :date, :feed_label, :feed_name,
15
- :gid, :title, :url
16
+ # Returns the Steam Application ID of the game this news belongs to
17
+ #
18
+ # @return [Fixnum] The application ID of the game this news belongs to
19
+ attr_reader :app_id
20
+
21
+ # Returns the name of the author of this news
22
+ #
23
+ # @return [String] The author of this news
24
+ attr_reader :author
25
+
26
+ # Returns the contents of this news
27
+ #
28
+ # This might contain HTML code.
29
+ #
30
+ # @note Depending on the setting for the maximum length of a news (see
31
+ # {.news_for_app}), the contents might be truncated.
32
+ # @return [String] The contents of this news
33
+ attr_reader :contents
34
+
35
+ # Returns the date this news item has been published
36
+ #
37
+ # @return [Time] The date this news has been published
38
+ attr_reader :date
39
+
40
+ # Returns the name of the feed this news item belongs to
41
+ #
42
+ # @return [String] The name of the feed this news belongs to
43
+ attr_reader :feed_label
44
+
45
+ # Returns the symbolic name of the feed this news item belongs to
46
+ #
47
+ # @return [String] The symbolic name of the feed this news belongs to
48
+ attr_reader :feed_name
49
+
50
+ # Returns a unique identifier for this news
51
+ #
52
+ # @return [Fixnum] A unique identifier for this news
53
+ attr_reader :gid
54
+
55
+ # Returns the title of this news
56
+ #
57
+ # @return [String] The title of this news
58
+ attr_reader :title
59
+
60
+ # Returns the URL of the original news
61
+ #
62
+ # This is a direct link to the news on the Steam website or a redirecting
63
+ # link to the external post.
64
+ #
65
+ # @return [String] The URL of the original news
66
+ attr_reader :url
16
67
 
17
68
  # Loads the news for the given game with the given restrictions
18
69
  #
19
- # [+app_id+] The unique Steam Application ID of the game (e.g. +440+ for
20
- # Team Fortress 2). See
21
- # http://developer.valvesoftware.com/wiki/Steam_Application_IDs
22
- # for all application IDs
23
- # [+count+] The maximum number of news to load (default: 5). There's no
24
- # reliable way to load all news. Use really a really great
25
- # number instead
26
- # [+max_length+] The maximum content length of the news (default: nil). If a
27
- # maximum length is defined, the content of the news will only
28
- # be at most +max_length+ characters long plus an ellipsis
70
+ # @param [Fixnum] app_id The unique Steam Application ID of the game (e.g.
71
+ # `440` for Team Fortress 2). See
72
+ # http://developer.valvesoftware.com/wiki/Steam_Application_IDs for
73
+ # all application IDs.
74
+ # @param [Fixnum] count The maximum number of news to load. There's no
75
+ # reliable way to load all news. Use a really great number instead.
76
+ # @param [Fixnum] max_length The maximum content length of the news. If a
77
+ # maximum length is defined, the content of the news will only be at
78
+ # most `max_length` characters long plus an ellipsis.
79
+ # @return [Array<AppNews>] An array of news items for the specified game with
80
+ # the given options
29
81
  def self.news_for_app(app_id, count = 5, max_length = nil)
30
82
  params = { :appid => app_id, :count => count, :maxlength => max_length }
31
- data = WebApi.json('ISteamNews', 'GetNewsForApp', 1, params)
83
+ data = WebApi.json('ISteamNews', 'GetNewsForApp', 2, params)
32
84
 
33
85
  news_items = []
34
- JSON.parse(data, { :symbolize_names => true })[:appnews][:newsitems][:newsitem].each do |news_data|
86
+ MultiJson.decode(data, { :symbolize_keys => true })[:appnews][:newsitems].each do |news_data|
35
87
  news_items << AppNews.new(app_id, news_data)
36
88
  end
37
89
 
38
90
  news_items
39
91
  end
40
92
 
41
- # Returns whether this news items originates from a source other than Steam
93
+ # Returns whether this news item originates from a source other than Steam
42
94
  # itself (e.g. an external blog)
95
+ #
96
+ # @return [Boolean] `true` if this news item is from an external source
43
97
  def external?
44
98
  @external
45
99
  end
46
100
 
101
+ # Returns a simple textual representation of this news item
102
+ #
103
+ # Will consist of the name of the feed this news belongs to and the title of
104
+ # the news.
105
+ #
106
+ # @return [String] A simple text representing this news
107
+ def to_s
108
+ "#{@feed_label}: #{@title}"
109
+ end
110
+
47
111
  private
48
112
 
49
113
  # Creates a new instance of an AppNews news item with the given data
50
114
  #
51
- # [+app_id+] The unique Steam Application ID of the game (e.g. +440+ for
52
- # Team Fortress 2). See
53
- # http://developer.valvesoftware.com/wiki/Steam_Application_IDs
54
- # for all application IDs
55
- # [+news_data+] The news data extracted from JSON
115
+ # @param [Fixnum] app_id The unique Steam Application ID of the game (e.g.
116
+ # `440` for Team Fortress 2). See
117
+ # http://developer.valvesoftware.com/wiki/Steam_Application_IDs for
118
+ # all application IDs.
119
+ # @param [Hash<Symbol, Object>] news_data The news data extracted from JSON
56
120
  def initialize(app_id, news_data)
57
121
  @app_id = app_id
58
- @author = news_data[:autor]
122
+ @author = news_data[:author]
59
123
  @contents = news_data[:contents].strip
60
124
  @data = Time.at(news_data[:date])
61
125
  @external = news_data[:is_external_url]
@@ -1,14 +1,26 @@
1
- # This code is free software; you can redistribute it and/or modify it under the
2
- # terms of the new BSD License.
1
+ # This code is free software; you can redistribute it and/or modify it under
2
+ # the terms of the new BSD License.
3
3
  #
4
- # Copyright (c) 2009, Sebastian Staudt
4
+ # Copyright (c) 2009-2011, Sebastian Staudt
5
5
 
6
- # This module implements caching functionality to be used in any object using a
7
- # +fetch+ method to fetch data, e.g. using a HTTP download.
6
+ # This module implements caching functionality to be used in any object class
7
+ # having one or more unique object identifier (i.e. ID) and using a `fetch`
8
+ # method to fetch data, e.g. using a HTTP download.
9
+ #
10
+ # @author Sebastian Staudt
8
11
  module Cacheable
9
12
 
10
- def self.included(base) #:nodoc:
11
-
13
+ # When this module is included in another class it is initialized to make use
14
+ # of caching
15
+ #
16
+ # The original `new` method of the including class will be aliased with
17
+ # `create`, relaying all instantiations to the `new` method defined in
18
+ # {ClassMethods}. Additionally the class variable to save the attributes to
19
+ # cache (i.e. cache IDs) and the cache class variable itself are initialized.
20
+ #
21
+ # @param [Class] base The class to extend with caching functionality
22
+ # @see ClassMethods
23
+ def self.included(base)
12
24
  base.extend ClassMethods
13
25
  base.send :class_variable_set, :@@cache, {}
14
26
  base.send :class_variable_set, :@@cache_ids, []
@@ -16,32 +28,50 @@ module Cacheable
16
28
  class << base
17
29
  alias_method :create, :new
18
30
  end
19
-
20
31
  end
21
32
 
33
+ # This module implements functionality to access the cache of a class that
34
+ # includes the {Cacheable} module as class methods
35
+ #
36
+ # @author Sebastian Staudt
22
37
  module ClassMethods
23
38
 
24
- # Defines wich instance variables should be used to index the cached objects
25
- # A call to this method is needed, if you want a class including this module
26
- # to really use the cache.
39
+ # Defines wich instance variables which should be used to index the cached
40
+ # objects
41
+ #
42
+ # @note A call to this method is needed if you want a class including this
43
+ # module to really use the cache.
44
+ # @param [Array<Symbol>] ids The symbolic names of the instance variables
45
+ # representing a unique identifier for this object class
27
46
  def cacheable_with_ids(*ids)
28
47
  class_variable_set(:@@cache_ids, ids)
29
48
  end
30
49
 
31
- # Returns whether the requested object +id+ is already cached
50
+ # Returns whether an object with the given ID is already cached
51
+ #
52
+ # @param [Object] id The ID of the desired object
53
+ # @return [Boolean] `true` if the object with the given ID is already
54
+ # cached
32
55
  def cached?(id)
33
56
  id.downcase! if id.is_a? String
34
57
  class_variable_get(:@@cache).key?(id)
35
58
  end
36
59
 
37
- # Clears the object cache
60
+ # Clears the object cache for the class this method is called on
38
61
  def clear_cache
39
62
  class_variable_set :@@cache, {}
40
63
  end
41
64
 
42
- # This checks the cache for an existing object. If it exists it is returned.
43
- # Otherwise a new object is created.
44
- # Overrides the default constructor.
65
+ # This checks the cache for an existing object. If it exists it is
66
+ # returned, otherwise a new object is created.
67
+ # Overrides the default `new` method of the cacheable object class.
68
+ #
69
+ # @param [Object] id The ID of the object that should be loaded
70
+ # @param [Boolean] fetch whether the object's data should be retrieved
71
+ # @param [Boolean] bypass_cache whether the object should be loaded again
72
+ # even if it is already cached
73
+ # @see #cached?
74
+ # @see #fetch
45
75
  def new(id, fetch = true, bypass_cache = false)
46
76
  if cached?(id) && !bypass_cache
47
77
  object = class_variable_get(:@@cache)[id]
@@ -54,18 +84,25 @@ module Cacheable
54
84
 
55
85
  end
56
86
 
87
+ # Returns the time the object's data has been fetched the last time
88
+ #
89
+ # @return [Time] The time the object has been updated the last time
57
90
  attr_reader :fetch_time
58
91
 
59
- # Creates a new object for the given +id+, either numeric or
60
- # the custom URL specified by the user. If +fetch_now+ is +true+ (default),
61
- # fetch is used to load data into the object.
62
- # This method is overridden by Cacheable::ClassMethods#new.
92
+ # Creates a new object and fetches the associated data of the object if
93
+ # desired
94
+ #
95
+ # @note The real constructor of cacheable classes is {ClassMethods#new}.
96
+ # @param [Boolean] fetch_now If `true`, the object's {#fetch} method is
97
+ # called to retrieve its data
63
98
  def initialize(fetch_now = true) #:notnew:
64
99
  fetch if fetch_now
65
100
  cache
66
101
  end
67
102
 
68
103
  # Saves this object in the cache
104
+ #
105
+ # This will use the ID attributes selected for caching
69
106
  def cache
70
107
  cache = self.class.send :class_variable_get, :@@cache
71
108
  cache_ids = self.class.send :class_variable_get, :@@cache_ids
@@ -81,11 +118,18 @@ module Cacheable
81
118
  end
82
119
 
83
120
  # Sets the time this object has been fetched the last time
121
+ #
122
+ # @note This method should be overridden in cacheable object classes and
123
+ # should implement the logic to retrieve the object's data. The
124
+ # overriding method should always call `super` to have the fetch time
125
+ # up-to-date.
84
126
  def fetch
85
127
  @fetch_time = Time.now
86
128
  end
87
129
 
88
- # Returns whether the data for this SteamID has already been fetched
130
+ # Returns whether the data for this object has already been fetched
131
+ #
132
+ # @return [Boolean] `true` if this object's data is available
89
133
  def fetched?
90
134
  !@fetch_time.nil?
91
135
  end
@@ -1,17 +1,38 @@
1
- # This code is free software; you can redistribute it and/or modify it under the
2
- # terms of the new BSD License.
1
+ # This code is free software; you can redistribute it and/or modify it under
2
+ # the terms of the new BSD License.
3
3
  #
4
- # Copyright (c) 2010, Sebastian Staudt
4
+ # Copyright (c) 2010-2011, Sebastian Staudt
5
5
 
6
- # CSSMap holds statistical information about maps played by a player in
7
- # Counter-Strike: Source.
6
+ # Represents the stats for a Counter-Strike: Source map for a specific user
7
+ #
8
+ # @author Sebastian Staudt
8
9
  class CSSMap
9
10
 
10
- attr_reader :name, :rounds_lost, :rounds_played, :rounds_won,
11
- :rounds_won_percentage
11
+ # Returns the name of this map
12
+ #
13
+ # @return [String] The name of this map
14
+ attr_reader :name
15
+
16
+ # Returns the number of rounds the player has lost on this map
17
+ #
18
+ # @return [Fixnum] The number of rounds lost
19
+ attr_reader :rounds_lost
20
+
21
+ # Returns the number of rounds the player has played on this map
22
+ #
23
+ # @return [Fixnum] The number of rounds played
24
+ attr_reader :rounds_played
12
25
 
13
- # Creates a new instance of CSSMap based on the assigned map name and XML
14
- # data
26
+ # Returns the number of rounds the player has won on this map
27
+ #
28
+ # @return [Fixnum] The number of rounds won
29
+ attr_reader :rounds_won
30
+
31
+ # Creates a new instance of a Counter-Strike: Source class based on the
32
+ # given XML data
33
+ #
34
+ # @param [String] map_name The name of the map
35
+ # @param [REXML::Element] maps_data The XML data of all maps
15
36
  def initialize(map_name, maps_data)
16
37
  @name = map_name
17
38
 
@@ -24,8 +45,17 @@ class CSSMap
24
45
  end
25
46
 
26
47
  # Returns whether this map is the favorite map of this player
48
+ #
49
+ # @return [Boolean] `true` if this is the favorite map
27
50
  def favorite?
28
51
  @favorite
29
52
  end
30
53
 
54
+ # Returns the percentage of rounds the player has won on this map
55
+ #
56
+ # @return [Float] The percentage of rounds won
57
+ def rounds_won_percentage
58
+ (@rounds_played > 0) ? @rounds_won.to_f / @rounds_played : 0
59
+ end
60
+
31
61
  end
@@ -1,29 +1,44 @@
1
- # This code is free software; you can redistribute it and/or modify it under the
2
- # terms of the new BSD License.
1
+ # This code is free software; you can redistribute it and/or modify it under
2
+ # the terms of the new BSD License.
3
3
  #
4
4
  # Copyright (c) 2010, Sebastian Staudt
5
5
 
6
6
  require 'steam/community/css/css_map'
7
7
  require 'steam/community/css/css_weapon'
8
8
 
9
- # The CSSStats class represents the game statistics for a single user in
9
+ # The is class represents the game statistics for a single user in
10
10
  # Counter-Strike: Source
11
+ #
12
+ # @author Sebastian Staudt
11
13
  class CSSStats < GameStats
12
14
 
15
+ # The names of the maps in Counter-Strike: Source
13
16
  MAPS = [ 'cs_assault', 'cs_compound', 'cs_havana', 'cs_italy', 'cs_militia',
14
17
  'cs_office', 'de_aztec', 'de_cbble', 'de_chateau', 'de_dust',
15
18
  'de_dust2', 'de_inferno', 'de_nuke', 'de_piranesi', 'de_port',
16
19
  'de_prodigy', 'de_tides', 'de_train' ]
17
20
 
21
+ # The names of the weapons in Counter-Strike: Source
18
22
  WEAPONS = [ 'deagle', 'usp', 'glock', 'p228', 'elite', 'fiveseven', 'awp',
19
23
  'ak47', 'm4a1', 'aug', 'sg552', 'sg550', 'galil', 'famas',
20
24
  'scout', 'g3sg1', 'p90', 'mp5navy', 'tmp', 'mac10', 'ump45',
21
25
  'm3', 'xm1014', 'm249', 'knife', 'grenade' ]
22
26
 
23
- attr_reader :last_match_stats, :total_stats
24
-
25
- # Creates a CSSStats object by calling the super constructor with the game
26
- # name "cs:s"
27
+ # Returns statistics about the last match the player played
28
+ #
29
+ # @return [Hash<Symbol, Object>] The stats of the last match
30
+ attr_reader :last_match_stats
31
+
32
+ # Returns overall statistics of this player
33
+ #
34
+ # @return [Hash<Symbol, Object>] The overall statistics
35
+ attr_reader :total_stats
36
+
37
+ # Creates a <var>CSSStats</var> instance by calling the super constructor
38
+ # with the game name <var>"cs:s"</var>
39
+ #
40
+ # @param [String, Fixnum] steam_id The custom URL or 64bit Steam ID of the
41
+ # user
27
42
  def initialize(steam_id)
28
43
  super steam_id, 'cs:s'
29
44
 
@@ -78,8 +93,11 @@ class CSSStats < GameStats
78
93
  end
79
94
  end
80
95
 
81
- # Returns a Hash of CSSMap for this user containing all Counter-Strike:
82
- # Source maps. If the maps haven't been parsed already, parsing is done now.
96
+ # Returns a map of `CSSMap` for this user containing all CS:S maps.
97
+ #
98
+ # If the maps haven't been parsed already, parsing is done now.
99
+ #
100
+ # @return [Hash<String, Object>] The map statistics for this user
83
101
  def map_stats
84
102
  return unless public?
85
103
 
@@ -95,9 +113,11 @@ class CSSStats < GameStats
95
113
  @map_stats
96
114
  end
97
115
 
98
- # Returns a Hash of CSSWeapon for this user containing all Counter-Strike:
99
- # Source weapons. If the weapons haven't been parsed already, parsing is done
100
- # now.
116
+ # Returns a map of `CSSWeapon` for this user containing all CS:S weapons.
117
+ #
118
+ # If the weapons haven't been parsed already, parsing is done now.
119
+ #
120
+ # @return [Hash<String, Object>] The weapon statistics for this user
101
121
  def weapon_stats
102
122
  return unless public?
103
123