Class: Vapor::User

Inherits:
Object
  • Object
show all
Defined in:
lib/vapor/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(steam_id) ⇒ User

Returns a new instance of User.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/vapor/user.rb', line 7

def initialize(steam_id)
  if steam_id =~ /steamcommunity\.com/
    steam_id = steam_id.match(/\/id\/(\w+)/)[1]
  end
  raise(InvalidUsernameError, steam_id) if steam_id =~ / /
  if steam_id.is_a? Integer || steam_id =~ /\A\d+\Z/
    @steam_id = steam_id
  else
    @steam_id = fetch_real_id steam_id
  end
  @steam_id = @steam_id.to_i
end

Instance Attribute Details

#steam_idObject (readonly)

Returns the value of attribute steam_id.



5
6
7
# File 'lib/vapor/user.rb', line 5

def steam_id
  @steam_id
end

Instance Method Details

#gamesObject



24
25
26
# File 'lib/vapor/user.rb', line 24

def games
  @games ||= GamesList.new(self).games
end

#profile_urlObject



20
21
22
# File 'lib/vapor/user.rb', line 20

def profile_url
  @profile_url ||= player_info[:profileurl]
end