summaryrefslogtreecommitdiff
path: root/lib/atlassian/jira_connect/serializers/author_entity.rb
blob: 9ab8e34c14b8aa3833cb29c91c92954c1e9b491d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

module Atlassian
  module JiraConnect
    module Serializers
      class AuthorEntity < Grape::Entity
        include Gitlab::Routing

        expose :name
        expose :email

        with_options(unless: -> (user) { user.is_a?(CommitEntity::CommitAuthor) }) do
          expose :username
          expose :url do |user|
            user_url(user)
          end
          expose :avatar do |user|
            user.avatar_url(only_path: false)
          end
        end
      end
    end
  end
end