Module: Octokit::Client::Organizations

Included in:
Octokit::Client
Defined in:
lib/octokit/client/organizations.rb

Instance Method Summary collapse

Instance Method Details

#add_team_member(team_id, user, options = {}) ⇒ Object



65
66
67
# File 'lib/octokit/client/organizations.rb', line 65

def add_team_member(team_id, user, options={})
  post("/api/v2/json/teams/#{team_id}/members", options.merge({:name => user}))['user']
end

#add_team_repository(team_id, repo, options = {}) ⇒ Object Also known as: add_team_repo



78
79
80
# File 'lib/octokit/client/organizations.rb', line 78

def add_team_repository(team_id, repo, options={})
  post("/api/v2/json/teams/#{team_id}/repositories", options.merge(:name => Repository.new(repo)))['repositories']
end

#create_team(org, values, options = {}) ⇒ Object



45
46
47
# File 'lib/octokit/client/organizations.rb', line 45

def create_team(org, values, options={})
  post("/api/v2/json/organizations/#{org}/teams", options.merge({:team => values}))['team']
end

#delete_team(team_id, options = {}) ⇒ Object



57
58
59
# File 'lib/octokit/client/organizations.rb', line 57

def delete_team(team_id, options={})
  delete("/api/v2/json/teams/#{team_id}", options)['team']
end

#organization(org, options = {}) ⇒ Object Also known as: org



4
5
6
# File 'lib/octokit/client/organizations.rb', line 4

def organization(org, options={})
  get("/api/v2/json/organizations/#{org}", options)['organization']
end

#organization_members(org, options = {}) ⇒ Object Also known as: org_members



35
36
37
# File 'lib/octokit/client/organizations.rb', line 35

def organization_members(org, options={})
  get("/api/v2/json/organizations/#{org}/public_members", options)['users']
end

#organization_repositories(org = nil, options = {}) ⇒ Object Also known as: org_repositories, org_repos



25
26
27
28
29
30
31
# File 'lib/octokit/client/organizations.rb', line 25

def organization_repositories(org=nil, options={})
  if org
    get("/api/v2/json/organizations/#{org}/public_repositories", options)
  else
    get("/api/v2/json/organizations/repositories", options)
  end['repositories']
end

#organization_teams(org, options = {}) ⇒ Object Also known as: org_teams



40
41
42
# File 'lib/octokit/client/organizations.rb', line 40

def organization_teams(org, options={})
  get("/api/v2/json/organizations/#{org}/teams", options)['teams']
end

#organizations(user = nil, options = {}) ⇒ Object Also known as: list_organizations, list_orgs, orgs



14
15
16
17
18
19
20
# File 'lib/octokit/client/organizations.rb', line 14

def organizations(user=nil, options={})
  if user
    get("/api/v2/json/user/show/#{user}/organizations", options)
  else
    get("/api/v2/json/organizations", options)
  end['organizations']
end

#remove_team_member(team_id, user, options = {}) ⇒ Object



69
70
71
# File 'lib/octokit/client/organizations.rb', line 69

def remove_team_member(team_id, user, options={})
  delete("/api/v2/json/teams/#{team_id}/members", options.merge({:name => user}))['user']
end

#remove_team_repository(team_id, repo, options = {}) ⇒ Object Also known as: remove_team_repo



83
84
85
# File 'lib/octokit/client/organizations.rb', line 83

def remove_team_repository(team_id, repo, options={})
  delete("/api/v2/json/teams/#{team_id}/repositories", options.merge(:name => Repository.new(repo)))['repositories']
end

#team(team_id, options = {}) ⇒ Object



49
50
51
# File 'lib/octokit/client/organizations.rb', line 49

def team(team_id, options={})
  get("/api/v2/json/teams/#{team_id}", options)['team']
end

#team_members(team_id, options = {}) ⇒ Object



61
62
63
# File 'lib/octokit/client/organizations.rb', line 61

def team_members(team_id, options={})
  get("/api/v2/json/teams/#{team_id}/members", options)['users']
end

#team_repositories(team_id, options = {}) ⇒ Object Also known as: team_repos



73
74
75
# File 'lib/octokit/client/organizations.rb', line 73

def team_repositories(team_id, options={})
  get("/api/v2/json/teams/#{team_id}/repositories", options)['repositories']
end

#update_organization(org, values, options = {}) ⇒ Object Also known as: update_org



9
10
11
# File 'lib/octokit/client/organizations.rb', line 9

def update_organization(org, values, options={})
  put("/api/v2/json/organizations/#{org}", options.merge({:organization => values}))['organization']
end

#update_team(team_id, values, options = {}) ⇒ Object



53
54
55
# File 'lib/octokit/client/organizations.rb', line 53

def update_team(team_id, values, options={})
  put("/api/v2/json/teams/#{team_id}", options.merge({:team => values}))['team']
end