diff options
author | James Lopez <james@jameslopez.es> | 2016-11-15 12:33:01 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-11-17 10:22:58 +0300 |
commit | f5600997512f1068cdc36ad7d086e7447dbc6d9d (patch) | |
tree | d4e9daf14f35d6824fd0164f2e53b441f9422c3f /app/serializers | |
parent | 747e5c3b6fb6e744bc1fce04f94930fdbb5f9121 (diff) |
fix issue events and related spec - now using generic serializer for a hash
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/analytics_generic_entity.rb | 5 | ||||
-rw-r--r-- | app/serializers/analytics_generic_serializer.rb | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/app/serializers/analytics_generic_entity.rb b/app/serializers/analytics_generic_entity.rb index e8cad86030e..8c8a40cd90b 100644 --- a/app/serializers/analytics_generic_entity.rb +++ b/app/serializers/analytics_generic_entity.rb @@ -5,14 +5,13 @@ class AnalyticsGenericEntity < Grape::Entity expose :title expose :iid - expose :started_at, as: :date expose :author, using: UserEntity expose :total_time do |object| distance_of_time_in_words(object[:total_time].to_f) end - expose(:date) do |object| + expose(:created_at) do |object| interval_in_words(object[:created_at]) end @@ -22,7 +21,7 @@ class AnalyticsGenericEntity < Grape::Entity private - def url_to(route, id = nil) + def url_to(route, id) public_send("#{route}_url", request.project.namespace, request.project, id) end diff --git a/app/serializers/analytics_generic_serializer.rb b/app/serializers/analytics_generic_serializer.rb index 2347b56a1d6..9000e25a91d 100644 --- a/app/serializers/analytics_generic_serializer.rb +++ b/app/serializers/analytics_generic_serializer.rb @@ -1,3 +1,9 @@ class AnalyticsGenericSerializer < BaseSerializer entity AnalyticsGenericEntity + + def represent(resource, opts = {}) + resource.symbolize_keys! + + super(resource, opts) + end end |