Module: Interpol::DefinitionFinder

Includes:
HashFetcher
Defined in:
lib/interpol/configuration.rb

Constant Summary collapse

NoDefinitionFound =
Class.new

Instance Method Summary collapse

Methods included from HashFetcher

#fetch_from

Instance Method Details

#find_definition(method, path, message_type, status_code = nil) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/interpol/configuration.rb', line 11

def find_definition(method, path, message_type, status_code = nil)
  with_endpoint_matching(method, path) do |endpoint|
    version = yield endpoint
    find_definitions_for(endpoint, version, message_type).find do |definition|
      definition.matches_status_code?(status_code)
    end
  end
end