{"id":22683245,"url":"https://github.com/mtchavez/circleci","last_synced_at":"2025-04-04T13:09:34.361Z","repository":{"id":8072945,"uuid":"9485764","full_name":"mtchavez/circleci","owner":"mtchavez","description":"CircleCI REST API Ruby Gem","archived":false,"fork":false,"pushed_at":"2023-03-06T13:59:46.000Z","size":2011,"stargazers_count":95,"open_issues_count":12,"forks_count":62,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T12:05:36.022Z","etag":null,"topics":["circleci","ruby","rubygem"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtchavez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-04-17T00:30:40.000Z","updated_at":"2024-11-28T16:31:33.000Z","dependencies_parsed_at":"2024-06-18T14:07:15.347Z","dependency_job_id":null,"html_url":"https://github.com/mtchavez/circleci","commit_stats":{"total_commits":352,"total_committers":25,"mean_commits":14.08,"dds":"0.40909090909090906","last_synced_commit":"1b1e8330567520b79c5c4864ac2860da247887d8"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fcircleci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fcircleci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fcircleci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fcircleci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtchavez","download_url":"https://codeload.github.com/mtchavez/circleci/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247182334,"owners_count":20897379,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circleci","ruby","rubygem"],"created_at":"2024-12-09T21:11:22.711Z","updated_at":"2025-04-04T13:09:34.335Z","avatar_url":"https://github.com/mtchavez.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# circleci\n\n[![Gem Version](https://badge.fury.io/rb/circleci.svg)](https://badge.fury.io/rb/circleci)\n[![Circle CI](https://circleci.com/gh/mtchavez/circleci.svg?style=svg)](https://circleci.com/gh/mtchavez/circleci)\n[![Maintainability](https://api.codeclimate.com/v1/badges/ce857cb1b17fadd3bb4e/maintainability)](https://codeclimate.com/github/mtchavez/circleci/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/ce857cb1b17fadd3bb4e/test_coverage)](https://codeclimate.com/github/mtchavez/circleci/test_coverage)\n\nCircle CI API Wrapper. Requires ruby `\u003e= 2.0.0`.\n\n⚠️ **403 Forbidden issue with GET Requests fixed in 2.1.0**\n\n## Install\n\n```ruby\ngem install circleci\n```\n\nor with Bundler\n\n```ruby\ngem 'circleci'\n```\n\n## Usage\n\n### Documentation\n\nDocumentation can be found on [rubydoc][docs] or in this README\n\n### Configuring\n\n#### Global Config\n\nConfigure using an API token from Circle\n\n```ruby\nCircleCi.configure do |config|\n  config.token = 'my-token'\nend\n```\n\nOptionally you can configure your own host and/or port if using an enterprise\nCircleCi host. The port will default to `80` if not set.\n\n```ruby\nCircleCi.configure do |config|\n  config.token = 'my-token'\n  config.host = 'https://ci.mycompany.com'\n  config.port = 1234\nend\n```\n\nOverriding request settings such as not verifying SSL\n\n```ruby\nCircleCi.configure do |config|\n  config.token = ENV['CIRCLECI_TOKEN']\n  config.host = 'http://ci.mycompany.com'\n  config.port = 80\n  config.request_overrides = {\n    use_ssl: false,\n    verify_ssl: false\n  }\nend\n```\n\nSetup for proxying requests\n```ruby\nrequire 'circleci'\n\nCircleCi.configure do |config|\n  config.token = ENV['CIRCLECI_TOKEN']\n  config.proxy_host = 'http://ciproxy.mycompany.com'\n  config.proxy_port = 8000\n  config.proxy_user = 'myci'\n  config.proxy_pass = 'supersecret'\n  config.proxy = true\nend\n```\n\n#### Config Object\n\nIf you need to use custom config per request or for specific non-global cases\nyou can instantiate a `CircleCi::Config` object with all the same granularity\nas a global config.\n\n```ruby\n# Using a new token\nconfig = CircleCi::Config.new token: ENV['SECRET_CIRCLECI_TOKEN']\n\n# Setting a new host\nconfig_options = { host: ENV['CIRCLECI_HOST'], port: ENV['CIRCLECI_PORT'] }\nconfig = CircleCi::Config.new\n\n# Proxy setup is a little more invovled right now\n# and requires setting proxy info on instantiated config\nconfig = CircleCi::Config.new token: ENV['CIRCLECI_TOKEN'], proxy: true\nconfig.proxy_host = ENV['CIRCLECI_PROXY_HOST']\nconfig.proxy_port = ENV['CIRCLECI_PROXY_PORT']\nconfig.proxy_user = ENV['CIRCLECI_PROXY_USER']\nconfig.proxy_pass = ENV['CIRCLECI_PROXY_PASS']\n```\n\n### API Versioning\n\nCircleCi is a versioned API. This gem attempts to stay up to date with any\nchanges between versions. As of now you can change the version on the config\nyou use to make requests.\n\n```ruby\nconfig = CircleCi::Config.new token: ENV['CIRCLECI_TOKEN'], version: 'v1.1'\n```\n\nThis will change the requests to be in the format of\n\n`https://circleci.com/api/v1.1/`\n\n### VCS Type\n\nIntroduced in `v1.1` of the API is interacting with projects and builds based\non their version control system type. Currently this can be `github` or `bitbucket`.\nPlease see endpoint documentation for `Project` and `Build` on usage but you can\nset a vcs type on either as so\n\n```ruby\n# A bitbucket project\nproject = CircleCi::Project.new 'username', 'project', 'bitbucket'\n\n# A github build\nbuild = CircleCi::Build.new 'username', 'project', 'github', '1234'\n\n# Defaults to github\nbuild = CircleCi::Build.new 'username', 'project', nil, '1234'\nbuild.vcs_type # will be github\n\n# Non-valid types default to github as well\nproject = CircleCi::Project.new 'username', 'project', 'gitlab'\nproject.vcs_type # will be github\n```\n\n\n## API Endpoints\n\n* [User](#user)\n  * [Heroku Key](#heroku_key)\n  * [Me](#me)\n* [Project](#project)\n  * [All](#all)\n  * [Build Branch](#build_branch)\n  * [Build SSH Key](#build_ssh_key)\n  * [Clear Cache](#clear_cache)\n  * [Enable](#enable)\n  * [Envvar](#envvar)\n  * [Follow](#follow)\n  * [Delete Checkout Key](#delete_checkout_key)\n  * [Get Checkout Key](#get_checkout_key)\n  * [List Checkout Keys](#list_checkout_keys)\n  * [New Checkout Key](#new_checkout_key)\n  * [Recent Project Builds](#recent_project_builds)\n  * [Recent Builds Branch](#recent_builds_branch)\n  * [Settings](#settings)\n  * [Add Envvar](#add_envvar)\n  * [Delete Envvar](#delete_envvar)\n  * [SSH Key](#ssh_key)\n  * [Unfollow](#unfollow)\n* [Build](#build)\n  * [Artifacts](#artifacts)\n  * [Cancel](#cancel)\n  * [Get](#get)\n  * [Retry](#retry)\n  * [Tests](#tests)\n* [Recent Builds](#recent_builds)\n  * [Get Recent Builds](#get_recent_builds)\n\n### [User](#user)\n\n#### [heroku_key](#heroku_key)\n\nEndpoint: `/user/heroku-key`\n\nAdds your Heroku API key to CircleCI.\n```ruby\n# Use global config with token for user\nuser = CircleCi::User.new\nuser.heroku_key 'your-api-key'\n\n# Use a different config with another user token\nuser = CircleCi::User.new other_user_config\nuser.heroku_key 'your-api-key'\n```\n\nExample response\n\nEmpty body response with a `200 OK` response code\n```js\n\"\"\n```\n\n#### [me](#me)\n\nEndpoint: `/me`\n\nProvides information about the signed in user.\n\n```ruby\n# Use global config with token for user\nuser = CircleCi::User.new\nuser.me\n\n# Use a different config with another user token\nuser = CircleCi::User.new other_user_config\nuser.me\n```\n\nExample response\n\n```js\n{\n  \"basic_email_prefs\" : \"smart\", // can be \"smart\", \"none\" or \"all\"\n  \"login\" : \"pbiggar\" // your github username\n}\n```\n\n### [Project](#project)\n\n#### [all](#all)\n\nEndpoint: `/projects`\n\nList of all the repos you have access to on Github, with build information organized by branch.\n\n```ruby\n# Use global config with token for user\nprojects = CircleCi::Projects.new\nprojects.get\n\n# Use a different config with another projects token\nprojects = CircleCi::Projects.new other_projects_config\nprojects.get\n```\n\nExample response\n\n```js\n[ {\n  \"vcs_url\": \"https://github.com/circleci/mongofinil\"\n  \"followed\": true // true if you follow this project in Circle\n  \"branches\" : {\n    \"master\" : {\n      \"pusher_logins\" : [ \"pbiggar\", \"arohner\" ], // users who have pushed\n      \"last_non_success\" : { // last failed build on this branch\n        \"pushed_at\" : \"2013-02-12T21:33:14Z\",\n        \"vcs_revision\" : \"1d231626ba1d2838e599c5c598d28e2306ad4e48\",\n        \"build_num\" : 22,\n        \"outcome\" : \"failed\",\n        },\n      \"last_success\" : { // last successful build on this branch\n        \"pushed_at\" : \"2012-08-09T03:59:53Z\",\n        \"vcs_revision\" : \"384211bbe72b2a22997116a78788117b3922d570\",\n        \"build_num\" : 15,\n        \"outcome\" : \"success\",\n        },\n      \"recent_builds\" : [ { // last 5 builds, ordered by pushed_at (decreasing)\n        \"pushed_at\" : \"2013-02-12T21:33:14Z\",\n        \"vcs_revision\" : \"1d231626ba1d2838e599c5c598d28e2306ad4e48\",\n        \"build_num\" : 22,\n        \"outcome\" : \"failed\",\n        }, {\n        \"pushed_at\" : \"2013-02-11T03:09:54Z\",\n        \"vcs_revision\" : \"0553ba86b35a97e22ead78b0d568f6a7c79b838d\",\n        \"build_num\" : 21,\n        \"outcome\" : \"failed\",\n        }, ... ],\n      \"running_builds\" : [ ] // currently running builds\n    }\n  }\n} ]\n```\n\n#### [build_branch](#build_branch)\n\nEndpoint: `/project/:username/:repository/tree/:branch`\n\nBuild a specific branch of a project\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\n\n# Build the latest push for this branch\nlatest_build = project.build_branch 'branch'\n\n# Adding URL params for revision or parallel\nparams = { revision: 'fda12345asdf', parallel: 2 }\nres = project.build_branch 'branch', params\nres.body['status'] # Not running\nres.body['build_url'] # Get url of build\n\n# Passing build parameters in the post body\nbuild_params = { build_parameters: { 'MY_TOKEN' =\u003e '123asd123asd' } }\nres = project.build_branch 'branch', {}, build_params\nres.body['status']\nres.body['build_url']\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.build_branch 'branch'\n```\n\n\nExample response\n\n```js\n{\n  \"compare\" : null,\n  \"previous_successful_build\" : {\n    \"build_time_millis\" : 40479,\n    \"status\" : \"success\",\n    \"build_num\" : 76\n  },\n  \"build_parameters\" : { },\n  \"committer_date\" : \"2014-07-27T14:40:15Z\",\n  \"body\" : \"\",\n  \"usage_queued_at\" : \"2014-07-29T14:05:36.373Z\",\n  \"retry_of\" : null,\n  \"reponame\" : \"soapy_cake\",\n  \"build_url\" : \"https://circleci.com/gh/ad2games/soapy_cake/77\",\n  \"parallel\" : 1,\n  \"failed\" : null,\n  \"branch\" : \"master\",\n  \"username\" : \"ad2games\",\n  \"author_date\" : \"2014-07-27T14:40:15Z\",\n  \"why\" : \"edit\",\n  \"user\" : {\n    \"is_user\" : true,\n    \"login\" : \"hwartig\",\n    \"name\" : \"Harald Wartig\",\n    \"email\" : \"hw@ad2games.com\"\n  },\n  \"vcs_revision\" : \"f932ea1b564ceaaa8cdba06b1bb93e1869a9a905\",\n  \"build_num\" : 77,\n  \"infrastructure_fail\" : false,\n  \"ssh_enabled\" : null,\n  \"committer_email\" : \"hwartig@gmail.com\",\n  \"previous\" : {\n    \"build_time_millis\" : 40479,\n    \"status\" : \"success\",\n    \"build_num\" : 76\n  },\n  \"status\" : \"not_running\",\n  \"committer_name\" : \"Harald Wartig\",\n  \"retries\" : null,\n  \"subject\" : \"Fix link to api_versions.yml\",\n  \"timedout\" : false,\n  \"dont_build\" : null,\n  \"feature_flags\" : { },\n  \"lifecycle\" : \"not_running\",\n  \"stop_time\" : null,\n  \"build_time_millis\" : null,\n  \"circle_yml\" : null,\n  \"messages\" : [ ],\n  \"is_first_green_build\" : false,\n  \"job_name\" : null,\n  \"start_time\" : null,\n  \"all_commit_details\" : [ {\n    \"committer_date\" : \"2014-07-27T14:40:15Z\",\n    \"body\" : \"\",\n    \"author_date\" : \"2014-07-27T14:40:15Z\",\n    \"committer_email\" : \"hwartig@gmail.com\",\n    \"commit\" : \"f932ea1b564ceaaa8cdba06b1bb93e1869a9a905\",\n    \"committer_login\" : \"hwartig\",\n    \"committer_name\" : \"Harald Wartig\",\n    \"subject\" : \"Fix link to api_versions.yml\",\n    \"commit_url\" : \"https://github.com/ad2games/soapy_cake/commit/f932ea1b564ceaaa8cdba06b1bb93e1869a9a905\",\n    \"author_login\" : \"hwartig\",\n    \"author_name\" : \"Harald Wartig\",\n    \"author_email\" : \"hwartig@gmail.com\"\n  } ],\n  \"outcome\" : null,\n  \"vcs_url\" : \"https://github.com/ad2games/soapy_cake\",\n  \"author_name\" : \"Harald Wartig\",\n  \"node\" : null,\n  \"canceled\" : false,\n  \"author_email\" : \"hwartig@gmail.com\"\n}\n```\n\nIt also supports the Experimental Parameterized Builds\n\n```\n  build_environment_variables = {\"ENV_VAR1\" =\u003e \"VALUE1\", \"ENV_VAR2\" =\u003e \"VALUE2\"}\n  res = CircleCi::Project.build_branch 'username', 'reponame', 'branch', build_environment_variables\n```\n\n#### [build_ssh_key](#build_ssh_key)\n\nEndpoint: `/project/:username/:repository/:build_num/ssh-users`\n\nAdds a user to the build's SSH permissions.\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.build_ssh_key 'username', 'repo', 'RSA private key', 'hostname'\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.build_ssh_key 'username', 'repo', 'RSA private key', 'hostname'\n```\n\nExample response\n\nEmpty response body with a `200 OK` successful response code\n```js\n\"\"\n```\n\n#### [clear_cache](#clear_cache)\n\nEndpoint: `/project/:username/:repository/build-cache`\n\nClears the cache for a project\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.clear_cache\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.clear_cache\n```\n\nExample response\n\n```js\n{\n  \"status\" : \"build caches deleted\"\n}\n```\n\n#### [delete_checkout_key](#delete_checkout_key)\n\nEndpoint: `/project/:username/:repository/checkout-key/:fingerprint`\n\nDelete a checkout key for a project by supplying the fingerprint of the key.\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.delete_checkout_key 'fingerprint'\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.delete_checkout_key 'fingerprint'\n```\n\nExample response\n\n```js\n{\"message\":\"ok\"}\n```\n\n#### [enable](#enable)\n\nEndpoint: `/project/:username/:repository/enable`\n\nEnable a project in CircleCI. Causes a CircleCI SSH key to be added to\nthe GitHub. Requires admin privilege to the repository.\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.enable\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.enable\n```\n\nExample response\n```js\n{\n    \"hall_notify_prefs\": nil,\n    \"irc_password\": nil,\n    \"default_branch\": \"master\",\n    \"hipchat_notify\": nil,\n    \"campfire_notify_prefs\": nil,\n    \"campfire_room\": nil,\n    \"irc_keyword\": nil,\n    \"slack_api_token\": nil,\n    \"parallel\": 1,\n    \"github_user\": nil,\n    \"github_permissions\": {\n        \"admin\": true,\n        \"push\": true,\n        \"pull\": true\n    },\n    \"irc_server\": nil,\n    \"heroku_deploy_user\": nil,\n    \"dependencies\": \"\",\n    \"slack_notify_prefs\": nil,\n    \"ssh_keys\": [\n\n    ],\n    \"extra\": \"\",\n    \"followed\": false,\n    \"branches\": {\n        \"master\": {\n            \"last_non_success\": {\n                \"added_at\": \"2014-06-05T17:23:25.352Z\",\n                \"pushed_at\": \"2014-06-05T17:22:52.518Z\",\n                \"vcs_revision\": \"66d398cb635c5f4dd666dd1526bda5894d1246e4\",\n                \"build_num\": 6,\n                \"status\": \"no_tests\",\n                \"outcome\": \"no_tests\"\n            },\n            \"recent_builds\": [\n                {\n                    \"added_at\": \"2014-06-05T17:23:25.352Z\",\n                    \"pushed_at\": \"2014-06-05T17:22:52.518Z\",\n                    \"vcs_revision\": \"66d398cb635c5f4dd666dd1526bda5894d1246e4\",\n                    \"build_num\": 6,\n                    \"status\": \"no_tests\",\n                    \"outcome\": \"no_tests\"\n                }\n            ],\n            \"running_builds\": [\n\n            ]\n        }\n    },\n    \"campfire_token\": nil,\n    \"hipchat_notify_prefs\": nil,\n    \"test\": \"\",\n    \"compile\": \"\",\n    \"hipchat_room\": nil,\n    \"slack_channel\": nil,\n    \"slack_subdomain\": nil,\n    \"vcs_url\": \"https://github.com/Shopify/google_auth\",\n    \"flowdock_api_token\": nil,\n    \"hall_room_api_token\": nil,\n    \"slack_webhook_url\": nil,\n    \"irc_username\": nil,\n    \"hipchat_api_token\": nil,\n    \"campfire_subdomain\": nil,\n    \"has_usable_key\": true,\n    \"setup\": \"\",\n    \"irc_channel\": nil,\n    \"feature_flags\": {\n        \"build_GH1157_container_oriented_ui\": nil,\n        \"set-github-status\": true\n    },\n    \"irc_notify_prefs\": nil\n}\n```\n\n#### [envvar](#envvar)\n\nEndpoint: `/project/:username/:project/envvar`\n\nGet a list of environment variables for a project\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.envvar\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.envvar\n```\n\nExample response\n\n```js\n[{\"name\":\"foo\",\"value\":\"xxxx\"}]\n```\n\n#### [follow](#follow)\n\nEndpoint: `/project/:username/:repository/follow`\n\nFollow a project\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.follow\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.follow\n```\n\nExample response\n\n```js\n{\n    \"followed\": true,\n    \"first_build\": nil\n}\n```\n\n#### [get_checkout_key](#get_checkout_key)\n\nEndpoint: `/project/:username/:repository/checkout-key/:fingerprint`\n\nGet a checkout key for a project by supplying the fingerprint of the key.\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.get_checkout_key 'fingerprint'\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.get_checkout_key 'fingerprint\n```\n\nExample response\n\n```js\n{\n    \"public_key\": \"ssh-rsa...\",\n    \"type\": \"deploy-key\", // can be \"deploy-key\" or \"user-key\"\n    \"fingerprint\": \"c9:0b:1c:4f:d5:65:56:b9:ad:88:f9:81:2b:37:74:2f\",\n    \"preferred\": true,\n    \"time\" : \"2015-09-21T17:29:21.042Z\" // when the key was issued\n}\n```\n\n#### [list_checkout_keys](#list_checkout_keys)\n\nEndpoint: `/project/#{username}/#{project}/checkout-key`\n\nList checkout keys\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.checkout_keys\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.checkout_keys\n```\n\nExample response\n\n```js\n[\n    {\n        \"public_key\": \"ssh-rsa...\",\n        \"type\": \"deploy-key\", // can be \"deploy-key\" or \"user-key\"\n        \"fingerprint\": \"c9:0b:1c:4f:d5:65:56:b9:ad:88:f9:81:2b:37:74:2f\",\n        \"preferred\": true,\n        \"time\" : \"2015-09-21T17:29:21.042Z\" // when the key was issued\n    }\n]\n```\n\n#### [new_checkout_key](#new_checkout_key)\n\nEndpoint: `/project/:username/:repository/checkout-key`\n\nCreate an ssh key used to access external systems that require SSH key-based authentication.\nTakes a type of key to create which an be `deploy-key` or `github-user-key`.\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.new_checkout_key 'deploy-key'\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.new_checkout_key 'deploy-key\n```\n\nExample response\n\n```js\n{\n    \"public_key\": \"ssh-rsa...\",\n    \"type\": \"deploy-key\", // can be \"deploy-key\" or \"user-key\"\n    \"fingerprint\": \"c9:0b:1c:4f:d5:65:56:b9:ad:88:f9:81:2b:37:74:2f\",\n    \"preferred\": true,\n    \"time\" : \"2015-09-21T17:29:21.042Z\" // when the key was issued\n}\n```\n\n#### [recent_project_builds](#recent_project_builds)\n\nEndpoint: `/project/:username/:repository`\n\nBuild summary for each of the last 30 recent builds, ordered by build_num.\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.recent_builds\n\n# Use params to filter by status\nres = project.recent_builds filter: 'failed'\n\n# Use params to limit and give an offset\nres = project.recent_builds limit: 10, offset: 50\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.recent_builds\n```\n\nExample response\n\n```js\n[ {\n  \"vcs_url\" : \"https://github.com/circleci/mongofinil\",\n  \"build_url\" : \"https://circleci.com/gh/circleci/mongofinil/22\",\n  \"build_num\" : 22,\n  \"branch\" : \"master\",\n  \"vcs_revision\" : \"1d231626ba1d2838e599c5c598d28e2306ad4e48\",\n  \"committer_name\" : \"Allen Rohner\",\n  \"committer_email\" : \"arohner@gmail.com\",\n  \"subject\" : \"Don't explode when the system clock shifts backwards\",\n  \"body\" : \"\", // commit message body\n  \"why\" : \"github\", // short string explaining the reason we built\n  \"dont_build\" : null, // reason why we didn't build, if we didn't build\n  \"queued_at\" : \"2013-02-12T21:33:30Z\" // time build was queued\n  \"start_time\" : \"2013-02-12T21:33:38Z\", // time build started running\n  \"stop_time\" : \"2013-02-12T21:34:01Z\", // time build finished running\n  \"build_time_millis\" : 23505,\n  \"lifecycle\" : \"finished\",\n  \"outcome\" : \"failed\",\n  \"status\" : \"failed\",\n  \"retry_of\" : null, // build_num of the build this is a retry of\n  \"previous\" : { // previous build\n    \"status\" : \"failed\",\n    \"build_num\" : 21\n  } ]\n```\n\n#### [recent_builds_branch](#recent_builds_branch)\n\nEndpoint: `/project/:username/:repository/tree/:branch`\n\nBuild summary for each of the last 30 recent builds for a specific branch, ordered by build_num.\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.recent_builds_branch 'branch'\n\n# Use params to filter by status\nres = project.recent_builds_branch 'branch', filter: 'failed'\n\n# Use params to limit and give an offset\nres = project.recent_builds_branch 'branch', limit: 10, offset: 50\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.recent_builds_branch 'branch'\n```\n\nExample response\n\n```js\n[ {\n  \"vcs_url\" : \"https://github.com/circleci/mongofinil\",\n  \"build_url\" : \"https://circleci.com/gh/circleci/mongofinil/22\",\n  \"build_num\" : 22,\n  \"branch\" : \"new_feature\",\n  \"vcs_revision\" : \"1d231626ba1d2838e599c5c598d28e2306ad4e48\",\n  \"committer_name\" : \"Allen Rohner\",\n  \"committer_email\" : \"arohner@gmail.com\",\n  \"subject\" : \"Don't explode when the system clock shifts backwards\",\n  \"body\" : \"\", // commit message body\n  \"why\" : \"github\", // short string explaining the reason we built\n  \"dont_build\" : null, // reason why we didn't build, if we didn't build\n  \"queued_at\" : \"2013-02-12T21:33:30Z\" // time build was queued\n  \"start_time\" : \"2013-02-12T21:33:38Z\", // time build started running\n  \"stop_time\" : \"2013-02-12T21:34:01Z\", // time build finished running\n  \"build_time_millis\" : 23505,\n  \"lifecycle\" : \"finished\",\n  \"outcome\" : \"failed\",\n  \"status\" : \"failed\",\n  \"retry_of\" : null, // build_num of the build this is a retry of\n  \"previous\" : { // previous build\n    \"status\" : \"failed\",\n    \"build_num\" : 21\n  } ]\n```\n\n#### [settings](#settings)\n\nEndpoint: `/project/:username/:repository/settings`\n\nGet project settings\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.settings\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.settings\n```\n\nExample response\n\n```js\n{\n    \"hall_notify_prefs\": nil,\n    \"irc_password\": nil,\n    \"default_branch\": \"master\",\n    \"hipchat_notify\": nil,\n    \"campfire_notify_prefs\": nil,\n    \"campfire_room\": nil,\n    \"irc_keyword\": nil,\n    \"slack_api_token\": nil,\n    \"parallel\": 1,\n    \"github_user\": nil,\n    \"github_permissions\": {\n        \"admin\": true,\n        \"push\": true,\n        \"pull\": true\n    },\n    \"irc_server\": nil,\n    \"heroku_deploy_user\": nil,\n    \"dependencies\": \"\",\n    \"slack_notify_prefs\": nil,\n    \"ssh_keys\": [\n\n    ],\n    \"extra\": \"\",\n    \"followed\": true,\n    \"branches\": {\n        \"master\": {\n            \"running_builds\": [\n                {\n                    \"added_at\": \"2014-06-05T17:22:52.779Z\",\n                    \"pushed_at\": \"2014-06-05T17:22:52.518Z\",\n                    \"vcs_revision\": \"66d398cb635c5f4dd666dd1526bda5894d1246e4\",\n                    \"build_num\": 6,\n                    \"status\": \"not_running\",\n                    \"outcome\": nil\n                }\n            ]\n        }\n    },\n    \"campfire_token\": nil,\n    \"hipchat_notify_prefs\": nil,\n    \"test\": \"\",\n    \"compile\": \"\",\n    \"hipchat_room\": nil,\n    \"slack_channel\": nil,\n    \"slack_subdomain\": nil,\n    \"vcs_url\": \"https://github.com/Shopify/google_auth\",\n    \"flowdock_api_token\": nil,\n    \"hall_room_api_token\": nil,\n    \"slack_webhook_url\": nil,\n    \"irc_username\": nil,\n    \"hipchat_api_token\": nil,\n    \"campfire_subdomain\": nil,\n    \"has_usable_key\": true,\n    \"setup\": \"\",\n    \"irc_channel\": nil,\n    \"feature_flags\": {\n        \"build_GH1157_container_oriented_ui\": nil,\n        \"set-github-status\": true\n    },\n    \"irc_notify_prefs\": nil\n}\n```\n\n#### [add_envvar](#add_envvar)\n\nEndpoint: `/project/:username/:project/envvar`\n\nCreates a new environment variable for a project\n\n```ruby\nenvironment = { name: 'foo', value: 'bar' }\n\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.add_envvar environment\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.add_envvar environment\n```\n\nExample response\n\n```js\n{\"name\":\"foo\",\"value\":\"xxxx\"}\n```\n\n#### [delete_envvar](#delete_envvar)\n\nEndpoint: `/project/:username/:project/envvar`\n\nDeletes an environment variable for a project\n\n```ruby\nenvvar = 'SECRET_CI_TOKEN'\n\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.delete_envvar envvar\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.delete_envvar envvar\n```\n\nExample response\n\n```js\n{\"message\": \"ok\"}\n```\n\n#### [ssh_key](#ssh_key)\n\nEndpoint: `/project/:username/:repository/ssh-key`\n\nCreates an ssh key that will be used to access the external system identified\nby the hostname parameter for SSH key-based authentication.\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.ssh_key 'RSA private key', 'hostname'\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.ssh_key 'RSA private key', 'hostname'\n```\n\nExample response\n\nEmpty response body with a `200 OK` successful response code\n```js\n\"\"\n```\n\n#### [unfollow](#unfollow)\n\nEndpoint: `/project/:username/:repository/unfollow`\n\nUnfollow a project\n\n```ruby\n# Use global config with token for user\nproject = CircleCi::Project.new 'username', 'reponame'\nres = project.unfollow\n\n# Use a different config with another user token\nproject = CircleCi::Project.new 'username', 'reponame', 'github', other_project_config\nproject.unfollow\n```\n\nExample response\n\n```js\n{\n    \"followed\": false\n}\n```\n\n### [Build](#build)\n\n#### [artifacts](#artifacts)\n\nEndpoint: `/project/:username/:repository/:build/artifacts`\n\nArtifacts produced by the build, returns an array of artifact details\n\n```ruby\n# Use global config with token for user\nbuild = CircleCi::Build.new 'username', 'reponame', nil, 'build'\nres = build.artifacts\n\n# Use a different config with another user token\nbuild = CircleCi::Build.new 'username', 'reponame', nil, 'build', other_build_config\nbuild.artifacts\n```\n\n```js\n[\n  {\n    node_index: 0,\n    path: \"/tmp/circle-artifacts.NHQxLku/cherry-pie.png\",\n    pretty_path: \"$CIRCLE_ARTIFACTS/cherry-pie.png\",\n    url: \"https://circleci.com/gh/circleci/mongofinil/22/artifacts/0/tmp/circle-artifacts.NHQxLku/cherry-pie.png\"\n  },\n  {\n    node_index: 0,\n    path: \"/tmp/circle-artifacts.NHQxLku/rhubarb-pie.png\",\n    pretty_path: \"$CIRCLE_ARTIFACTS/rhubarb-pie.png\",\n    url: \"https://circleci.com/gh/circleci/mongofinil/22/artifacts/0/tmp/circle-artifacts.NHQxLku/rhubarb-pie.png\"\n  }\n]\n```\n\n#### [cancel](#cancel)\n\nEndpoint: `/project/:username/:repository/:build/cancel`\n\nCancels the build, returns a summary of the build.\n\n```ruby\n# Use global config with token for user\nbuild = CircleCi::Build.new 'username', 'reponame', nil, 'build'\nres = build.cancel\n\n# Use a different config with another user token\nbuild = CircleCi::Build.new 'username', 'reponame', nil, 'build', other_build_config\nbuild.cancel\n```\n\nExample response\n\n```js\n{\n  \"vcs_url\" : \"https://github.com/circleci/mongofinil\",\n  \"build_url\" : \"https://circleci.com/gh/circleci/mongofinil/26\",\n  \"build_num\" : 26,\n  \"branch\" : \"master\",\n  \"vcs_revision\" : \"59c9c5ea3e289f2f3b0c94e128267cc0ce2d65c6\",\n  \"committer_name\" : \"Allen Rohner\",\n  \"committer_email\" : \"arohner@gmail.com\",\n  \"subject\" : \"Merge pull request #6 from dlowe/master\"\n  \"body\" : \"le bump\", // commit message body\n  \"why\" : \"retry\", // short string explaining the reason we built\n  \"dont_build\" : null, // reason why we didn't build, if we didn't build\n  \"queued_at\" : \"2013-05-24T19:37:59.095Z\" // time build was queued\n  \"start_time\" : null, // time build started running\n  \"stop_time\" : null, // time build finished running\n  \"build_time_millis\" : null,\n  \"username\" : \"circleci\",\n  \"reponame\" : \"mongofinil\",\n  \"lifecycle\" : \"queued\",\n  \"outcome\" : \"canceled\",\n  \"status\" : \"canceled\",\n  \"canceled\" : true,\n  \"retry_of\" : 25, // build_num of the build this is a retry of\n  \"previous\" : { // previous build\n    \"status\" : \"success\",\n    \"build_num\" : 25\n  }\n}\n```\n\n#### [get](#get)\n\nEndpoint: `/project/:username/:repository/:build`\n\nFull details for a single build, including the output for all actions. The response includes all of the fields from the build summary.\n\n```ruby\n# Use global config with token for user\nbuild = CircleCi::Build.new 'username', 'reponame', nil, 'build'\nres = build.get\n\n# Use a different config with another user token\nbuild = CircleCi::Build.new 'username', 'reponame', nil, 'build', other_build_config\nbuild.get\n```\n\nExample response\n\n```js\n{\n  \"vcs_url\" : \"https://github.com/circleci/mongofinil\",\n  \"build_url\" : \"https://circleci.com/gh/circleci/mongofinil/22\",\n  \"build_num\" : 22,\n  \"steps\" : [ {\n    \"name\" : \"configure the build\",\n    \"actions\" : [ {\n      \"bash_command\" : null,\n      \"run_time_millis\" : 1646,\n      \"start_time\" : \"2013-02-12T21:33:38Z\",\n      \"end_time\" : \"2013-02-12T21:33:39Z\",\n      \"name\" : \"configure the build\",\n      \"command\" : \"configure the build\",\n      \"exit_code\" : null,\n      \"out\" : [ ],\n      \"type\" : \"infrastructure\",\n      \"index\" : 0,\n      \"status\" : \"success\",\n    } ] },\n    \"name\" : \"lein2 deps\",\n    \"actions\" : [ {\n      \"bash_command\" : \"lein2 deps\",\n      \"run_time_millis\" : 7555,\n      \"start_time\" : \"2013-02-12T21:33:47Z\",\n      \"command\" : \"((lein2 :deps))\",\n      \"messages\" : [ ],\n      \"step\" : 1,\n      \"exit_code\" : 0,\n      \"out\" : [ {\n        \"type\" : \"out\",\n        \"time\" : \"2013-02-12T21:33:54Z\",\n        \"message\" : \"Retrieving org/clojure ... from clojars\\r\\n\"\n      } ],\n      \"end_time\" : \"2013-02-12T21:33:54Z\",\n      \"index\" : 0,\n      \"status\" : \"success\",\n      \"type\" : \"dependencies\",\n      \"source\" : \"inference\",\n      \"failed\" : null\n    } ] },\n    \"name\" : \"lein2 trampoline midje\",\n    \"actions\" : [ {\n      \"bash_command\" : \"lein2 trampoline midje\",\n      \"run_time_millis\" : 2310,\n      \"continue\" : null,\n      \"parallel\" : true,\n      \"start_time\" : \"2013-02-12T21:33:59Z\",\n      \"name\" : \"lein2 trampoline midje\",\n      \"command\" : \"((lein2 :trampoline :midje))\",\n      \"messages\" : [ ],\n      \"step\" : 6,\n      \"exit_code\" : 1,\n      \"out\" : [ {\n        \"type\" : \"out\",\n        \"time\" : \"2013-02-12T21:34:01Z\",\n        \"message\" : \"'midje' is not a task. See 'lein help'.\\r\\n\\r\\nDid you mean this?\\r\\n         do\\r\\n\"\n      }, {\n        \"type\" : \"err\",\n        \"time\" : \"2013-02-12T21:34:01Z\",\n        \"message\" : \"((lein2 :trampoline :midje)) returned exit code 1\"\n      } ],\n      \"end_time\" : \"2013-02-12T21:34:01Z\",\n      \"index\" : 0,\n      \"status\" : \"failed\",\n      \"timedout\" : null,\n      \"infrastructure_fail\" : null,\n      \"type\" : \"test\",\n      \"source\" : \"inference\",\n      \"failed\" : true\n    } ]\n  } ],\n}\n```\n\n#### [retry](#retry)\n\nEndpoint: `/project/:username/:repository/:build/retry`\n\nRetries the build, returns a summary of the new build.\n\n```ruby\n# Use global config with token for user\nbuild = CircleCi::Build.new 'username', 'reponame', nil, 'build'\nres = build.retry\n\n# Use a different config with another user token\nbuild = CircleCi::Build.new 'username', 'reponame', nil, 'build', other_build_config\nbuild.retry\n```\n\nExample response\n\n```js\n{\n  \"vcs_url\" : \"https://github.com/circleci/mongofinil\",\n  \"build_url\" : \"https://circleci.com/gh/circleci/mongofinil/23\",\n  \"build_num\" : 23,\n  \"branch\" : \"master\",\n  \"vcs_revision\" : \"1d231626ba1d2838e599c5c598d28e2306ad4e48\",\n  \"committer_name\" : \"Allen Rohner\",\n  \"committer_email\" : \"arohner@gmail.com\",\n  \"subject\" : \"Don't explode when the system clock shifts backwards\",\n  \"body\" : \"\", // commit message body\n  \"why\" : \"retry\", // short string explaining the reason we built\n  \"dont_build\" : null, // reason why we didn't build, if we didn't build\n  \"queued_at\" : \"2013-04-12T21:33:30Z\" // time build was queued\n  \"start_time\" : \"2013-04-12T21:33:38Z\", // time build started running\n  \"stop_time\" : \"2013-04-12T21:34:01Z\", // time build finished running\n  \"build_time_millis\" : 23505,\n  \"lifecycle\" : \"queued\",\n  \"outcome\" : null,\n  \"status\" : \"queued\",\n  \"retry_of\" : 22, // build_num of the build this is a retry of\n  \"previous\" : { // previous build\n    \"status\" : \"failed\",\n    \"build_num\" : 22\n  }\n```\n\n#### [tests](#tests)\n\nEndpoint: `/project/:username/:repository/:build/tests`\n\nTests endpoint to get the recorded tests for a build. Will return an array of\nthe tests ran and some details.\n\n```ruby\n# Use global config with token for user\nbuild = CircleCi::Build.new 'username', 'reponame', nil, 'build'\nres = build.tests\n\n# Use a different config with another user token\nbuild = CircleCi::Build.new 'username', 'reponame', nil, 'build', other_build_config\nbuild.tests\n```\n\n```js\n[\n  {\n    \"message\" =\u003e nil,\n    \"file\" =\u003e \"spec/unit/user_spec.rb\",\n    \"source\" =\u003e \"rspec\",\n    \"run_time\" =\u003e 0.240912,\n    \"result\" =\u003e \"success\",\n    \"name\" =\u003e \"user creation\",\n    \"classname\"=\u003e \"spec.unit.user_spec\"\n  },\n  {\n    \"message\" =\u003e \"Unable to update user\",\n    \"file\" =\u003e \"spec/unit/user_spec.rb\",\n    \"source\"=\u003e\"rspec\",\n    \"run_time\"=\u003e5.58533,\n    \"result\"=\u003e\"failure\",\n    \"name\"=\u003e\"user update\",\n    \"classname\"=\u003e\"spec.unit.user_spec\"\n  }\n]\n```\n\n### [recent_builds](#recent_builds)\n\n#### [get_recent_builds](#get_recent_builds)\n\nEndpoint: `/recent-builds`\n\nBuild summary for each of the last 30 recent builds, ordered by build_num.\n\n```ruby\n# Use global config with token for user\nrecent = CircleCi::RecentBuilds.new\nres = recent.get\n\n# Params of limit and offset can be passed in\nres = recent.get limit: 10, offset: 50\n\n# Use a different config with another user token\nrecent = CircleCi::RecentBuilds.new other_builds_config\nrecent.get\n```\n\n```js\n[ {\n  \"vcs_url\" : \"https://github.com/circleci/mongofinil\",\n  \"build_url\" : \"https://circleci.com/gh/circleci/mongofinil/22\",\n  \"build_num\" : 22,\n  \"branch\" : \"master\",\n  \"vcs_revision\" : \"1d231626ba1d2838e599c5c598d28e2306ad4e48\",\n  \"committer_name\" : \"Allen Rohner\",\n  \"committer_email\" : \"arohner@gmail.com\",\n  \"subject\" : \"Don't explode when the system clock shifts backwards\",\n  \"body\" : \"\", // commit message body\n  \"why\" : \"github\", // short string explaining the reason we built\n  \"dont_build\" : null, // reason why we didn't build, if we didn't build\n  \"queued_at\" : \"2013-02-12T21:33:30Z\" // time build was queued\n  \"start_time\" : \"2013-02-12T21:33:38Z\", // time build started\n  \"stop_time\" : \"2013-02-12T21:34:01Z\", // time build finished\n  \"build_time_millis\" : 23505,\n  \"username\" : \"circleci\",\n  \"reponame\" : \"mongofinil\",\n  \"lifecycle\" : \"finished\", // :queued, :scheduled, :not_run, :not_running, :running or :finished\n  \"outcome\" : \"failed\", // :canceled, :infrastructure_fail, :timedout, :failed, :no_tests or :success\n  \"status\" : \"failed\", // :retried, :canceled, :infrastructure_fail, :timedout, :not_run, :running, :failed, :queued, :scheduled, :not_running, :no_tests, :fixed, :success\n  \"retry_of\" : null, // build_num of the build this is a retry of\n  \"previous\" : { // previous build\n    \"status\" : \"failed\",\n    \"build_num\" : 21\n  }, ... ]\n```\n\n### Tests\n\nTests are ran using Rspec and VCR for API interaction recording.\nRun using `rake` or `rspec`. Please add tests for any new features or\nendpoints added if you are contributing. Code styling is enforced with RuboCop\nand uses a checked in `.rubocop.yml` for this project.\n\nTests are using a live CircleCi API token for this repository. Any tests\nshould be using this key, which is in the `.env` file. You should not have\nto do anything outside of writing the tests against this repository.\n\n\n[docs]: http://www.rubydoc.info/gems/circleci\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtchavez%2Fcircleci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtchavez%2Fcircleci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtchavez%2Fcircleci/lists"}