entities.rb 1.53 KB
Newer Older
1 2 3 4
module Ci
  module API
    module Entities
      class Commit < Grape::Entity
5
        expose :id, :sha, :project_id, :created_at
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

14 15 16 17
      class ArtifactFile < Grape::Entity
        expose :filename, :size
      end

18
      class Build < Grape::Entity
19
        expose :id, :ref, :tag, :sha, :status
20
        expose :name, :token, :stage
21 22
        expose :project_id
        expose :project_name
23
        expose :artifacts_file, using: ArtifactFile, if: ->(build, _) { build.artifacts? }
24 25 26 27 28 29 30 31
      end

      class BuildDetails < Build
        expose :commands
        expose :repo_url
        expose :before_sha
        expose :allow_git_fetch
        expose :token
32
        expose :artifacts_expire_at, if: ->(build, _) { build.artifacts? }
33

Valery Sizov's avatar
Valery Sizov committed
34 35 36
        expose :options do |model|
          model.options
        end
Valery Sizov's avatar
Valery Sizov committed
37 38 39 40

        expose :timeout do |model|
          model.timeout
        end
41 42

        expose :variables
43
        expose :depends_on_builds, using: Build
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
      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
60
        expose :pipeline, using: Commit, as: :commit
61 62 63 64
      end
    end
  end
end