Class: Buildkite::Pipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/buildkite/models/pipeline.rb

Class Method Summary collapse

Methods inherited from Object

#initialize, #to_ostruct

Constructor Details

This class inherits a constructor from Buildkite::Object

Class Method Details

.archive(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline) ⇒ Object



27
28
29
30
# File 'lib/buildkite/models/pipeline.rb', line 27

def archive(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline)
  response = Client.post_request("organizations/#{org}/pipelines/#{pipeline}/archive", body: {})
  Pipeline.new response.body
end

.create(org: Buildkite.config.org, name:, repository:, configuration:, **args) ⇒ Object



16
17
18
19
20
# File 'lib/buildkite/models/pipeline.rb', line 16

def create(org: Buildkite.config.org, name:, repository:, configuration:, **args)
  data = {name: name, repository: repository, configuration: configuration}
  response = Client.post_request("organizations/#{org}/pipelines", body: data.merge(args))
  Pipeline.new response.body
end

.delete(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline) ⇒ Object



37
38
39
# File 'lib/buildkite/models/pipeline.rb', line 37

def delete(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline)
  Client.delete_request("organizations/#{org}/pipelines/#{pipeline}")
end

.list(org: Buildkite.config.org) ⇒ Object



6
7
8
9
# File 'lib/buildkite/models/pipeline.rb', line 6

def list(org: Buildkite.config.org)
  response = Client.get_request("organizations/#{org}/pipelines")
  Collection.from_response(response, type: Pipeline)
end

.retrieve(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline) ⇒ Object



11
12
13
14
# File 'lib/buildkite/models/pipeline.rb', line 11

def retrieve(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline)
  response = Client.get_request("organizations/#{org}/pipelines/#{pipeline}")
  Pipeline.new response.body
end

.unarchive(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline) ⇒ Object



32
33
34
35
# File 'lib/buildkite/models/pipeline.rb', line 32

def unarchive(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline)
  response = Client.post_request("organizations/#{org}/pipelines/#{pipeline}/unarchive", body: {})
  Pipeline.new response.body
end

.update(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline, **args) ⇒ Object



22
23
24
25
# File 'lib/buildkite/models/pipeline.rb', line 22

def update(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline, **args)
  response = Client.patch_request("organizations/#{org}/pipelines/#{pipeline}", body: args)
  Pipeline.new response.body
end

.webhook(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline) ⇒ Object



41
42
43
# File 'lib/buildkite/models/pipeline.rb', line 41

def webhook(org: Buildkite.config.org, pipeline: Buildkite.config.pipeline)
  Client.post_request("organizations/#{org}/pipelines/#{pipeline}/webhook", body: {})
end