Class: Rubino::API::Operations::OAuth::Providers::ListOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/rubino/api/operations/oauth/providers/list_operation.rb

Overview

GET /v1/oauth/providers Lists OAuth providers registered at boot, with their default scopes.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(registry: ::Rubino::OAuth::Registry) ⇒ ListOperation

Accepts an alternate provider registry for tests.



16
17
18
# File 'lib/rubino/api/operations/oauth/providers/list_operation.rb', line 16

def initialize(registry: ::Rubino::OAuth::Registry)
  @registry = registry
end

Class Method Details

.call(request) ⇒ Object



11
12
13
# File 'lib/rubino/api/operations/oauth/providers/list_operation.rb', line 11

def self.call(request)
  new.call(request)
end

Instance Method Details

#call(_request) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/rubino/api/operations/oauth/providers/list_operation.rb', line 20

def call(_request)
  providers = @registry.all.map do |p|
    {
      id: p.id,
      display_name: p.class.display_name,
      scopes: p.scopes
    }
  end
  [200, providers]
end