module FacultyAPI
  module V1
    class BookEntity < Grape::Entity
      expose(:id) { |book| book.id.to_s }
      expose :isbn
      expose :description
      expose :title
      expose(:image) { |book| book.image_url }
      expose :purchase_url
      expose(:authors) { |book| book.authors.to_a.join(', ')}
      expose(:faculty) { |book| book.bio_editions.to_a.map(&:slug)}
      expose :publish_date
    end
  end
end
