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



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

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

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



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

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

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



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

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

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



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

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

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



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

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

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



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

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

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



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

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

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



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

def delete_repository!(repo, options={})
  response = post("repos/delete/#{Repository.new(repo)}", options)
  post("repos/delete/#{Repository.new(repo)}", options.merge(:delete_token => response['delete_token']))['repository']
end

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



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

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

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



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

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

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



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

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

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



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

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

#pushable(options = {}) ⇒ Object



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

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

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



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

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

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



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

def remove_deploy_key(repo, id, options={})
  post("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



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

def repositories(username=, options={})
  get(["repos/show", username].compact.join('/'), options)['repositories']
end

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



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

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

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



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

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

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



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

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

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



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

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

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



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

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

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



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

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

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



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

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

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



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

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

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



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

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

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



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

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