32 lines
846 B
Ruby
32 lines
846 B
Ruby
module Mobile
|
|
module Entities
|
|
class Attachment < Grape::Entity
|
|
include Redmine::I18n
|
|
def self.attachment_expose(field)
|
|
expose field do |f,opt|
|
|
if f.is_a?(Hash) && f.key?(field)
|
|
f[field]
|
|
elsif f.is_a?(::Attachment)
|
|
if f.respond_to?(field)
|
|
if field == :created_on
|
|
format_time(f.send(field))
|
|
else
|
|
f.send(field)
|
|
end
|
|
else
|
|
#case field
|
|
# when ""
|
|
#end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
attachment_expose :id
|
|
attachment_expose :filename
|
|
attachment_expose :description
|
|
attachment_expose :downloads
|
|
attachment_expose :quotes
|
|
attachment_expose :created_on
|
|
end
|
|
end
|
|
end |