summaryrefslogtreecommitdiff
path: root/lib/api/v3/entities.rb
diff options
context:
space:
mode:
authorMarcia Ramos <virtua.creative@gmail.com>2017-08-15 11:20:11 -0300
committerMarcia Ramos <virtua.creative@gmail.com>2017-08-15 11:20:11 -0300
commit35c9a75eff464ff7bb0e58c67488a6fa1bdebaaa (patch)
treeb78097fd10cad31f45b8b6613d45960f2872802c /lib/api/v3/entities.rb
parent0112d13314e1aea350c7dacc02c0f1c527566809 (diff)
parentfe09c25d68a61c5874e9beb0f018c05a4d789d70 (diff)
downloadgitlab-ce-docs-topic-permissions.tar.gz
Diffstat (limited to 'lib/api/v3/entities.rb')
-rw-r--r--lib/api/v3/entities.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/api/v3/entities.rb b/lib/api/v3/entities.rb
index 773f667abe0..a9a35f2a4bd 100644
--- a/lib/api/v3/entities.rb
+++ b/lib/api/v3/entities.rb
@@ -25,14 +25,24 @@ module API
expose(:downvote?) { |note| false }
end
+ class PushEventPayload < Grape::Entity
+ expose :commit_count, :action, :ref_type, :commit_from, :commit_to
+ expose :ref, :commit_title
+ end
+
class Event < Grape::Entity
expose :title, :project_id, :action_name
expose :target_id, :target_type, :author_id
- expose :data, :target_title
+ expose :target_title
expose :created_at
expose :note, using: Entities::Note, if: ->(event, options) { event.note? }
expose :author, using: ::API::Entities::UserBasic, if: ->(event, options) { event.author }
+ expose :push_event_payload,
+ as: :push_data,
+ using: PushEventPayload,
+ if: -> (event, _) { event.push? }
+
expose :author_username do |event, options|
event.author&.username
end
@@ -68,7 +78,7 @@ module API
expose :lfs_enabled?, as: :lfs_enabled
expose :creator_id
expose :namespace, using: 'API::Entities::Namespace'
- expose :forked_from_project, using: ::API::Entities::BasicProjectDetails, if: lambda{ |project, options| project.forked? }
+ expose :forked_from_project, using: ::API::Entities::BasicProjectDetails, if: lambda { |project, options| project.forked? }
expose :avatar_url do |user, options|
user.avatar_url(only_path: false)
end