diff --git a/lib/api/entities.rb b/lib/api/entities.rb index b7ad16a..a5df120 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1,6 +1,10 @@ module API module Entities + Grape::Entity.format_with :timestamp do |date| + date.strftime('%Y/%m/%d %H:%M:%S') if date + end + class Image < Grape::Entity root 'images', 'image' @@ -22,7 +26,8 @@ module API end class Profile < Grape::Entity - expose :identifier, :name, :created_at, :id + expose :identifier, :name, :id + expose :created_at, :format_with => :timestamp expose :image, :using => Image end @@ -42,7 +47,8 @@ module API class Article < Grape::Entity root 'articles', 'article' - expose :id, :body, :created_at + expose :id, :body + expose :created_at, :format_with => :timestamp expose :title, :documentation => {:type => "String", :desc => "Title of the article"} expose :author, :using => Profile expose :profile, :using => Profile @@ -51,8 +57,8 @@ module API class Comment < Grape::Entity root 'comments', 'comment' - expose :body, :title, :created_at, :id - + expose :body, :title, :id + expose :created_at, :format_with => :timestamp expose :author, :using => Profile end diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 3d74e3a..f856b32 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -167,7 +167,7 @@ module API protected def start_log - logger.info "Started #{request.path}" + logger.info "Started #{request.path} #{request.params.except('password')}" end def end_log logger.info "Completed #{request.path}" -- libgit2 0.21.2