Sha256: e469d51e697433ad04447dbe05d75ce30e45dfb7cbdafd182408b63a76b6b435

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

class TestingNotePresenter
  include AvatarHelper
  
  def initialize(testing_notes)
    @testing_notes = testing_notes
  end
  
  def as_json(*args)
    if @testing_notes.is_a?(TestingNote)
      to_hash @testing_notes
    else
      @testing_notes.map(&method(:to_hash))
    end
  end
  
  def to_hash(testing_note)
    { id: testing_note.id,
      createdAt: testing_note.created_at,
      avatarImage: avatar_for(testing_note.user),
      userId: testing_note.user_id,
      byTester: testing_note.user.try(:tester?),
      ticketId: testing_note.ticket_id,
      verdict: testing_note.verdict,
      comment: testing_note.comment }
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
houston-core-0.5.0.beta1 app/presenters/testing_note_presenter.rb