forked from octokit/octokit.rb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement new "create orgs" admin API
- Loading branch information
1 parent
fd161f1
commit 02685ee
Showing
4 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module Octokit | ||
class EnterpriseAdminClient | ||
|
||
# Methods for the Enterprise Orgs API | ||
# | ||
# @see https://developer.github.com/v3/enterprise/orgs/ | ||
module Orgs | ||
|
||
# Create a new organization on the instance. | ||
# | ||
# options [Hash] A set of options. | ||
# @option options [String] :login The organization's username. | ||
# @option options [String] :admin The login of the user who will manage this organization. | ||
# @option options [String] :profile_name The organization's display name. | ||
# @return [nil] | ||
# @see https://developer.github.com/v3/enterprise/orgs/#create-an-organization | ||
# @example | ||
# @admin_client.create_organization({:login => 'GitHub', :admin => 'monalisaoctocat'}) | ||
def create_organization(options) | ||
post "admin/organizations", options | ||
end | ||
|
||
end | ||
end | ||
end |
1 change: 1 addition & 0 deletions
1
spec/cassettes/Octokit_EnterpriseAdminClient_Orgs/_orgs/creates_a_new_organization.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"http_interactions":[{"request":{"method":"post","uri":"<<ENTERPRISE_HOSTNAME>>admin/organizations","body":{"encoding":"UTF-8","base64_string":"eyJsb2dpbiI6IlN1Y2hBR3JlYXRPcmciLCJhZG1pbiI6Ijw8RU5URVJQUklT\nRV9HSVRIVUJfTE9HSU4+PiJ9\n"},"headers":{"User-Agent":["Octokit Ruby Gem 4.0.1"],"Accept":["application/vnd.github.v3+json"],"Content-Type":["application/json"],"Authorization":["token <<ENTERPRISE_ACCESS_TOKEN>>"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":201,"message":"Created"},"headers":{"Server":["GitHub.com"],"Date":["Thu, 30 Jul 2015 05:50:55 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["433"],"Status":["201 Created"],"Cache-Control":["private, max-age=60, s-maxage=60"],"Etag":["\"227aec99c94afb9f3c762c8c9c44f5b9\""],"X-Oauth-Scopes":["admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, repo, user"],"X-Accepted-Oauth-Scopes":[""],"Location":["<<ENTERPRISE_HOSTNAME>>orgs/SuchAGreatOrg"],"Vary":["Accept, Authorization, Cookie, X-GitHub-OTP"],"X-Github-Media-Type":["github.v3; format=json"],"X-Xss-Protection":["1; mode=block"],"X-Frame-Options":["deny"],"Content-Security-Policy":["default-src 'none'"],"Access-Control-Allow-Credentials":["true"],"Access-Control-Expose-Headers":["ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"],"Access-Control-Allow-Origin":["*"],"X-Github-Request-Id":["c9acf209-e8c8-4453-9c68-bbde01a216a0"],"Strict-Transport-Security":["max-age=31536000; includeSubdomains; preload"],"X-Content-Type-Options":["nosniff"]},"body":{"encoding":"UTF-8","base64_string":"eyJsb2dpbiI6IlN1Y2hBR3JlYXRPcmciLCJpZCI6NTEzLCJ1cmwiOiI8PEVO\nVEVSUFJJU0VfSE9TVE5BTUU+Pm9yZ3MvU3VjaEFHcmVhdE9yZyIsInJlcG9z\nX3VybCI6Ijw8RU5URVJQUklTRV9IT1NUTkFNRT4+b3Jncy9TdWNoQUdyZWF0\nT3JnL3JlcG9zIiwiZXZlbnRzX3VybCI6Ijw8RU5URVJQUklTRV9IT1NUTkFN\nRT4+b3Jncy9TdWNoQUdyZWF0T3JnL2V2ZW50cyIsIm1lbWJlcnNfdXJsIjoi\nPDxFTlRFUlBSSVNFX0hPU1ROQU1FPj5vcmdzL1N1Y2hBR3JlYXRPcmcvbWVt\nYmVyc3svbWVtYmVyfSIsInB1YmxpY19tZW1iZXJzX3VybCI6Ijw8RU5URVJQ\nUklTRV9IT1NUTkFNRT4+b3Jncy9TdWNoQUdyZWF0T3JnL3B1YmxpY19tZW1i\nZXJzey9tZW1iZXJ9IiwiYXZhdGFyX3VybCI6Imh0dHBzOi8vYXZhdGFycy5n\naGUuaW8vdS81MTM/IiwiZGVzY3JpcHRpb24iOm51bGx9\n"},"http_version":null},"recorded_at":"Thu, 30 Jul 2015 05:50:55 GMT"}],"recorded_with":"VCR 2.9.3"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require "helper" | ||
|
||
describe Octokit::EnterpriseAdminClient::Orgs do | ||
|
||
before do | ||
Octokit.reset! | ||
@admin_client = enterprise_admin_client | ||
end | ||
|
||
describe ".orgs", :vcr do | ||
it "creates a new organization" do | ||
@admin_client.create_organization({:login => 'SuchAGreatOrg', :admin => 'gjtorikian'}) | ||
expect(@admin_client.last_response.status).to eq(201) | ||
assert_requested :post, github_enterprise_url("admin/organizations") | ||
end | ||
end # .license | ||
end |