Module: Doorkeeper::Validations

Extended by:
ActiveSupport::Concern
Included in:
OAuth::BaseRequest, OAuth::ClientCredentials::Validator, OAuth::PreAuthorization
Defined in:
lib/doorkeeper/validations.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#errorObject

Returns the value of attribute error


7
8
9
# File 'lib/doorkeeper/validations.rb', line 7

def error
  @error
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)

18
19
20
21
# File 'lib/doorkeeper/validations.rb', line 18

def valid?
  validate
  @error.nil?
end

#validateObject


9
10
11
12
13
14
15
16
# File 'lib/doorkeeper/validations.rb', line 9

def validate
  @error = nil

  self.class.validations.each do |validation|
    @error = validation[:options][:error] unless send("validate_#{validation[:attribute]}")
    break if @error
  end
end