class Github::Authorizations
def _check_if_authenticated
def _check_if_authenticated raise ArgumentError, 'You can only access authentication tokens through Basic Authentication' unless authenticated? end
def create(params={})
"scopes" => ["public_repo"]
github.oauth.create
github = Github.new :basic_auth => 'login:password'
= Examples
* :note_url - Optional string - A URL to remind you what the OAuth token is for.
* :note - Optional string - A note to remind you what the OAuth token is for.
* :scopes - Optional array - A list of scopes that this authorization is in.
= Inputs
Create a new authorization
def create(params={}) _check_if_authenticated normalize! params filter! VALID_AUTH_PARAM_NAMES, params post_request("/authorizations", params) end
def delete(authorization_id, params={})
github.oauth.delete 'authorization-id'
= Examples
Delete an authorization
def delete(authorization_id, params={}) _check_if_authenticated assert_presence_of authorization_id normalize! params delete_request("/authorizations/#{authorization_id}", params) end
def get(authorization_id, params={})
github.oauth.get 'authorization-id'
github = Github.new :basic_auth => 'login:password'
= Examples
Get a single authorization
def get(authorization_id, params={}) assert_presence_of(authorization_id) _check_if_authenticated normalize! params get_request("/authorizations/#{authorization_id}", params) end
def initialize(options = {})
def initialize(options = {}) super(options) end
def list(params={})
github.oauth.list { |auth| ... }
github.oauth.list
github = Github.new :basic_auth => 'login:password'
= Examples
List authorizations
def list(params={}) _check_if_authenticated normalize! params response = get_request("/authorizations", params) return response unless block_given? response.each { |el| yield el } end
def update(authorization_id, params={})
github.oauth.update "authorization-id", "add_scopes" => ["repo"],
github = Github.new :basic_auth => 'login:password'
= Examples
* :note_url - Optional string - A URL to remind you what the OAuth token is for.
* :note - Optional string - A note to remind you what the OAuth token is for.
* :remove_scopes - Optional array - A list of scopes to remove from this authorization.
* :add_scopes - Optional array - A list of scopes to add to this authorization.
* :scopes - Optional array - A list of scopes that this authorization is in.
= Inputs
Update an existing authorization
def update(authorization_id, params={}) _check_if_authenticated assert_presence_of authorization_id normalize! params filter! VALID_AUTH_PARAM_NAMES, params patch_request("/authorizations/#{authorization_id}", params) end