Class: CommentPresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/comment_presenter.rb

Instance Method Summary collapse

Methods inherited from BasePresenter

as_collection

Constructor Details

#initialize(comment) ⇒ CommentPresenter

Returns a new instance of CommentPresenter


2
3
4
# File 'app/presenters/comment_presenter.rb', line 2

def initialize(comment)
  @comment = comment
end

Instance Method Details

#as_json(opts = {}) ⇒ Object


6
7
8
9
10
11
12
13
14
# File 'app/presenters/comment_presenter.rb', line 6

def as_json(opts={})
  {
    :id => @comment.id,
    :guid => @comment.guid,
    :text  => @comment.text,
    :author => @comment.author.as_api_response(:backbone),
    :created_at => @comment.created_at
  }
end