Class: PreventGo::Identity

Inherits:
Base
  • Object
show all
Defined in:
lib/prevent_go/identity.rb

Instance Attribute Summary

Attributes inherited from Base

#params, #request

Instance Method Summary collapse

Methods inherited from Base

#document_controls, #document_details, #document_type, #initialize

Constructor Details

This class inherits a constructor from PreventGo::Base

Instance Method Details

#fetch_holder_infos(*keys) ⇒ Object



17
18
19
20
# File 'lib/prevent_go/identity.rb', line 17

def fetch_holder_infos(*keys)
  keys = default_holder_keys if keys.empty?
  holder_data.slice(*keys).values.compact
end

#holder_controlsObject



9
10
11
# File 'lib/prevent_go/identity.rb', line 9

def holder_controls
  @_holder_controls ||= @request.dig('controlsGroups', 'holder') || {}
end

#holder_dataObject



13
14
15
# File 'lib/prevent_go/identity.rb', line 13

def holder_data
  @_holder_data || @request.dig('documentDetails', 'holder') || {}
end

#not_expired?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/prevent_go/identity.rb', line 31

def not_expired?
  @request.dig('controlsGroups', 'document', 'notExpired') == 'OK'
end

#quality_validated?Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
# File 'lib/prevent_go/identity.rb', line 22

def quality_validated?
  [
    document_controls['typeRecognized'],
    document_controls.dig('quality', 'aboveMinimumThreshold'),
    document_controls['notExpired'],
    document_controls['mrzValid']
  ].all? { |entry| entry == 'OK' }
end