class Biostars::API::User

General info about a user. @author Arian Amador <arian@arianamador.com>

Attributes

date_joined[R]

@return [String] the date the user joined the website, as the number of days ago

id[R]

@return [Fixnum] the identifier of the user

joined_days_ago[R]

@return [String] the date the user joined the website, ISO 8601 format

last_login[R]

@return [String] the date of the last login of the user, ISO 8601 format

name[R]

@return [String] the name of the user.

vote_count[R]

@return [Fixnum] the number of votes given by the user.

Public Class Methods

find(id) click to toggle source

Finds user with the given id.

@param id [Fixnum] user id. @return [User] returns User object. @raise [Biostars::UserError] if User is not found.

# File lib/biostars/api/user.rb, line 38
def self.find(id)
        attributes = Biostars::API.get "user/#{id}"
        attributes ? new(attributes) : raise(Biostars::UserError)
end
new(attributes) click to toggle source

Instantiate the Biostars::API::User.

# 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