lib/interpol/stub_app.rb in interpol-0.0.8 vs lib/interpol/stub_app.rb in interpol-0.1.0

- old
+ new

@@ -16,12 +16,12 @@ module Helpers def interpol_config self.class.interpol_config end - def example_for(endpoint, version) - endpoint.find_example_for!(version) + def example_for(endpoint, version, message_type) + endpoint.find_example_for!(version, message_type) rescue ArgumentError interpol_config.request_version_unavailable(self, version, endpoint.available_versions) end end @@ -47,11 +47,13 @@ end def endpoint_definition(endpoint) lambda do version = interpol_config.api_version_for(request.env, endpoint) - example = example_for(endpoint, version) + message_type = 'response' + example = example_for(endpoint, version, message_type) example.validate! + status endpoint.find_example_status_code_for!(version) JSON.dump(example.data) end end end end