2015-08-26 01:42:46 +00:00
|
|
|
module Ci
|
|
|
|
module API
|
|
|
|
module Entities
|
|
|
|
class Commit < Grape::Entity
|
2015-10-06 10:01:16 +00:00
|
|
|
expose :id, :sha, :project_id, :created_at
|
2015-08-26 01:42:46 +00:00
|
|
|
expose :status, :finished_at, :duration
|
|
|
|
expose :git_commit_message, :git_author_name, :git_author_email
|
|
|
|
end
|
|
|
|
|
|
|
|
class CommitWithBuilds < Commit
|
|
|
|
expose :builds
|
|
|
|
end
|
|
|
|
|
2015-10-12 21:47:32 +00:00
|
|
|
class ArtifactFile < Grape::Entity
|
|
|
|
expose :filename, :size
|
|
|
|
end
|
|
|
|
|
2015-08-26 01:42:46 +00:00
|
|
|
class Build < Grape::Entity
|
2016-01-14 18:45:43 +00:00
|
|
|
expose :id, :ref, :tag, :sha, :status
|
2015-10-12 21:47:32 +00:00
|
|
|
expose :name, :token, :stage
|
2016-01-14 18:45:43 +00:00
|
|
|
expose :project_id
|
|
|
|
expose :project_name
|
2016-06-10 19:45:06 +00:00
|
|
|
expose :artifacts_file, using: ArtifactFile, if: ->(build, _) { build.artifacts? }
|
2016-01-14 18:45:43 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
class BuildDetails < Build
|
|
|
|
expose :commands
|
|
|
|
expose :repo_url
|
|
|
|
expose :before_sha
|
|
|
|
expose :allow_git_fetch
|
|
|
|
expose :token
|
2016-06-10 19:45:06 +00:00
|
|
|
expose :artifacts_expire_at, if: ->(build, _) { build.artifacts? }
|
2015-10-12 21:47:32 +00:00
|
|
|
|
2015-09-15 12:51:03 +00:00
|
|
|
expose :options do |model|
|
|
|
|
model.options
|
|
|
|
end
|
2015-09-14 08:15:54 +00:00
|
|
|
|
|
|
|
expose :timeout do |model|
|
|
|
|
model.timeout
|
|
|
|
end
|
2015-08-26 01:42:46 +00:00
|
|
|
|
|
|
|
expose :variables
|
2016-01-15 14:35:33 +00:00
|
|
|
expose :depends_on_builds, using: Build
|
2015-08-26 01:42:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
class Runner < Grape::Entity
|
|
|
|
expose :id, :token
|
|
|
|
end
|
|
|
|
|
|
|
|
class RunnerProject < Grape::Entity
|
|
|
|
expose :id, :project_id, :runner_id
|
|
|
|
end
|
|
|
|
|
|
|
|
class WebHook < Grape::Entity
|
|
|
|
expose :id, :project_id, :url
|
|
|
|
end
|
|
|
|
|
|
|
|
class TriggerRequest < Grape::Entity
|
|
|
|
expose :id, :variables
|
2016-06-10 11:58:33 +00:00
|
|
|
expose :pipeline, using: Commit, as: :commit
|
2015-08-26 01:42:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|