Parent

Class/Module Index [+]

Quicksearch

Github::Client::Repos::Keys

Constants

VALID_KEY_OPTIONS

Public Instance Methods

all(*args) click to toggle source
Alias for: list
create(*args) click to toggle source

Create a key

@param [Hash] params @option params [String] :title

Required string.

@option params [String] :key

Required string.

@example

github = Github.new
github.repos.keys.create 'user-name', 'repo-name',
  title: "octocat@octomac",
  key:  "ssh-rsa AAA..."

@api public

# File lib/github_api/client/repos/keys.rb, line 57
def create(*args)
  arguments(args, required: [:user, :repo]) do
    permit VALID_KEY_OPTIONS
    assert_required VALID_KEY_OPTIONS
  end

  post_request("/repos/#{arguments.user}/#{arguments.repo}/keys", arguments.params)
end
delete(*args) click to toggle source

Delete key

@example

github = Github.new
github.repos.keys.delete 'user-name', 'repo-name', 'key-id'

@api public

# File lib/github_api/client/repos/keys.rb, line 73
def delete(*args)
  arguments(args, required: [:user, :repo, :id])
  params = arguments.params

  delete_request("/repos/#{arguments.user}/#{arguments.repo}/keys/#{arguments.id}", params)
end
find(*args) click to toggle source
Alias for: get
get(*args) click to toggle source

Get a key

@example

github = Github.new
github.repos.keys.get 'user-name', 'repo-name', 'key-id'

@api public

# File lib/github_api/client/repos/keys.rb, line 35
def get(*args)
  arguments(args, :required => [:user, :repo, :id])

  get_request("/repos/#{arguments.user}/#{arguments.repo}/keys/#{arguments.id}", arguments.params)
end
Also aliased as: find
list(*args) click to toggle source

List deploy keys

@example

github = Github.new
github.repos.keys.list 'user-name', 'repo-name'
github.repos.keys.list 'user-name', 'repo-name' { |key| ... }

@example

keys = Github::Repos::Keys.new user: 'user-name', repo: 'repo-name'
keys.list

@api public

# File lib/github_api/client/repos/keys.rb, line 19
def list(*args)
  arguments(args, required: [:user, :repo])

  response = get_request("/repos/#{arguments.user}/#{arguments.repo}/keys", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end
Also aliased as: all

[Validate]

Generated with the Darkfish Rdoc Generator 2.