Class: AuthManager::Validation

Inherits:
Object
  • Object
show all
Defined in:
lib/auth_manager.rb,
lib/auth_manager/validation.rb

Class Method Summary collapse

Class Method Details

.validate_param(hash) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/auth_manager/validation.rb', line 3

def self.validate_param(hash)
  result = validate_format_of(hash)
  result = validate_option(hash[:option]) if result[:code] == 200
  return result if (result[:code] == 400)
  return result = {code: 400, message: 'Bad object and option association'} unless validate_param_association(hash)
  result = user_as_param(hash[:object]) if result[:code] && hash[:option][:user]
  result = app_as_param(hash[:object]) if result[:code] && hash[:option][:app]
  result
end