Module: Keywright

Defined in:
lib/keywright.rb,
lib/keywright/result.rb,
lib/keywright/request.rb,
lib/keywright/version.rb,
lib/keywright/uri_helpers.rb,
lib/keywright/error_result.rb,
lib/keywright/token_result.rb,
lib/keywright/authorization.rb,
lib/keywright/configuration.rb,
lib/keywright/token_request.rb,
lib/keywright/response_methods.rb,
lib/keywright/user_info_result.rb,
lib/keywright/user_info_request.rb,
lib/keywright/refresh_token_request.rb

Defined Under Namespace

Modules: ResponseMethods, UriHelpers Classes: Authorization, Configuration, ErrorResult, RefreshTokenRequest, Request, Result, TokenRequest, TokenResult, UserInfoRequest, UserInfoResult

Constant Summary collapse

VERSION =
"0.0.2"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configuration(&block) ⇒ Object

The configuration method returns the default configuration and, if the caller supplies a block, allows that caller to customize this configuration.

The configuration includes the client credentials, the urls of the authorization, token and userinfo endpoints, the grant types, scopes, and authentication methods the authorization server supports for the token endpoint.

This method may be called repeatedly to update the global configuration.



51
52
53
54
# File 'lib/keywright.rb', line 51

def configuration( &block )
  @configuration = Configuration.build!( @configuration&.to_h, &block ) if block_given?
  @configuration
end

Class Method Details

.connection {|@connection| ... } ⇒ Object

The connection method allows the caller to setup the Farday connection used by Keywright in interacting with the authorization server.

Yields:



28
29
30
31
32
33
34
35
# File 'lib/keywright.rb', line 28

def connection
  @connection ||= Faraday.new do | connection |
    connection.request  :url_encoded
    connection.adapter  Faraday.default_adapter
  end
  yield( @connection ) if block_given?
  @connection
end