summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
diff options
context:
space:
mode:
authorRubén Dávila <rdavila84@gmail.com>2016-01-14 17:28:44 -0500
committerRubén Dávila <rdavila84@gmail.com>2016-01-14 17:28:44 -0500
commitc8db25c37c0d78457d06117497ccde7ad80e2321 (patch)
treedc2db4637c33c53b032a22f8e78975838396ed13 /lib/api/entities.rb
parent6b9c730e91962a6d6343bcb7fc4dc75c99b41bde (diff)
parent948bb655f3cba9909b7396c3062da7b22f4409b3 (diff)
downloadgitlab-ce-c8db25c37c0d78457d06117497ccde7ad80e2321.tar.gz
Merge branch 'master' into issue_3945
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r--lib/api/entities.rb37
1 files changed, 36 insertions, 1 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index f8511ac5f5c..82a75734de0 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -71,6 +71,7 @@ module API
expose :avatar_url
expose :star_count, :forks_count
expose :open_issues_count, if: lambda { |project, options| project.issues_enabled? && project.default_issues_tracker? }
+ expose :runners_token, if: lambda { |_project, options| options[:user_can_admin_project] }
end
class ProjectMember < UserBasic
@@ -166,7 +167,6 @@ module API
class MergeRequest < ProjectEntity
expose :target_branch, :source_branch
- # deprecated, always returns 0
expose :upvotes, :downvotes
expose :author, :assignee, using: Entities::UserBasic
expose :source_project_id, :target_project_id
@@ -366,5 +366,40 @@ module API
class TriggerRequest < Grape::Entity
expose :id, :variables
end
+
+ class Runner < Grape::Entity
+ expose :id
+ expose :description
+ expose :active
+ expose :is_shared
+ expose :name
+ end
+
+ class Build < Grape::Entity
+ expose :id, :status, :stage, :name, :ref, :tag, :coverage
+ expose :created_at, :started_at, :finished_at
+ expose :user, with: User
+ # TODO: download_url in Ci:Build model is an GitLab Web Interface URL, not API URL. We should think on some API
+ # for downloading of artifacts (see: https://gitlab.com/gitlab-org/gitlab-ce/issues/4255)
+ expose :download_url do |repo_obj, options|
+ if options[:user_can_download_artifacts]
+ repo_obj.download_url
+ end
+ end
+ expose :commit, with: RepoCommit do |repo_obj, _options|
+ if repo_obj.respond_to?(:commit)
+ repo_obj.commit.commit_data
+ end
+ end
+ expose :runner, with: Runner
+ end
+
+ class Trigger < Grape::Entity
+ expose :token, :created_at, :updated_at, :deleted_at, :last_used
+ end
+
+ class Variable < Grape::Entity
+ expose :key, :value
+ end
end
end