OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/api/v3/attachments/attachments_api.rb

31 lines
623 B

module API
module V3
module Attachments
class AttachmentsAPI < Grape::API
resources :attachments do
params do
requires :id, desc: 'Attachment id'
end
namespace ':id' do
before do
@attachment = Attachment.find(params[:id])
model = ::API::V3::Attachments::AttachmentModel.new(@attachment)
@representer = ::API::V3::Attachments::AttachmentRepresenter.new(model)
end
get do
@representer.to_json
end
end
end
end
end
end
end