summaryrefslogtreecommitdiff
path: root/app/serializers/commit_entity.rb
blob: ce76659fa466c1d5a4d4a4f4252a1887caaa93f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

class CommitEntity < API::Entities::Commit
  include RequestAwareEntity

  expose :author, using: UserEntity

  expose :author_gravatar_url do |commit|
    GravatarService.new.execute(commit.author_email) # rubocop: disable CodeReuse/ServiceClass
  end

  expose :commit_url do |commit|
    project_commit_url(request.project, commit)
  end

  expose :commit_path do |commit|
    project_commit_path(request.project, commit)
  end
end