Module: Octokit::EnterpriseAdminClient::Users

Included in:
Octokit::EnterpriseAdminClient
Defined in:
lib/octokit/enterprise_admin_client/users.rb

Overview

Methods for the Enterprise User Administration API

Instance Method Summary collapse

Instance Method Details

#create_impersonation_token(login, options = {}) ⇒ Object

Creates an impersonation OAuth token.

Examples:

@admin_client.create_impersonation_token('foobar', {:scopes => ['repo:write']})

See Also:


94
95
96
# File 'lib/octokit/enterprise_admin_client/users.rb', line 94

def create_impersonation_token(, options = {})
  post "admin/users/#{login}/authorizations", options
end

#create_user(login, email, options = {}) ⇒ Object

Create a new user.

Examples:

@admin_client.create_user('foobar', '[email protected]')

See Also:


15
16
17
18
19
# File 'lib/octokit/enterprise_admin_client/users.rb', line 15

def create_user(, email, options = {})
  options[:login] = 
  options[:email] = email
  post "admin/users", options
end

#delete_impersonation_token(login, options = {}) ⇒ Object

Deletes an impersonation OAuth token.

Examples:

@admin_client.delete_impersonation_token('foobar')

See Also:


104
105
106
# File 'lib/octokit/enterprise_admin_client/users.rb', line 104

def delete_impersonation_token(, options = {})
  boolean_from_response :delete, "admin/users/#{login}/authorizations", options
end

#delete_key(id, options = {}) ⇒ Object

Deletes a public SSH keys.

Examples:

@admin_client.delete_key(1)

See Also:


123
124
125
# File 'lib/octokit/enterprise_admin_client/users.rb', line 123

def delete_key(id, options = {})
  boolean_from_response :delete,  "admin/keys/#{id}", options
end

#delete_user(username, options = {}) ⇒ Object

Deletes a user.

Examples:

@admin_client.delete_key(1)

See Also:


61
62
63
# File 'lib/octokit/enterprise_admin_client/users.rb', line 61

def delete_user(username, options = {})
  boolean_from_response :delete,  "admin/users/#{username}", options
end

#demote(user, options = {}) ⇒ Boolean

Demote a site administrator to an ordinary user


39
40
41
# File 'lib/octokit/enterprise_admin_client/users.rb', line 39

def demote(user, options = {})
  boolean_from_response :delete, "users/#{user}/site_admin", options
end

#list_all_keys(options = {}) ⇒ Object

Lists all the public SSH keys.

Examples:

@admin_client.list_all_keys

See Also:


113
114
115
# File 'lib/octokit/enterprise_admin_client/users.rb', line 113

def list_all_keys(options = {})
  get "admin/keys", options
end

#promote(user, options = {}) ⇒ Boolean

Promote an ordinary user to a site administrator


28
29
30
# File 'lib/octokit/enterprise_admin_client/users.rb', line 28

def promote(user, options = {})
  boolean_from_response :put, "users/#{user}/site_admin", options
end

#rename_user(old_login, new_login, options = {}) ⇒ Object

Rename a user.

Examples:

@admin_client.rename_user('foobar', 'foofoobar')

See Also:


50
51
52
53
# File 'lib/octokit/enterprise_admin_client/users.rb', line 50

def rename_user(, , options = {})
  options[:login] = 
  patch "admin/users/#{old_login}", options
end

#suspend(user, options = {}) ⇒ Boolean

Suspend a user.

Examples:

@admin_client.suspend('holman')

See Also:


72
73
74
# File 'lib/octokit/enterprise_admin_client/users.rb', line 72

def suspend(user, options = {})
  boolean_from_response :put, "users/#{user}/suspended", options
end

#unsuspend(user, options = {}) ⇒ Boolean

Unsuspend a user.

Examples:

@admin_client.unsuspend('holman')

See Also:


83
84
85
# File 'lib/octokit/enterprise_admin_client/users.rb', line 83

def unsuspend(user, options = {})
  boolean_from_response :delete, "users/#{user}/suspended", options
end