Class: Biostars::API::User
- Inherits:
-
Object
- Object
- Biostars::API::User
- Defined in:
- lib/biostars/api/user.rb
Overview
General info about a user.
Instance Attribute Summary collapse
-
#date_joined ⇒ String
readonly
The date the user joined the website, as the number of days ago.
-
#id ⇒ Fixnum
readonly
The identifier of the user.
-
#joined_days_ago ⇒ String
readonly
The date the user joined the website, ISO 8601 format.
-
#last_login ⇒ String
readonly
The date of the last login of the user, ISO 8601 format.
-
#name ⇒ String
readonly
The name of the user.
-
#vote_count ⇒ Fixnum
readonly
The number of votes given by the user.
Class Method Summary collapse
-
.find(id) ⇒ User
Finds user with the given id.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ User
constructor
Instantiate the Biostars::API::User.
Constructor Details
#initialize(attributes) ⇒ User
Instantiate the Biostars::API::User.
27 28 29 30 31 |
# File 'lib/biostars/api/user.rb', line 27 def initialize(attributes) attributes.each do |k,v| instance_variable_set "@#{k}", v unless v.nil? end end |
Instance Attribute Details
#date_joined ⇒ String (readonly)
Returns the date the user joined the website, as the number of days ago.
9 10 11 |
# File 'lib/biostars/api/user.rb', line 9 def date_joined @date_joined end |
#id ⇒ Fixnum (readonly)
Returns the identifier of the user.
12 13 14 |
# File 'lib/biostars/api/user.rb', line 12 def id @id end |
#joined_days_ago ⇒ String (readonly)
Returns the date the user joined the website, ISO 8601 format.
15 16 17 |
# File 'lib/biostars/api/user.rb', line 15 def joined_days_ago @joined_days_ago end |
#last_login ⇒ String (readonly)
Returns the date of the last login of the user, ISO 8601 format.
18 19 20 |
# File 'lib/biostars/api/user.rb', line 18 def last_login @last_login end |
#name ⇒ String (readonly)
Returns the name of the user.
21 22 23 |
# File 'lib/biostars/api/user.rb', line 21 def name @name end |
#vote_count ⇒ Fixnum (readonly)
Returns the number of votes given by the user.
24 25 26 |
# File 'lib/biostars/api/user.rb', line 24 def vote_count @vote_count end |