class Authinator::EndPointListener
Attributes
auth_code[R]
errors[R]
options[R]
provider[R]
Public Class Methods
new(hash = {})
click to toggle source
# File lib/authinator/end_point_listener.rb, line 5 def initialize(hash = {}) @provider = hash.delete :provider @auth_code = hash.delete :auth_code @options = hash @errors = [] end
Public Instance Methods
valid?()
click to toggle source
# File lib/authinator/end_point_listener.rb, line 12 def valid? validator_presence? && validator_valid_provider? end
Private Instance Methods
blank?(el)
click to toggle source
# File lib/authinator/end_point_listener.rb, line 41 def blank?(el) el.nil? || el.empty? end
present?(el)
click to toggle source
recreate rails method
# File lib/authinator/end_point_listener.rb, line 37 def present?(el) !blank?(el) end
validator_presence?()
click to toggle source
# File lib/authinator/end_point_listener.rb, line 19 def validator_presence? provider_present = present? @provider auth_code_present = present? @auth_code return true if provider_present && auth_code_present errors << 'A required param is missing' errors << '"provider" field missing' unless provider_present errors << '"auth_code" field missing' unless auth_code_present false end
validator_valid_provider?()
click to toggle source
# File lib/authinator/end_point_listener.rb, line 30 def validator_valid_provider? return true if Authinator.configuration.providers.include? @provider.name errors << "Provider '#{@provider}' is invalid" false end