Module: Octokit::Client::Repositories

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

Instance Method Summary collapse

Instance Method Details

#add_collaborator(repo, collaborator, options = {}) ⇒ Object Also known as: add_collab



99
100
101
# File 'lib/octokit/client/repositories.rb', line 99

def add_collaborator(repo, collaborator, options={})
  put "/repos/#{Repository.new repo}/collaborators/#{collaborator}", options, 3
end

#add_deploy_key(repo, title, key, options = {}) ⇒ Object



86
87
88
# File 'lib/octokit/client/repositories.rb', line 86

def add_deploy_key(repo, title, key, options={})
  post "/repos/#{Repository.new repo}/keys", options.merge(:title => title, :key => key), 3
end

#branches(repo, options = {}) ⇒ Object



141
142
143
# File 'lib/octokit/client/repositories.rb', line 141

def branches(repo, options={})
  get "/repos/#{Repository.new repo}/branches", options, 3
end

#collaborators(repo, options = {}) ⇒ Object Also known as: collabs



94
95
96
# File 'lib/octokit/client/repositories.rb', line 94

def collaborators(repo, options={})
  get "/repos/#{Repository.new repo}/collaborators", options, 3
end

#contributors(repo, anon = false, options = {}) ⇒ Object Also known as: contribs



119
120
121
# File 'lib/octokit/client/repositories.rb', line 119

def contributors(repo, anon=false, options={})
  get "/repos/#{Repository.new repo}/contributors", options.merge(:anon => anon), 3
end

#create_repository(name, options = {}) ⇒ Object Also known as: create_repo, create



44
45
46
47
48
49
50
51
52
53
# File 'lib/octokit/client/repositories.rb', line 44

def create_repository(name, options={})
  organization = options.delete :organization
  options.merge! :name => name

  if organization.nil?
    post '/user/repos', options, 3
  else
    post "/orgs/#{organization}/repos", options, 3
  end
end

#delete_repository(repo, options = {}) ⇒ Object Also known as: delete_repo



57
58
59
60
61
62
63
64
# File 'lib/octokit/client/repositories.rb', line 57

def delete_repository(repo, options={})
  response = post("/api/v2/json/repos/delete/#{Repository.new(repo)}", options)
  if response.respond_to?(:delete_token)
    response['delete_token']
  else
    response
  end
end

#delete_repository!(repo, options = {}) ⇒ Object Also known as: delete_repo!



67
68
69
70
# File 'lib/octokit/client/repositories.rb', line 67

def delete_repository!(repo, options={})
  delete_token = delete_repository(repo, options)
  post("/api/v2/json/repos/delete/#{Repository.new(repo)}", options.merge(:delete_token => delete_token))
end

#deploy_keys(repo, options = {}) ⇒ Object Also known as: list_deploy_keys



81
82
83
# File 'lib/octokit/client/repositories.rb', line 81

def deploy_keys(repo, options={})
  get "/repos/#{Repository.new repo}/keys", options, 3
end

#edit_repository(repo, options = {}) ⇒ Object Also known as: edit, update_repository, update



14
15
16
# File 'lib/octokit/client/repositories.rb', line 14

def edit_repository(repo, options={})
  patch "/repos/#{Repository.new repo}", options, 3
end

#fork(repo, options = {}) ⇒ Object



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

def fork(repo, options={})
  post "/repos/#{Repository.new repo}/forks", options, 3
end

#forks(repo, options = {}) ⇒ Object Also known as: network



128
129
130
# File 'lib/octokit/client/repositories.rb', line 128

def forks(repo, options={})
  get "/repos/#{Repository.new repo}/forks", options, 3
end

#languages(repo, options = {}) ⇒ Object



133
134
135
# File 'lib/octokit/client/repositories.rb', line 133

def languages(repo, options={})
  get "/repos/#{Repository.new repo}/languages", options, 3
end

#pushable(options = {}) ⇒ Object



109
110
111
# File 'lib/octokit/client/repositories.rb', line 109

def pushable(options={})
  get("/api/v2/json/repos/pushable", options)['repositories']
end

#remove_collaborator(repo, collaborator, options = {}) ⇒ Object Also known as: remove_collab



104
105
106
# File 'lib/octokit/client/repositories.rb', line 104

def remove_collaborator(repo, collaborator, options={})
  delete "/repos/#{Repository.new repo}/collaborators/#{collaborator}", options, 3
end

#remove_deploy_key(repo, id, options = {}) ⇒ Object



90
91
92
# File 'lib/octokit/client/repositories.rb', line 90

def remove_deploy_key(repo, id, options={})
  delete "/repos/#{Repository.new repo}/keys/#{id}", options, 3
end

#repositories(username = nil, options = {}) ⇒ Object Also known as: list_repositories, list_repos, repos



21
22
23
24
25
26
27
# File 'lib/octokit/client/repositories.rb', line 21

def repositories(username=nil, options={})
  if username.nil?
    get '/user/repos', options, 3
  else
    get "/users/#{username}/repos", options, 3
  end
end

#repository(repo, options = {}) ⇒ Object Also known as: repo



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

def repository(repo, options={})
  get "/repos/#{Repository.new repo}", options, 3
end

#repository_teams(repo, options = {}) ⇒ Object Also known as: repo_teams, teams



113
114
115
# File 'lib/octokit/client/repositories.rb', line 113

def repository_teams(repo, options={})
  get "/repos/#{Repository.new repo}/teams", options, 3
end

#search_repositories(q, options = {}) ⇒ Object Also known as: search_repos



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

def search_repositories(q, options={})
  get("/api/v2/json/repos/search/#{q}", options)['repositories']
end

#set_private(repo, options = {}) ⇒ Object



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

def set_private(repo, options={})
  update_repository repo, options.merge({ :public => false })
end

#set_public(repo, options = {}) ⇒ Object



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

def set_public(repo, options={})
  update_repository repo, options.merge({ :public => true })
end

#tags(repo, options = {}) ⇒ Object



137
138
139
# File 'lib/octokit/client/repositories.rb', line 137

def tags(repo, options={})
  get "/repos/#{Repository.new repo}/tags", options, 3
end

#unwatch(repo, options = {}) ⇒ Object



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

def unwatch(repo, options={})
  delete "/user/watched/#{Repository.new repo}", options, 3
end

#watch(repo, options = {}) ⇒ Object



32
33
34
# File 'lib/octokit/client/repositories.rb', line 32

def watch(repo, options={})
  put "/user/watched/#{Repository.new repo}", options, 3
end

#watchers(repo, options = {}) ⇒ Object



124
125
126
# File 'lib/octokit/client/repositories.rb', line 124

def watchers(repo, options={})
  get "/repos/#{Repository.new repo}/watchers", options, 3
end