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



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

def add_collaborator(repo, collaborator, options={})
  post("/api/v2/json/repos/collaborators/#{Repository.new(repo)}/add/#{collaborator}")['collaborators']
end

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



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

def add_deploy_key(repo, title, key, options={})
  post("/api/v2/json/repos/key/#{Repository.new(repo)}/add", options)['public_keys']
end

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



131
132
133
# File 'lib/octokit/client/repositories.rb', line 131

def branches(repo, options={})
  get("/api/v2/json/repos/show/#{Repository.new(repo)}/branches", options)['branches']
end

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



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

def collaborators(repo, options={})
  get("/api/v2/json/repos/show/#{Repository.new(repo)}/collaborators", options)['collaborators']
end

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



106
107
108
109
110
111
112
# File 'lib/octokit/client/repositories.rb', line 106

def contributors(repo, anon=false, options={})
  if anon
    get("/api/v2/json/repos/show/#{Repository.new(repo)}/contributors/anon", options)
  else
    get("/api/v2/json/repos/show/#{Repository.new(repo)}/contributors", options)
  end['contributors']
end

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



38
39
40
# File 'lib/octokit/client/repositories.rb', line 38

def create_repository(name, options={})
  post("/api/v2/json/repos/create", options.merge(:name => name))['repository']
end

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



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

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!



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

def delete_repository!(repo, options={})
  delete_token = post("/api/v2/json/repos/delete/#{Repository.new(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



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

def deploy_keys(repo, options={})
  get("/api/v2/json/repos/keys/#{Repository.new(repo)}", options)['public_keys']
end

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



34
35
36
# File 'lib/octokit/client/repositories.rb', line 34

def fork(repo, options={})
  post("/api/v2/json/repos/fork/#{Repository.new(repo)}", options)['repository']
end

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



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

def languages(repo, options={})
  get("/api/v2/json/repos/show/#{Repository.new(repo)}/languages", options)['languages']
end

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



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

def network(repo, options={})
  get("/api/v2/json/repos/show/#{Repository.new(repo)}/network", options)['network']
end

#pushable(options = {}) ⇒ Object



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

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

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



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

def remove_collaborator(repo, collaborator, options={})
  post("/api/v2/json/repos/collaborators/#{Repository.new(repo)}/remove/#{collaborator}")['collaborators']
end

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



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

def remove_deploy_key(repo, id, options={})
  post("/api/v2/json/repos/key/#{Repository.new(repo)}/remove", options.merge(:id => id))['public_keys']
end

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



19
20
21
# File 'lib/octokit/client/repositories.rb', line 19

def repositories(username=, options={})
  get(["/api/v2/json/repos/show", username].compact.join('/'), options)['repositories']
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("/api/v2/json/repos/show/#{Repository.new(repo)}", options)['repository']
end

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



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

def repository_teams(repo, options={})
  get("/api/v2/json/repos/show/#{Repository.new(repo)}/teams", options)['teams']
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



60
61
62
# File 'lib/octokit/client/repositories.rb', line 60

def set_private(repo, options={})
  post("/api/v2/json/repos/set/private/#{Repository.new(repo)}", options)['repository']
end

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



64
65
66
# File 'lib/octokit/client/repositories.rb', line 64

def set_public(repo, options={})
  post("/api/v2/json/repos/set/public/#{Repository.new(repo)}", options)['repository']
end

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



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

def tags(repo, options={})
  get("/api/v2/json/repos/show/#{Repository.new(repo)}/tags", options)['tags']
end

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



30
31
32
# File 'lib/octokit/client/repositories.rb', line 30

def unwatch(repo, options={})
  post("/api/v2/json/repos/unwatch/#{Repository.new(repo)}", options)['repository']
end

#update_repository(repo, values, options = {}) ⇒ Object Also known as: update_repo



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

def update_repository(repo, values, options={})
  post("/api/v2/json/repos/show/#{Repository.new(repo)}", options.merge({:values => values}))['repository']
end

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



26
27
28
# File 'lib/octokit/client/repositories.rb', line 26

def watch(repo, options={})
  post("/api/v2/json/repos/watch/#{Repository.new(repo)}", options)['repository']
end

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



115
116
117
# File 'lib/octokit/client/repositories.rb', line 115

def watchers(repo, options={})
  get("/api/v2/json/repos/show/#{Repository.new(repo)}/watchers", options)['watchers']
end