Class: Psychometric::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/psychometric/provider.rb

Overview

# Provider

This is the standardized API that individual provider implementations must conform to. It abstracts the constructs from the provider into those used by Psychometric.

Defined Under Namespace

Classes: AuthenticationError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(authentication) ⇒ Provider

raise NotImplementedError, ‘Subclasses must define `resolved?`.’



13
14
15
16
# File 'lib/psychometric/provider.rb', line 13

def initialize(authentication)
  raise AuthenticationError unless authentication.keys.to_set == @@authentication_keys.to_set
  @authentication = authentication
end

Class Method Details

.assessment(identity) ⇒ Object



18
19
20
21
22
# File 'lib/psychometric/provider.rb', line 18

def self.assessment(identity)
  symbolized_identity = identity.inject({}) { |memo, (k,v)| memo[k.to_sym] = v; memo } # symbolize_keys
  raise Assessment::IdentityError unless symbolized_identity.keys.to_set == @@assessment_identifiers.to_set
  Assessment.new self, symbolized_identity
end