Parent

Class/Module Index [+]

Quicksearch

Github::Authorizations

Public Instance Methods

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

Create a new authorization

Inputs

  • :scopes - Optional array - A list of scopes that this authorization is in.

  • :note - Optional string - A note to remind you what the OAuth token is for.

  • :note_url - Optional string - A URL to remind you what the OAuth token is for.

Examples

github = Github.new :basic_auth => 'login:password'
github.oauth.create
  "scopes" => ["public_repo"]
# File lib/github_api/authorizations.rb, line 58
def create(*args)
  _check_if_authenticated
  arguments(args) do
    sift VALID_AUTH_PARAM_NAMES
  end

  post_request("/authorizations", arguments.params)
end
delete(*args) click to toggle source

Delete an authorization

Examples

github.oauth.delete 'authorization-id'
# File lib/github_api/authorizations.rb, line 95
def delete(*args)
  _check_if_authenticated
  arguments(args, :required => [:authorization_id])

  delete_request("/authorizations/#{authorization_id}", arguments.params)
end
Also aliased as: remove
edit(*args) click to toggle source
Alias for: update
find(*args) click to toggle source
Alias for: get
get(*args) click to toggle source

Get a single authorization

Examples

github = Github.new :basic_auth => 'login:password'
github.oauth.get 'authorization-id'
# File lib/github_api/authorizations.rb, line 38
def get(*args)
  _check_if_authenticated
  arguments(args, :required => [:authorization_id])

  get_request("/authorizations/#{authorization_id}", arguments.params)
end
Also aliased as: find
list(*args) click to toggle source

List authorizations

Examples

github = Github.new :basic_auth => 'login:password'
github.oauth.list
github.oauth.list { |auth| ... }
# File lib/github_api/authorizations.rb, line 22
def list(*args)
  _check_if_authenticated
  arguments(args)

  response = get_request("/authorizations", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end
Also aliased as: all
remove(*args) click to toggle source
Alias for: delete
update(*args) click to toggle source

Update an existing authorization

Inputs

  • :scopes - Optional array - A list of scopes that this authorization is in.

  • :add_scopes - Optional array - A list of scopes to add to this authorization.

  • :remove_scopes - Optional array - A list of scopes to remove from this authorization.

  • :note - Optional string - A note to remind you what the OAuth token is for.

  • :note_url - Optional string - A URL to remind you what the OAuth token is for.

Examples

github = Github.new :basic_auth => 'login:password'
github.oauth.update "authorization-id", "add_scopes" => ["repo"],
# File lib/github_api/authorizations.rb, line 80
def update(*args)
  _check_if_authenticated
  arguments(args, :required => [:authorization_id]) do
    sift VALID_AUTH_PARAM_NAMES
  end

  patch_request("/authorizations/#{authorization_id}", arguments.params)
end
Also aliased as: edit

[Validate]

Generated with the Darkfish Rdoc Generator 2.