Module: DroneCI::TemplatesAPI

Included in:
API
Defined in:
lib/drone-ci/api/templates.rb

Instance Method Summary collapse

Instance Method Details

#template_create(namespace, **body) ⇒ Object

Create a new template.

Please note this api requires write access to the repository.

Reference: docs.drone.io/api/templates/template_create/



10
11
12
# File 'lib/drone-ci/api/templates.rb', line 10

def template_create(namespace, **body)
  api.post("templates/#{namespace}", body)
end

#template_delete(namespace, name) ⇒ Object

Deletes a template.

Please note this api requires write access to the repository.

Reference: docs.drone.io/api/templates/template_delete/



19
20
21
# File 'lib/drone-ci/api/templates.rb', line 19

def template_delete(namespace, name)
  api.delete("templates/#{namespace}/#{name}")
end

#template_info(namespace, name) ⇒ Object

Returns the template.

Please note this api requires write access to the repository.

Reference: docs.drone.io/api/templates/template_info/



28
29
30
# File 'lib/drone-ci/api/templates.rb', line 28

def template_info(namespace, name)
  api.get("templates/#{namespace}/#{name}")
end

#template_list(namespace) ⇒ Object

Returns the organization template list.

Please note this api requires write access to the repository.

Reference: docs.drone.io/api/templates/template_list/



37
38
39
# File 'lib/drone-ci/api/templates.rb', line 37

def template_list(namespace)
  api.get("templates/#{namespace}")
end

#template_update(namespace, name, **body) ⇒ Object

Updates the specified repository secret.

Please note this api requires write access to the repository, and the request parameter secret is not the secret’s id but secret name.

Reference: docs.drone.io/api/templates/template_update/



46
47
48
# File 'lib/drone-ci/api/templates.rb', line 46

def template_update(namespace, name, **body)
  api.patch("templates/#{namespace}/#{name}", body)
end