summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2017-02-15 18:08:29 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2017-03-02 17:45:45 +0100
commit3d26a8d0b62f70e02917f7601bc2032fb3aed7e6 (patch)
treeb982f0762e2b495d05a1253b12c11806dd2cee44 /lib/api/entities.rb
parentb8ca9bc43a9504dad94a66630170ab6311eb5c09 (diff)
downloadgitlab-ce-3d26a8d0b62f70e02917f7601bc2032fb3aed7e6.tar.gz
Add jobs requesting API
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r--lib/api/entities.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 9dccaff369e..cb3b409b8d0 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -697,5 +697,43 @@ module API
expose :id, :message, :starts_at, :ends_at, :color, :font
expose :active?, as: :active
end
+
+ class ArtifactFile < Grape::Entity
+ expose :filename, :size
+ end
+
+ class JobCredentials < Grape::Entity
+ expose :type, :url, :username, :password
+ end
+
+ class JobResponse < Grape::Entity
+ expose :id, :ref, :tag, :sha, :status
+ expose :name, :token, :stage
+ expose :project_id
+ expose :project_name
+ expose :artifacts_file, using: ArtifactFile, if: ->(build, _) { build.artifacts? }
+ end
+
+ class RequestJobResponse < JobResponse
+ expose :commands
+ expose :repo_url
+ expose :before_sha
+ expose :allow_git_fetch
+ expose :token
+ expose :artifacts_expire_at, if: ->(build, _) { build.artifacts? }
+
+ expose :options do |model|
+ model.options
+ end
+
+ expose :timeout do |model|
+ model.timeout
+ end
+
+ expose :variables
+ expose :depends_on_builds, using: JobResponse
+
+ expose :credentials, using: JobCredentials
+ end
end
end