Create a key
:title
- Required string.
:key
- Required string.
github = Github.new github.repos.keys.create 'user-name', 'repo-name', "title" => "octocat@octomac", "key" => "ssh-rsa AAA..."
# File lib/github_api/repos/keys.rb, line 51 def create(*args) arguments(args, :required => [:user, :repo]) do sift VALID_KEY_OPTIONS assert_required VALID_KEY_OPTIONS end post_request("/repos/#{user}/#{repo}/keys", arguments.params) end
Delete key
github = Github.new github.repos.keys.delete 'user-name', 'repo-name', 'key-id'
# File lib/github_api/repos/keys.rb, line 87 def delete(*args) arguments(args, :required => [:user, :repo, :key_id]) params = arguments.params delete_request("/repos/#{user}/#{repo}/keys/#{key_id}", params) end
Edit a key
:title
- Required string.
:key
- Required string.
github = Github.new github.repos.keys.edit 'user-name', 'repo-name', "title" => "octocat@octomac", "key" => "ssh-rsa AAA..."
# File lib/github_api/repos/keys.rb, line 72 def edit(*args) arguments(args, :required => [:user, :repo, :key_id]) do sift VALID_KEY_OPTIONS end params = arguments.params patch_request("/repos/#{user}/#{repo}/keys/#{key_id}", params) end
Get a key
github = Github.new github.repos.keys.get 'user-name', 'repo-name', 'key-id'
# File lib/github_api/repos/keys.rb, line 32 def get(*args) arguments(args, :required => [:user, :repo, :key_id]) get_request("/repos/#{user}/#{repo}/keys/#{key_id}", arguments.params) end
List deploy keys
github = Github.new github.repos.keys.list 'user-name', 'repo-name' github.repos.keys.list 'user-name', 'repo-name' { |key| ... } keys = Github::Repos::Keys.new user: 'user-name', repo: 'repo-name' keys.list
# File lib/github_api/repos/keys.rb, line 17 def list(*args) arguments(args, :required => [:user, :repo]) response = get_request("/repos/#{user}/#{repo}/keys", arguments.params) return response unless block_given? response.each { |el| yield el } end