diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-02-22 21:15:40 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-02-22 21:15:40 -0500 |
commit | 67948368aec144ff7e9997ce184cb4d111622f08 (patch) | |
tree | c94e382fb1aca074b6ce503255564828cb387e36 /lib/api/entities.rb | |
parent | 608012629cc90337aba6c5bd4b2b73b530091fb0 (diff) | |
parent | 7c8099853621cc2a244bf6e0fd37a8b503d1ec5e (diff) | |
download | gitlab-ce-sidebar-sizing-higher-viewport.tar.gz |
Merge branch 'master' into sidebar-sizing-higher-viewportsidebar-sizing-higher-viewport
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r-- | lib/api/entities.rb | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index a9c09ffdb31..a3b5f1eb8d3 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -49,7 +49,7 @@ module API expose :enable_ssl_verification end - class ForkedFromProject < Grape::Entity + class BasicProjectDetails < Grape::Entity expose :id expose :name, :name_with_namespace expose :path, :path_with_namespace @@ -67,7 +67,7 @@ module API expose :shared_runners_enabled expose :creator_id expose :namespace - expose :forked_from_project, using: Entities::ForkedFromProject, if: lambda{ |project, options| project.forked? } + expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda{ |project, options| project.forked? } expose :avatar_url expose :star_count, :forks_count expose :open_issues_count, if: lambda { |project, options| project.issues_enabled? && project.default_issues_tracker? } @@ -377,6 +377,24 @@ module API expose :name end + class RunnerDetails < Runner + expose :tag_list + expose :version, :revision, :platform, :architecture + expose :contacted_at + expose :token, if: lambda { |runner, options| options[:current_user].is_admin? || !runner.is_shared? } + expose :projects, with: Entities::BasicProjectDetails do |runner, options| + if options[:current_user].is_admin? + runner.projects + else + options[:current_user].authorized_projects.where(id: runner.projects) + end + end + end + + class BuildArtifactFile < Grape::Entity + expose :filename, :size + end + class Build < Grape::Entity expose :id, :status, :stage, :name, :ref, :tag, :coverage expose :created_at, :started_at, :finished_at @@ -388,6 +406,7 @@ module API repo_obj.artifacts_download_url end end + expose :artifacts_file, using: BuildArtifactFile, if: -> (build, opts) { build.artifacts? } expose :commit, with: RepoCommit do |repo_obj, _options| if repo_obj.respond_to?(:commit) repo_obj.commit.commit_data |