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



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

def add_team_member(team_id, user, options={})
  # There's a bug in this API call. The docs say to leave the body blank,
  # but it fails if the body is both blank and the content-length header
  # is not 0.
  put("teams/#{team_id}/members/#{user}", options.merge({:name => user}), 3, true, raw=true).status == 204
end

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



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

def add_team_repository(team_id, repo, options={})
  put("teams/#{team_id}/repos/#{Repository.new(repo)}", options.merge(:name => Repository.new(repo)), 3, true, raw=true).status == 204
end

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



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

def create_team(org, options={})
  post("orgs/#{org}/teams", options, 3)
end

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



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

def delete_team(team_id, options={})
  delete("teams/#{team_id}", options, 3, true, true)
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("orgs/#{org}", options, 3)
end

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



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

def organization_members(org, options={})
  get("orgs/#{org}/members", options, 3)
end

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



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

def organization_repositories(org=nil, options={})
  if org.nil?
    warn 'DEPRECATED: Please pass org name to list repos.'
    get("/api/v2/json/organizations/repositories", options, 2)
  else
    get("orgs/#{org}/repos", options, 3)
  end
end

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



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

def organization_teams(org, options={})
  get("orgs/#{org}/teams", options, 3)
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("users/#{user}/orgs", options, 3)
  else
    get("user/orgs", options, 3)
  end
end

#publicize_membership(org, user, options = {}) ⇒ Object



92
93
94
# File 'lib/octokit/client/organizations.rb', line 92

def publicize_membership(org, user, options={})
  put("orgs/#{org}/public_members/#{user}", options, 3, true, raw=true).status == 204
end

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



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

def remove_team_member(team_id, user, options={})
  delete("teams/#{team_id}/members/#{user}", options, 3, true, raw=true).status == 204
end

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



87
88
89
# File 'lib/octokit/client/organizations.rb', line 87

def remove_team_repository(team_id, repo, options={})
  delete("teams/#{team_id}/repos/#{Repository.new(repo)}", options, 3, true, raw=true).status == 204
end

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



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

def team(team_id, options={})
  get("teams/#{team_id}", options, 3)
end

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



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

def team_members(team_id, options={})
  get("teams/#{team_id}/members", options, 3)
end

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



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

def team_repositories(team_id, options={})
  get("teams/#{team_id}/repos", options, 3)
end

#unpublicize_membership(org, user, options = {}) ⇒ Object Also known as: conceal_membership



96
97
98
# File 'lib/octokit/client/organizations.rb', line 96

def unpublicize_membership(org, user, options={})
  delete("orgs/#{org}/public_members/#{user}", options, 3, true, raw=true).status == 204
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={})
  patch("orgs/#{org}", options.merge({:organization => values}), 3)
end

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



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

def update_team(team_id, options={})
  patch("teams/#{team_id}", options, 3)
end