diff --git a/README.md b/README.md index 2a099f5..7926e84 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,6 @@ end * [Tests](#tests) * [Recent Builds](#recent_builds) * [Get](#recent_builds_get) -* [Organization](#organization) ### [User](#user) @@ -1026,165 +1025,6 @@ res.body }, ... ] ``` -### [organization](#organization) - -Endpoint: `/organization/:name` - -Recent builds for an entire organization - -```ruby -res = CircleCi.organization 'my-org' -res.succes? -res.body -``` - -```javascript -[ - { - "dont_build":null, - "committer_name":"Chavez", - "usage_queued_at":"2014-04-12T10:29:59.352Z", - "branch":"master", - "body":"Update Missing ''e'' in CircleCi in README.md", - "author_date":"2014-03-12T23:14:53Z", - "node":[ - { - "username":"ubuntu", - "ssh_enabled":null, - "port":64721, - "public_ip_addr":"54.82.224.94" - } - ], - "committer_date":"2014-03-12T23:14:53Z", - "compare":null, - "retries":null, - "parallel":1, - "committer_email":"mtchavez@users.noreply.github.com", - "build_time_millis":16308, - "why":"retry", - "author_email":"mtchavez@users.noreply.github.com", - "ssh_enabled":null, - "start_time":"2014-04-12T10:29:59.587Z", - "stop_time":"2014-04-12T10:30:15.895Z", - "lifecycle":"finished", - "user":{ - "is_user":true, - "login":"hwartig", - "name":"Harald Wartig", - "email":"hwartig@users.noreply.github.com" - }, - "subject":"Merge pull request #4 from Alex-Poon/master", - "messages":[ - - ], - "job_name":null, - "retry_of":1, - "previous_successful_build":{ - "build_time_millis":37685, - "status":"success", - "build_num":1 - }, - "outcome":"success", - "status":"success", - "vcs_revision":"f33617404dc392ddd676fdde87cd5c87369e1857", - "build_num":2, - "username":"hwartigcom", - "vcs_url":"https://github.com/hwartigcom/circleci", - "timedout":false, - "previous":{ - "build_time_millis":37685, - "status":"success", - "build_num":1 - }, - "canceled":false, - "infrastructure_fail":false, - "failed":null, - "reponame":"circleci", - "build_url":"https://circleci.com/gh/hwartigcom/circleci/2", - "feature_flags":{ - - }, - "author_name":"Chavez", - "queued_at":"2014-04-12T10:29:59.517Z" - }, - { - "dont_build":null, - "committer_name":"Chavez", - "usage_queued_at":"2014-04-08T06:58:09.522Z", - "branch":"master", - "body":"Update Missing ''e'' in CircleCi in README.md", - "author_date":"2014-03-12T23:14:53Z", - "node":[ - { - "username":"ubuntu", - "ssh_enabled":null, - "port":64775, - "public_ip_addr":"54.198.9.232" - } - ], - "committer_date":"2014-03-12T23:14:53Z", - "compare":null, - "retries":[ - 2 - ], - "parallel":1, - "committer_email":"mtchavez@users.noreply.github.com", - "build_time_millis":37685, - "why":"first-build", - "author_email":"mtchavez@users.noreply.github.com", - "ssh_enabled":null, - "start_time":"2014-04-08T06:58:09.868Z", - "stop_time":"2014-04-08T06:58:47.553Z", - "lifecycle":"finished", - "user":{ - "is_user":true, - "login":"hwartig", - "name":"Harald Wartig", - "email":"hwartig@users.noreply.github.com" - }, - "subject":"Merge pull request #4 from Alex-Poon/master", - "messages":[ - - ], - "job_name":null, - "retry_of":null, - "previous_successful_build":null, - "outcome":"success", - "status":"success", - "vcs_revision":"f33617404dc392ddd676fdde87cd5c87369e1857", - "build_num":1, - "username":"hwartigcom", - "vcs_url":"https://github.com/hwartigcom/circleci", - "timedout":false, - "previous":null, - "all_commit_details":[ - { - "committer_name":"Chavez", - "body":"Update Missing ''e'' in CircleCi in README.md", - "author_date":"2014-03-12T23:14:53Z", - "committer_date":"2014-03-12T23:14:53Z", - "commit_url":"https://github.com/hwartigcom/circleci/commit/f33617404dc392ddd676fdde87cd5c87369e1857", - "committer_email":"mtchavez@users.noreply.github.com", - "author_email":"mtchavez@users.noreply.github.com", - "subject":"Merge pull request #4 from Alex-Poon/master", - "commit":"f33617404dc392ddd676fdde87cd5c87369e1857", - "author_name":"Chavez" - } - ], - "canceled":false, - "infrastructure_fail":false, - "failed":null, - "reponame":"circleci", - "build_url":"https://circleci.com/gh/hwartigcom/circleci/1", - "feature_flags":{ - - }, - "author_name":"Chavez", - "queued_at":"2014-04-08T06:58:09.739Z" - } -] -``` - ### Tests Tests are ran using Rspec and VCR for API interaction recording. diff --git a/lib/circleci.rb b/lib/circleci.rb index 08f9ba4..72c45e7 100644 --- a/lib/circleci.rb +++ b/lib/circleci.rb @@ -43,18 +43,4 @@ def config def http # @private Http.new(config) end - - ## - # - # Get recent builds for an organization - # - # @param name [String] Name of the organization. Currently CircleCi treats - # the name case sensetive so make sure the spelling is the same - # as the github organisation. - # @param params [Hash] Additional query params. - # @return [CircleCi::Response] - Response object. - - def organization(name, params = {}) - http.get "/organization/#{name}", params - end end diff --git a/spec/cassettes/organization.yml b/spec/cassettes/organization.yml deleted file mode 100644 index 1c6653a..0000000 --- a/spec/cassettes/organization.yml +++ /dev/null @@ -1,57 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://circleci.com/api/v1/organization/orga-name?circle-token=d121d128bf0b9d185cbad163fa410d958a30d37d - body: - encoding: US-ASCII - string: '' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - content-type: - - application/json - user-agent: - - Ruby - response: - status: - code: 200 - message: OK - headers: - access-control-allow-origin: - - "*" - content-type: - - application/json; charset=utf-8 - date: - - Tue, 08 Apr 2014 10:37:01 GMT - server: - - nginx - set-cookie: - - ring-session=8qNBwmsYHoiwqrsiEMzDRLsK9C3wdmnvD1V8TmwQA%2BH9uNSN1790BXVK6SULi1%2BE4z3vDSKbqDK90kLNHZonI0s2JZLrqldO7WNXzS1Jih4%3D--HYt%2FZ1OPp0lD9wfXbULTA%2FS1iWSR4WlM3Rk6iQWycV8%3D;Secure;Max-Age=31536000;Expires=Wed, - 08 Apr 2015 08:13:36 +0000;HttpOnly;Path=/ - x-circleci-identity: - - i-d4aa9b85 - x-frame-options: - - DENY - x-route: - - "/api/v1/organization/:username" - content-length: - - '2' - connection: - - keep-alive - body: - encoding: UTF-8 - string: '[{"dont_build":null,"committer_name":"Chavez","usage_queued_at":"2014-04-12T10:29:59.352Z","branch":"master","body":"Update - Missing ''e'' in CircleCi in README.md","author_date":"2014-03-12T23:14:53Z","node":[{"username":"ubuntu","ssh_enabled":null,"port":64721,"public_ip_addr":"54.82.224.94"}],"committer_date":"2014-03-12T23:14:53Z","compare":null,"retries":null,"parallel":1,"committer_email":"mtchavez@users.noreply.github.com","build_time_millis":16308,"why":"retry","author_email":"mtchavez@users.noreply.github.com","ssh_enabled":null,"start_time":"2014-04-12T10:29:59.587Z","stop_time":"2014-04-12T10:30:15.895Z","lifecycle":"finished","user":{"is_user":true,"login":"hwartig","name":"Harald - Wartig","email":"hwartig@users.noreply.github.com"},"subject":"Merge pull request #4 from - Alex-Poon/master","messages":[],"job_name":null,"retry_of":1,"previous_successful_build":{"build_time_millis":37685,"status":"success","build_num":1},"outcome":"success","status":"success","vcs_revision":"f33617404dc392ddd676fdde87cd5c87369e1857","build_num":2,"username":"hwartigcom","vcs_url":"https://github.com/hwartigcom/circleci","timedout":false,"previous":{"build_time_millis":37685,"status":"success","build_num":1},"canceled":false,"infrastructure_fail":false,"failed":null,"reponame":"circleci","build_url":"https://circleci.com/gh/hwartigcom/circleci/2","feature_flags":{},"author_name":"Chavez","queued_at":"2014-04-12T10:29:59.517Z"},{"dont_build":null,"committer_name":"Chavez","usage_queued_at":"2014-04-08T06:58:09.522Z","branch":"master","body":"Update - Missing ''e'' in CircleCi in README.md","author_date":"2014-03-12T23:14:53Z","node":[{"username":"ubuntu","ssh_enabled":null,"port":64775,"public_ip_addr":"54.198.9.232"}],"committer_date":"2014-03-12T23:14:53Z","compare":null,"retries":[2],"parallel":1,"committer_email":"mtchavez@users.noreply.github.com","build_time_millis":37685,"why":"first-build","author_email":"mtchavez@users.noreply.github.com","ssh_enabled":null,"start_time":"2014-04-08T06:58:09.868Z","stop_time":"2014-04-08T06:58:47.553Z","lifecycle":"finished","user":{"is_user":true,"login":"hwartig","name":"Harald - Wartig","email":"hwartig@users.noreply.github.com"},"subject":"Merge pull request #4 from - Alex-Poon/master","messages":[],"job_name":null,"retry_of":null,"previous_successful_build":null,"outcome":"success","status":"success","vcs_revision":"f33617404dc392ddd676fdde87cd5c87369e1857","build_num":1,"username":"hwartigcom","vcs_url":"https://github.com/hwartigcom/circleci","timedout":false,"previous":null,"all_commit_details":[{"committer_name":"Chavez","body":"Update - Missing ''e'' in CircleCi in README.md","author_date":"2014-03-12T23:14:53Z","committer_date":"2014-03-12T23:14:53Z","commit_url":"https://github.com/hwartigcom/circleci/commit/f33617404dc392ddd676fdde87cd5c87369e1857","committer_email":"mtchavez@users.noreply.github.com","author_email":"mtchavez@users.noreply.github.com","subject":"Merge - pull request #4 from Alex-Poon/master","commit":"f33617404dc392ddd676fdde87cd5c87369e1857","author_name":"Chavez"}],"canceled":false,"infrastructure_fail":false,"failed":null,"reponame":"circleci","build_url":"https://circleci.com/gh/hwartigcom/circleci/1","feature_flags":{},"author_name":"Chavez","queued_at":"2014-04-08T06:58:09.739Z"}]' - http_version: '1.1' - recorded_at: Tue, 08 Apr 2014 10:37:01 GMT -recorded_with: VCR 2.9.0 diff --git a/spec/circleci_spec.rb b/spec/circleci_spec.rb index c857ec8..74c00e3 100644 --- a/spec/circleci_spec.rb +++ b/spec/circleci_spec.rb @@ -18,20 +18,4 @@ CircleCi.config.token.should eql 'new-key' end end - - describe 'organization', vcr: { cassette_name: 'organization', record: :none } do - subject { CircleCi.organization(ENV['ORGANIZATION'] || 'orga-name') } - let(:body) { subject.body } - - it { should be_an_instance_of(CircleCi::Response) } - it { should be_success } - - it 'returns a list of recent builds' do - expect(body).to be_an_instance_of(Array) - expect(body.size).to eq(2) - expect(body.first).to have_key('username') - expect(body.first).to have_key('reponame') - expect(body.first).to have_key('vcs_url') - end - end end