class Biostars::API::Post

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

Attributes

answer_count[R]

@return [Fixnum] number of answers.

author[R]

@return [String] author name.

author_id[R]

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

book_count[R]

@return [Fixnum] number of bookmarks.

comment_count[R]

@return [Fixnum] number of comments.

creation_date[R]

@return [String] creation date, ISO 8601 format.

has_accepted[R]

@return [Boolean] true if the question has an accepted answer, boolean.

id[R]

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

lastedit_date[R]

@return [String] date of last edit, ISO 8601 format.

lastedit_user_id[R]

@return [Fixnum] user who last edited this post.

parent_id[R]

@return [Fixnum] identifier of the parent post.

rank[R]

@return [Fixnum] rank, a number.

reply_count[R]

@return [Fixnum] number of replies.

root_id[R]

@return [Fixnum] identifier of the root post.

status[R]

@return [String] status message.

status_id[R]

@return [Fixnum] status’ identifier, a number.

subs_count[R]

@return [Fixnum] number of subscribers following this post.

tag_val[R]

@return [String] tags.

thread_score[R]

@return [Fixnum] thread’s score.

title[R]

@return [String] title.

type[R]

@return [String] type of post.

type_id[R]

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

url[R]

@return [String] url.

view_count[R]

@return [Fixnum] number of views.

vote_count[R]

@return [Fixnum] number of votes.

xhtml[R]

@return [String] content.

Public Class Methods

find(id) click to toggle source

Finds post with the given id.

@param id [Fixnum] post id. @return [Post] returns Post object. @raise [Biostars::PostError] if Post is not found.

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

Instantiate the Biostars::API::Post.

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