diff options
author | Kamil TrzciĆski <ayufan@ayufan.eu> | 2017-11-28 10:48:24 +0000 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2017-12-14 11:57:55 +0100 |
commit | 1126fd04a7a157b89b2f439268c891b7b4068745 (patch) | |
tree | 37e5d8f80ee51b933644224dd521a5ba98649b3e /lib | |
parent | 3b971cf6d23ae52ca70237a9938093a4435d6a65 (diff) | |
download | gitlab-ce-1126fd04a7a157b89b2f439268c891b7b4068745.tar.gz |
Cherry pick lib/api/entities.rb from 763ea26dc6be7760e4084b57bcf56f32e3e9ef0a
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index bcc0f6f86c9..a15c6ba2897 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -80,16 +80,21 @@ module API expose :group_access, as: :group_access_level end - class BasicProjectDetails < Grape::Entity - expose :id, :description, :default_branch, :tag_list - expose :ssh_url_to_repo, :http_url_to_repo, :web_url + class ProjectIdentity < Grape::Entity + expose :id, :description expose :name, :name_with_namespace expose :path, :path_with_namespace + expose :created_at + end + + class BasicProjectDetails < ProjectIdentity + expose :default_branch, :tag_list + expose :ssh_url_to_repo, :http_url_to_repo, :web_url expose :avatar_url do |project, options| project.avatar_url(only_path: false) end expose :star_count, :forks_count - expose :created_at, :last_activity_at + expose :last_activity_at end class Project < BasicProjectDetails @@ -833,17 +838,24 @@ module API expose :id, :sha, :ref, :status end - class Job < Grape::Entity + class JobBasic < Grape::Entity expose :id, :status, :stage, :name, :ref, :tag, :coverage expose :created_at, :started_at, :finished_at expose :duration expose :user, with: User - expose :artifacts_file, using: JobArtifactFile, if: -> (job, opts) { job.artifacts? } expose :commit, with: Commit - expose :runner, with: Runner expose :pipeline, with: PipelineBasic end + class Job < JobBasic + expose :artifacts_file, using: JobArtifactFile, if: -> (job, opts) { job.artifacts? } + expose :runner, with: Runner + end + + class JobBasicWithProject < JobBasic + expose :project, with: ProjectIdentity + end + class Trigger < Grape::Entity expose :id expose :token, :description |