diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-09 18:09:01 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-09 18:09:01 +0000 |
commit | e16c0f461fcacffa4e56cf44f9563261d6b5c080 (patch) | |
tree | b1895c8de25d0c7a573b4df59f879cd263f009b5 /lib | |
parent | 1804227b4fb012858930b66419b026a5bf8b8f7d (diff) | |
download | gitlab-ce-e16c0f461fcacffa4e56cf44f9563261d6b5c080.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 34 | ||||
-rw-r--r-- | lib/api/entities/avatar.rb | 11 | ||||
-rw-r--r-- | lib/api/entities/award_emoji.rb | 13 | ||||
-rw-r--r-- | lib/api/entities/commit_note.rb | 14 | ||||
-rw-r--r-- | lib/api/entities/commit_status.rb | 11 | ||||
-rw-r--r-- | lib/api/entities/mr_note.rb | 10 |
6 files changed, 59 insertions, 34 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 122b2c40623..98c0f78de1f 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -129,40 +129,6 @@ module API end end - class Avatar < Grape::Entity - expose :avatar_url do |avatarable, options| - avatarable.avatar_url(only_path: false, size: options[:size]) - end - end - - class AwardEmoji < Grape::Entity - expose :id - expose :name - expose :user, using: Entities::UserBasic - expose :created_at, :updated_at - expose :awardable_id, :awardable_type - end - - class MRNote < Grape::Entity - expose :note - expose :author, using: Entities::UserBasic - end - - class CommitNote < Grape::Entity - expose :note - expose(:path) { |note| note.diff_file.try(:file_path) if note.diff_note? } - expose(:line) { |note| note.diff_line.try(:new_line) if note.diff_note? } - expose(:line_type) { |note| note.diff_line.try(:type) if note.diff_note? } - expose :author, using: Entities::UserBasic - expose :created_at - end - - class CommitStatus < Grape::Entity - expose :id, :sha, :ref, :status, :name, :target_url, :description, - :created_at, :started_at, :finished_at, :allow_failure, :coverage - expose :author, using: Entities::UserBasic - end - class PushEventPayload < Grape::Entity expose :commit_count, :action, :ref_type, :commit_from, :commit_to, :ref, :commit_title, :ref_count diff --git a/lib/api/entities/avatar.rb b/lib/api/entities/avatar.rb new file mode 100644 index 00000000000..7d5c762afcc --- /dev/null +++ b/lib/api/entities/avatar.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module API + module Entities + class Avatar < Grape::Entity + expose :avatar_url do |avatarable, options| + avatarable.avatar_url(only_path: false, size: options[:size]) + end + end + end +end diff --git a/lib/api/entities/award_emoji.rb b/lib/api/entities/award_emoji.rb new file mode 100644 index 00000000000..da9a183bf39 --- /dev/null +++ b/lib/api/entities/award_emoji.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module API + module Entities + class AwardEmoji < Grape::Entity + expose :id + expose :name + expose :user, using: Entities::UserBasic + expose :created_at, :updated_at + expose :awardable_id, :awardable_type + end + end +end diff --git a/lib/api/entities/commit_note.rb b/lib/api/entities/commit_note.rb new file mode 100644 index 00000000000..d08b6fc8225 --- /dev/null +++ b/lib/api/entities/commit_note.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module API + module Entities + class CommitNote < Grape::Entity + expose :note + expose(:path) { |note| note.diff_file.try(:file_path) if note.diff_note? } + expose(:line) { |note| note.diff_line.try(:new_line) if note.diff_note? } + expose(:line_type) { |note| note.diff_line.try(:type) if note.diff_note? } + expose :author, using: Entities::UserBasic + expose :created_at + end + end +end diff --git a/lib/api/entities/commit_status.rb b/lib/api/entities/commit_status.rb new file mode 100644 index 00000000000..61b8bf89cfe --- /dev/null +++ b/lib/api/entities/commit_status.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module API + module Entities + class CommitStatus < Grape::Entity + expose :id, :sha, :ref, :status, :name, :target_url, :description, + :created_at, :started_at, :finished_at, :allow_failure, :coverage + expose :author, using: Entities::UserBasic + end + end +end diff --git a/lib/api/entities/mr_note.rb b/lib/api/entities/mr_note.rb new file mode 100644 index 00000000000..283f7bd1092 --- /dev/null +++ b/lib/api/entities/mr_note.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module API + module Entities + class MRNote < Grape::Entity + expose :note + expose :author, using: Entities::UserBasic + end + end +end |