|
|
|
@ -1,15 +1,15 @@ |
|
|
|
|
# User model |
|
|
|
|
class User < EntityModel |
|
|
|
|
attr_reader :email, :name, :bio_text, :avatar_url, :pw_hash, :reputation |
|
|
|
|
attr_reader :email, :name, :bio_text, :balance, :avatar_url, :pw_hash, :reputation |
|
|
|
|
|
|
|
|
|
def initialize(data) |
|
|
|
|
super data |
|
|
|
|
@email = data["email"] |
|
|
|
|
@name = data["name"] |
|
|
|
|
@bio_text = data["bio_text"] |
|
|
|
|
@balance = data["balance"] |
|
|
|
|
@balance = data["balance"].to_f |
|
|
|
|
@avatar_url = data["avatar_url"] |
|
|
|
|
@reputation = data["reputation"] |
|
|
|
|
@reputation = data["reputation"].to_f |
|
|
|
|
@pw_hash = data["pw_hash"] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -17,10 +17,6 @@ class User < EntityModel |
|
|
|
|
return @avatar_url |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def balance |
|
|
|
|
@balance.to_f |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def role |
|
|
|
|
user_roles = roles |
|
|
|
|
if user_roles.length > 0 then |
|
|
|
|