23 lines
558 B
Ruby
23 lines
558 B
Ruby
module Mobile
|
|
module Entities
|
|
class Attachment < Grape::Entity
|
|
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)
|
|
f.send(field)
|
|
else
|
|
#case field
|
|
# when ""
|
|
#end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
attachment_expose :filename
|
|
attachment_expose :description
|
|
end
|
|
end
|
|
end |