diff options
author | James Lopez <james@jameslopez.es> | 2016-11-15 15:23:17 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-11-17 10:22:58 +0300 |
commit | 73e9ec631995d5ed91a3eb5e8416c924e7d7c5ad (patch) | |
tree | 5048fdf732a43ed0ea0a51fc64e354df4e6177df /app/serializers | |
parent | 8743e59f78cd8f8701460796dcc06854281f3f73 (diff) |
serialize all the things!
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/analytics_commit_entity.rb | 14 | ||||
-rw-r--r-- | app/serializers/analytics_commit_serializer.rb | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/app/serializers/analytics_commit_entity.rb b/app/serializers/analytics_commit_entity.rb new file mode 100644 index 00000000000..a932d612e0f --- /dev/null +++ b/app/serializers/analytics_commit_entity.rb @@ -0,0 +1,14 @@ +class AnalyticsCommitEntity < CommitEntity + include RequestAwareEntity + include EntityDateHelper + + expose :short_id, as: :short_sha + + expose :total_time do |commit| + distance_of_time_in_words(request.total_time.to_f) + end + + unexpose :author_name + unexpose :author_email + unexpose :message +end diff --git a/app/serializers/analytics_commit_serializer.rb b/app/serializers/analytics_commit_serializer.rb new file mode 100644 index 00000000000..cdbfecf2b70 --- /dev/null +++ b/app/serializers/analytics_commit_serializer.rb @@ -0,0 +1,3 @@ +class AnalyticsCommitSerializer < BaseSerializer + entity AnalyticsCommitEntity +end |