Class: Aven::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/aven/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



6
7
8
9
# File 'lib/aven/configuration.rb', line 6

def initialize
  @authenticated_root_path = nil
  @oauth_providers = {}
end

Instance Attribute Details

#authenticated_root_pathObject

Returns the value of attribute authenticated_root_path.



3
4
5
# File 'lib/aven/configuration.rb', line 3

def authenticated_root_path
  @authenticated_root_path
end

#oauth_providersObject

Returns the value of attribute oauth_providers.



4
5
6
# File 'lib/aven/configuration.rb', line 4

def oauth_providers
  @oauth_providers
end

Instance Method Details

#configure_oauth(provider, credentials = {}) ⇒ Object

Configure OAuth providers

Examples:

config.configure_oauth(:github, {
  client_id: "abc123",
  client_secret: "secret",
  scope: "user:email,repo,workflow"
})

Parameters:

  • provider (Symbol)

    The OAuth provider name (:github, :google, etc.)

  • credentials (Hash) (defaults to: {})

    Configuration hash with:

    • :client_id [String] OAuth client ID

    • :client_secret [String] OAuth client secret

    • :scope [String] Optional. OAuth scopes to request

    • Any other provider-specific options



26
27
28
# File 'lib/aven/configuration.rb', line 26

def configure_oauth(provider, credentials = {})
  @oauth_providers[provider.to_sym] = credentials
end

#resolve_authenticated_root_pathString

Resolves authenticated_root_path, calling it if it’s a lambda/proc

Returns:

  • (String)

    The resolved path



33
34
35
36
37
# File 'lib/aven/configuration.rb', line 33

def resolve_authenticated_root_path
  return nil if @authenticated_root_path.nil?

  @authenticated_root_path.respond_to?(:call) ? @authenticated_root_path.call : @authenticated_root_path
end