Class: ThreeScale::Backend::Validators::Key

Inherits:
Base
  • Object
show all
Defined in:
lib/3scale/backend/validators/key.rb

Instance Attribute Summary

Attributes inherited from Base

#params, #status

Instance Method Summary collapse

Methods inherited from Base

#application, apply, #fail!, #initialize, #service, #succeed!

Constructor Details

This class inherits a constructor from ThreeScale::Backend::Validators::Base

Instance Method Details

#applyObject



5
6
7
8
9
10
11
12
13
# File 'lib/3scale/backend/validators/key.rb', line 5

def apply
  if service.backend_version.to_i == 1 ||
      application.has_no_keys? ||
      application.has_key?(params[:app_key])
    succeed!
  else
    fail!(ApplicationKeyInvalid.new(params[:app_key]))
  end
end