class Nimbu::Endpoints::Authorizations
Constants
- VALID_AUTH_PARAM_NAMES
Public Instance Methods
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¶ ↑
nimbu = Nimbu.new :basic_auth => 'login:password' nimbu.oauth.create "scopes" => ["public_repo"]
# File lib/nimbu-api/endpoints/authorizations.rb, line 60 def create(*args) require_authentication 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¶ ↑
nimbu.oauth.delete 'authorization-id'
# File lib/nimbu-api/endpoints/authorizations.rb, line 97 def delete(*args) require_authentication arguments(args, :required => [:authorization_id]) delete_request("/authorizations/#{authorization_id}", arguments.params) end
Also aliased as: remove
get(*args)
click to toggle source
Get a single authorization
Examples¶ ↑
nimbu = Nimbu.new :basic_auth => 'login:password' nimbu.oauth.get 'authorization-id'
# File lib/nimbu-api/endpoints/authorizations.rb, line 40 def get(*args) require_authentication arguments(args, :required => [:authorization_id]) get_request("/authorizations/#{authorization_id}", arguments.params) end
Also aliased as: find
list(*args) { |el| ... }
click to toggle source
List authorizations
Examples¶ ↑
nimbu = Nimbu.new :basic_auth => 'login:password' nimbu.oauth.list nimbu.oauth.list { |auth| ... }
# File lib/nimbu-api/endpoints/authorizations.rb, line 24 def list(*args) require_authentication arguments(args) response = get_request("/authorizations", arguments.params) return response unless block_given? response.each { |el| yield el } end
Also aliased as: all
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¶ ↑
nimbu = Nimbu.new :basic_auth => 'login:password' nimbu.oauth.update "authorization-id", "add_scopes" => ["repo"],
# File lib/nimbu-api/endpoints/authorizations.rb, line 82 def update(*args) require_authentication arguments(args, :required => [:authorization_id]) do sift VALID_AUTH_PARAM_NAMES end patch_request("/authorizations/#{authorization_id}", arguments.params) end
Also aliased as: edit
Private Instance Methods
require_authentication()
click to toggle source
# File lib/nimbu-api/endpoints/authorizations.rb, line 107 def require_authentication raise ArgumentError, 'You can only access authentication tokens through Basic Authentication' unless authenticated? end