class Biostars::API::Vote

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

Attributes

author[R]

@return [String] author name.

author_id[R]

@return [Fixnum] author’s identifier, a number.

date[R]

@return [String] date of the vote, ISO 8601 format.

id[R]

@return [Fixnum] identifier of the vote, a number.

post_id[R]

@return [Fixnum] identifier of the voted post.

type[R]

@return [String] type of vote.

type_id[R]

@return [Fixnum] type’s identifier for this vote.

Public Class Methods

find(id) click to toggle source

Finds vote with the given id.

@param id [Fixnum] vote id. @return [Vote] returns Vote object. @raise [Biostars::VoteError] if the Vote is not found.

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

Instantiate the Biostars::API::Vote.

# File lib/biostars/api/vote.rb, line 30
def initialize(attributes)
        attributes.each do |k,v| 
                instance_variable_set "@#{k}", v unless v.nil?
        end
end