Module: WestpacApi

Extended by:
Forwardable, WestpacApi
Included in:
WestpacApi
Defined in:
lib/westpac_api.rb,
lib/westpac_api/client.rb,
lib/westpac_api/endpoint.rb,
lib/westpac_api/configuration.rb,
lib/westpac_api/failure_response.rb,
lib/westpac_api/endpoints/fetch_jwk.rb,
lib/westpac_api/endpoints/fetch_user.rb

Defined Under Namespace

Modules: Endpoints Classes: Client, Configuration, Endpoint, FailureResponse

Instance Method Summary collapse

Instance Method Details

#configuration(key) ⇒ Object



14
15
16
# File 'lib/westpac_api.rb', line 14

def configuration(key)
  @configurations[key] ||= Configuration.new
end

#fetch_config_by_issuer(issuer) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/westpac_api.rb', line 18

def fetch_config_by_issuer(issuer)
  desired_configuration =
    @configurations.select { |_, config| config.match_issuer?(issuer) }.values

  raise 'The desired configuration cannot be found' if desired_configuration.empty?

  raise "There is more than one configuration for #{issuer}" if desired_configuration.size > 1

  desired_configuration.first
end