Module: Interpol::DefinitionFinder

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

Overview

Meant to be extended onto an array, to provide custom finder methods for interpol endpoint definitions.

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



14
15
16
17
18
19
20
21
# File 'lib/interpol/configuration.rb', line 14

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