Class: Vapor::User
- Inherits:
-
Object
- Object
- Vapor::User
- Defined in:
- lib/vapor/user.rb
Instance Attribute Summary collapse
-
#steam_id ⇒ Object
readonly
Returns the value of attribute steam_id.
Instance Method Summary collapse
- #games ⇒ Object
-
#initialize(steam_id) ⇒ User
constructor
A new instance of User.
- #profile_url ⇒ Object
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_id ⇒ Object (readonly)
Returns the value of attribute steam_id.
5 6 7 |
# File 'lib/vapor/user.rb', line 5 def steam_id @steam_id end |