entities.rb 1.2 KB
Newer Older
D
Douwe Maan 已提交
1 2 3 4
module Ci
  module API
    module Entities
      class Commit < Grape::Entity
K
Kamil Trzcinski 已提交
5
        expose :id, :sha, :project_id, :created_at
D
Douwe Maan 已提交
6 7 8 9 10 11 12 13
        expose :status, :finished_at, :duration
        expose :git_commit_message, :git_author_name, :git_author_email
      end

      class CommitWithBuilds < Commit
        expose :builds
      end

K
Kamil Trzcinski 已提交
14 15 16 17
      class ArtifactFile < Grape::Entity
        expose :filename, :size
      end

D
Douwe Maan 已提交
18
      class Build < Grape::Entity
K
Kamil Trzcinski 已提交
19
        expose :id, :commands, :ref, :sha, :status, :project_id, :repo_url,
20 21
          :before_sha, :allow_git_fetch, :project_name

K
Kamil Trzcinski 已提交
22 23
        expose :name, :token, :stage

V
Valery Sizov 已提交
24 25 26
        expose :options do |model|
          model.options
        end
V
Valery Sizov 已提交
27 28 29 30

        expose :timeout do |model|
          model.timeout
        end
D
Douwe Maan 已提交
31 32

        expose :variables
K
Kamil Trzcinski 已提交
33
        expose :artifacts_file, using: ArtifactFile
D
Douwe Maan 已提交
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
      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
        expose :commit, using: Commit
      end
    end
  end
end