Class: SteamClient::Profile
- Inherits:
-
Object
- Object
- SteamClient::Profile
- Defined in:
- lib/steam-client/profile.rb
Instance Attribute Summary collapse
-
#avatarFull ⇒ Object
Returns the value of attribute avatarFull.
-
#avatarIcon ⇒ Object
Returns the value of attribute avatarIcon.
-
#avatarMedium ⇒ Object
Returns the value of attribute avatarMedium.
-
#customURL ⇒ Object
Returns the value of attribute customURL.
-
#friends ⇒ Object
Returns the value of attribute friends.
-
#games ⇒ Object
Returns the value of attribute games.
-
#hoursPlayed2Wk ⇒ Object
Returns the value of attribute hoursPlayed2Wk.
-
#location ⇒ Object
Returns the value of attribute location.
-
#onlineState ⇒ Object
Returns the value of attribute onlineState.
-
#realname ⇒ Object
Returns the value of attribute realname.
-
#steamID ⇒ Object
Returns the value of attribute steamID.
-
#steamID64 ⇒ Object
Returns the value of attribute steamID64.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(steamID64 = nil) ⇒ Profile
constructor
A new instance of Profile.
Constructor Details
#initialize(steamID64 = nil) ⇒ Profile
Returns a new instance of Profile.
23 24 25 26 27 |
# File 'lib/steam-client/profile.rb', line 23 def initialize(steamID64 = nil) self.steamID64 = steamID64 @friends = [] @games = [] end |
Instance Attribute Details
#avatarFull ⇒ Object
Returns the value of attribute avatarFull.
21 22 23 |
# File 'lib/steam-client/profile.rb', line 21 def avatarFull @avatarFull end |
#avatarIcon ⇒ Object
Returns the value of attribute avatarIcon.
21 22 23 |
# File 'lib/steam-client/profile.rb', line 21 def avatarIcon @avatarIcon end |
#avatarMedium ⇒ Object
Returns the value of attribute avatarMedium.
21 22 23 |
# File 'lib/steam-client/profile.rb', line 21 def avatarMedium @avatarMedium end |
#customURL ⇒ Object
Returns the value of attribute customURL.
21 22 23 |
# File 'lib/steam-client/profile.rb', line 21 def customURL @customURL end |
#friends ⇒ Object
Returns the value of attribute friends.
21 22 23 |
# File 'lib/steam-client/profile.rb', line 21 def friends @friends end |
#games ⇒ Object
Returns the value of attribute games.
21 22 23 |
# File 'lib/steam-client/profile.rb', line 21 def games @games end |
#hoursPlayed2Wk ⇒ Object
Returns the value of attribute hoursPlayed2Wk.
21 22 23 |
# File 'lib/steam-client/profile.rb', line 21 def hoursPlayed2Wk @hoursPlayed2Wk end |
#location ⇒ Object
Returns the value of attribute location.
21 22 23 |
# File 'lib/steam-client/profile.rb', line 21 def location @location end |
#onlineState ⇒ Object
Returns the value of attribute onlineState.
21 22 23 |
# File 'lib/steam-client/profile.rb', line 21 def onlineState @onlineState end |
#realname ⇒ Object
Returns the value of attribute realname.
21 22 23 |
# File 'lib/steam-client/profile.rb', line 21 def realname @realname end |
#steamID ⇒ Object
Returns the value of attribute steamID.
21 22 23 |
# File 'lib/steam-client/profile.rb', line 21 def steamID @steamID end |
#steamID64 ⇒ Object
Returns the value of attribute steamID64.
21 22 23 |
# File 'lib/steam-client/profile.rb', line 21 def steamID64 @steamID64 end |
Class Method Details
.from_xml(xml) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/steam-client/profile.rb', line 29 def self.from_xml(xml) p = Crack::XML.parse(xml) if p.has_key? 'response' and p['response'].has_key? 'error' raise SteamClient::Error::ProfileNotFound end profile = Profile.new profile.steamID = p['profile']['steamID'] profile.steamID64 = p['profile']['steamID64'] profile.avatarIcon = p['profile']['avatarIcon'] profile.avatarMedium = p['profile']['avatarMedium'] profile.avatarFull = p['profile']['avatarFull'] profile.customURL = p['profile']['customURL'] profile.hoursPlayed2Wk = p['profile']['hoursPlayed2Wk'].to_f profile.location = p['profile']['location'] profile.realname = p['profile']['realname'] profile.friends = [] profile.games = [] case p['profile']['onlineState'] when 'online' profile.onlineState = SteamClient::OnlineState::ONLINE when 'offline' profile.onlineState = SteamClient::OnlineState::OFFLINE else profile.onlineState = SteamClient::OnlineState::UNKNOWN end return profile end |