class StackerBee::Middleware::EndpointNormalizer

Public Instance Methods

before(env) click to toggle source
# File lib/stacker_bee/middleware/endpoint_normalizer.rb, line 4
def before(env)
  new_endpoint_name = endpoint_name_for(env.request.endpoint_name)
  env.request.endpoint_name = new_endpoint_name if new_endpoint_name
end
endpoint_name_for(name) click to toggle source
# File lib/stacker_bee/middleware/endpoint_normalizer.rb, line 9
def endpoint_name_for(name)
  # TODO: shouldn't this be in the base endpoint?
  fail 'API required' unless api
  endpoint_description = api[name]
  if endpoint_description
    endpoint_description.fetch('name')
  else
    super
  end
end