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, params = {}) ⇒ 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
17 18 19 |
# File 'lib/circleci/project.rb', line 17 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
167 168 169 |
# File 'lib/circleci/project.rb', line 167 def add_envvar(envvar) CircleCi.request(conf, "#{base_path}/envvar").post(envvar) end |
#build ⇒ CircleCi::Response
Build the latest master push for this project
26 27 28 |
# File 'lib/circleci/project.rb', line 26 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
38 39 40 |
# File 'lib/circleci/project.rb', line 38 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
50 51 52 53 |
# File 'lib/circleci/project.rb', line 50 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
60 61 62 |
# File 'lib/circleci/project.rb', line 60 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
70 71 72 |
# File 'lib/circleci/project.rb', line 70 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.
80 81 82 |
# File 'lib/circleci/project.rb', line 80 def enable CircleCi.request(conf, "#{base_path}/enable").post end |
#envvar ⇒ CircleCi::Response
Get the project envvars
89 90 91 |
# File 'lib/circleci/project.rb', line 89 def envvar CircleCi.request(conf, "#{base_path}/envvar").get end |
#follow ⇒ CircleCi::Response
Follow the project
98 99 100 |
# File 'lib/circleci/project.rb', line 98 def follow CircleCi.request(conf, "#{base_path}/follow").post end |
#get_checkout_key(fingerprint) ⇒ CircleCi::Response
Get a checkout key for a project
108 109 110 |
# File 'lib/circleci/project.rb', line 108 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
117 118 119 |
# File 'lib/circleci/project.rb', line 117 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
127 128 129 |
# File 'lib/circleci/project.rb', line 127 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
137 138 139 |
# File 'lib/circleci/project.rb', line 137 def recent_builds(params = {}) CircleCi.request(conf, base_path, params).get end |
#recent_builds_branch(branch, params = {}) ⇒ CircleCi::Response
Get all recent builds for a specific branch of a project
148 149 150 |
# File 'lib/circleci/project.rb', line 148 def recent_builds_branch(branch, params = {}) CircleCi.request(conf, "#{base_path}/tree/#{branch}", params).get end |
#settings ⇒ CircleCi::Response
Get the project configuration
157 158 159 |
# File 'lib/circleci/project.rb', line 157 def settings CircleCi.request(conf, "#{base_path}/settings").get end |
#ssh_key(key, hostname) ⇒ CircleCi::Response
Add a ssh key to a project
178 179 180 181 |
# File 'lib/circleci/project.rb', line 178 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
188 189 190 |
# File 'lib/circleci/project.rb', line 188 def unfollow CircleCi.request(conf, "#{base_path}/unfollow").post end |