Class: CircleCi::Project
- Inherits:
-
ApiProjectResource
- Object
- ApiResource
- ApiProjectResource
- CircleCi::Project
- Defined in:
- lib/circleci/project.rb
Overview
Class for interacting with Projects
Constant Summary
Constants inherited from ApiProjectResource
ApiProjectResource::DEFAULT_VCS_TYPE, ApiProjectResource::VALID_VCS_TYPES
Instance Attribute Summary
Attributes inherited from ApiProjectResource
Attributes inherited from ApiResource
Instance Method Summary collapse
-
#add_envvar(envvar) ⇒ CircleCi::Response
Adds an envvar for a project.
-
#build ⇒ CircleCi::Response
Build the latest master push for this project.
-
#build_branch(branch, params = {}, body = {}) ⇒ CircleCi::Response
Build the latest push for this branch of a specific project.
-
#build_ssh_key(build, key, hostname) ⇒ CircleCi::Response
Add a ssh key to a build.
-
#clear_cache ⇒ CircleCi::Response
Clear the build cache for a specific project.
-
#delete_checkout_key(fingerprint) ⇒ CircleCi::Response
Delete a checkout key for a project.
-
#enable ⇒ CircleCi::Response
Enable a project in CircleCI.
-
#envvar ⇒ CircleCi::Response
Get the project envvars.
-
#follow ⇒ CircleCi::Response
Follow the project.
-
#get_checkout_key(fingerprint) ⇒ CircleCi::Response
Get a checkout key for a project.
-
#initialize(username = nil, project = nil, vcs_type = nil, conf = nil) ⇒ CircleCi::Project
constructor
Initialize a new Project API interaction.
-
#list_checkout_keys ⇒ CircleCi::Response
Get a list of checkout keys for project.
-
#new_checkout_key(type) ⇒ CircleCi::Response
Create a checkout key for a project.
-
#recent_builds(params = {}) ⇒ CircleCi::Response
Get all recent builds for a specific project.
-
#recent_builds_branch(branch) ⇒ CircleCi::Response
Get all recent builds for a specific branch of a project.
-
#settings ⇒ CircleCi::Response
Get the project configuration.
-
#ssh_key(key, hostname) ⇒ CircleCi::Response
Add a ssh key to a project.
-
#unfollow ⇒ CircleCi::Response
Unfollow the project.
Methods inherited from ApiProjectResource
Methods inherited from ApiResource
default_config, #default_config
Constructor Details
#initialize(username = nil, project = nil, vcs_type = nil, conf = nil) ⇒ CircleCi::Project
Initialize a new Project API interaction
16 17 18 |
# File 'lib/circleci/project.rb', line 16 def initialize(username = nil, project = nil, vcs_type = nil, conf = nil) super(username, project, vcs_type, nil, conf) end |
Instance Method Details
#add_envvar(envvar) ⇒ CircleCi::Response
Adds an envvar for a project
165 166 167 |
# File 'lib/circleci/project.rb', line 165 def add_envvar(envvar) CircleCi.request(conf, "#{base_path}/envvar").post(envvar) end |
#build ⇒ CircleCi::Response
Build the latest master push for this project
25 26 27 |
# File 'lib/circleci/project.rb', line 25 def build CircleCi.request(conf, base_path).post end |
#build_branch(branch, params = {}, body = {}) ⇒ CircleCi::Response
Build the latest push for this branch of a specific project
37 38 39 |
# File 'lib/circleci/project.rb', line 37 def build_branch(branch, params = {}, body = {}) CircleCi.request(conf, "#{base_path}/tree/#{branch}", params).post(body) end |
#build_ssh_key(build, key, hostname) ⇒ CircleCi::Response
Add a ssh key to a build
49 50 51 52 |
# File 'lib/circleci/project.rb', line 49 def build_ssh_key(build, key, hostname) body = { hostname: hostname, private_key: key } CircleCi.request(conf, "#{base_path}/#{build}/ssh-users").post(body) end |
#clear_cache ⇒ CircleCi::Response
Clear the build cache for a specific project
59 60 61 |
# File 'lib/circleci/project.rb', line 59 def clear_cache CircleCi.request(conf, "#{base_path}/build-cache").delete end |
#delete_checkout_key(fingerprint) ⇒ CircleCi::Response
Delete a checkout key for a project
69 70 71 |
# File 'lib/circleci/project.rb', line 69 def delete_checkout_key(fingerprint) CircleCi.request(conf, "#{base_path}/checkout-key/#{fingerprint}").delete end |
#enable ⇒ CircleCi::Response
Enable a project in CircleCI. Causes a CircleCI SSH key to be added to the GitHub. Requires admin privilege to the repository.
79 80 81 |
# File 'lib/circleci/project.rb', line 79 def enable CircleCi.request(conf, "#{base_path}/enable").post end |
#envvar ⇒ CircleCi::Response
Get the project envvars
88 89 90 |
# File 'lib/circleci/project.rb', line 88 def envvar CircleCi.request(conf, "#{base_path}/envvar").get end |
#follow ⇒ CircleCi::Response
Follow the project
97 98 99 |
# File 'lib/circleci/project.rb', line 97 def follow CircleCi.request(conf, "#{base_path}/follow").post end |
#get_checkout_key(fingerprint) ⇒ CircleCi::Response
Get a checkout key for a project
107 108 109 |
# File 'lib/circleci/project.rb', line 107 def get_checkout_key(fingerprint) CircleCi.request(conf, "#{base_path}/checkout-key/#{fingerprint}").get end |
#list_checkout_keys ⇒ CircleCi::Response
Get a list of checkout keys for project
116 117 118 |
# File 'lib/circleci/project.rb', line 116 def list_checkout_keys CircleCi.request(conf, "#{base_path}/checkout-key").get end |
#new_checkout_key(type) ⇒ CircleCi::Response
Create a checkout key for a project
126 127 128 |
# File 'lib/circleci/project.rb', line 126 def new_checkout_key(type) CircleCi.request(conf, "#{base_path}/checkout-key").post(type: type) end |
#recent_builds(params = {}) ⇒ CircleCi::Response
Get all recent builds for a specific project
136 137 138 |
# File 'lib/circleci/project.rb', line 136 def recent_builds(params = {}) CircleCi.request(conf, base_path, params).get end |
#recent_builds_branch(branch) ⇒ CircleCi::Response
Get all recent builds for a specific branch of a project
146 147 148 |
# File 'lib/circleci/project.rb', line 146 def recent_builds_branch(branch) CircleCi.request(conf, "#{base_path}/tree/#{branch}").get end |
#settings ⇒ CircleCi::Response
Get the project configuration
155 156 157 |
# File 'lib/circleci/project.rb', line 155 def settings CircleCi.request(conf, "#{base_path}/settings").get end |
#ssh_key(key, hostname) ⇒ CircleCi::Response
Add a ssh key to a project
176 177 178 179 |
# File 'lib/circleci/project.rb', line 176 def ssh_key(key, hostname) body = { hostname: hostname, private_key: key } CircleCi.request(conf, "#{base_path}/ssh-key").post(body) end |
#unfollow ⇒ CircleCi::Response
Unfollow the project
186 187 188 |
# File 'lib/circleci/project.rb', line 186 def unfollow CircleCi.request(conf, "#{base_path}/unfollow").post end |