class Yoti::DocScan::Session::Retrieve::GetSessionResult

Attributes

checks[R]

@return [Array<CheckResponse>]

client_session_token[R]

@return [String]

client_session_token_ttl[R]

@return [Integer]

resources[R]

@return [ResourceContainer]

session_id[R]

@return [String]

state[R]

@return [String]

user_tracking_id[R]

@return [String]

Public Class Methods

new(response) click to toggle source

@param [Hash] response

# File lib/yoti/doc_scan/session/retrieve/get_session_result.rb, line 35
def initialize(response)
  Validation.assert_is_a(Integer, response['client_session_token_ttl'], 'client_session_token_ttl', true)
  @client_session_token_ttl = response['client_session_token_ttl']

  Validation.assert_is_a(String, response['session_id'], 'session_id', true)
  @session_id = response['session_id']

  Validation.assert_is_a(String, response['user_tracking_id'], 'user_tracking_id', true)
  @user_tracking_id = response['user_tracking_id']

  Validation.assert_is_a(String, response['state'], 'state', true)
  @state = response['state']

  Validation.assert_is_a(String, response['client_session_token'], 'client_session_token', true)
  @client_session_token = response['client_session_token']

  if response['checks'].nil?
    @checks = []
  else
    Validation.assert_is_a(Array, response['checks'], 'checks')
    @checks = map_checks(response['checks'])
  end

  @resources = ResourceContainer.new(response['resources']) unless response['resources'].nil?

  @biometric_consent_timestamp = DateTime.parse(response['biometric_consent']) unless response['biometric_consent'].nil?
end

Public Instance Methods

authenticity_checks() click to toggle source

@return [Array<AuthenticityCheckResponse>]

# File lib/yoti/doc_scan/session/retrieve/get_session_result.rb, line 66
def authenticity_checks
  @checks.select { |check| check.is_a?(AuthenticityCheckResponse) }
end
face_match_checks() click to toggle source

@return [Array<FaceMatchCheckResponse>]

# File lib/yoti/doc_scan/session/retrieve/get_session_result.rb, line 73
def face_match_checks
  @checks.select { |check| check.is_a?(FaceMatchCheckResponse) }
end
id_document_comparison_checks() click to toggle source

@return [Array<IdDocumentComparisonCheckResponse>]

# File lib/yoti/doc_scan/session/retrieve/get_session_result.rb, line 110
def id_document_comparison_checks
  @checks.select { |check| check.is_a?(IdDocumentComparisonCheckResponse) }
end
id_document_text_data_checks() click to toggle source

@return [Array<TextDataCheckResponse>]

# File lib/yoti/doc_scan/session/retrieve/get_session_result.rb, line 89
def id_document_text_data_checks
  @checks.select { |check| check.is_a?(TextDataCheckResponse) }
end
liveness_checks() click to toggle source

@return [Array<LivenessCheckResponse>]

# File lib/yoti/doc_scan/session/retrieve/get_session_result.rb, line 103
def liveness_checks
  @checks.select { |check| check.is_a?(LivenessCheckResponse) }
end
supplementary_document_text_data_checks() click to toggle source

@return [Array<SupplementaryDocumentTextDataCheckResponse>]

# File lib/yoti/doc_scan/session/retrieve/get_session_result.rb, line 96
def supplementary_document_text_data_checks
  @checks.select { |check| check.is_a?(SupplementaryDocumentTextDataCheckResponse) }
end
text_data_checks() click to toggle source

@deprecated replaced by id_document_text_data_checks

@return [Array<TextDataCheckResponse>]

# File lib/yoti/doc_scan/session/retrieve/get_session_result.rb, line 82
def text_data_checks
  id_document_text_data_checks
end

Private Instance Methods

map_checks(checks) click to toggle source

@param [Array<Hash>] checks

@return [Array<CheckResponse>]

# File lib/yoti/doc_scan/session/retrieve/get_session_result.rb, line 121
def map_checks(checks)
  checks.map do |check|
    case check['type']
    when Constants::ID_DOCUMENT_AUTHENTICITY
      AuthenticityCheckResponse.new(check)
    when Constants::ID_DOCUMENT_COMPARISON
      IdDocumentComparisonCheckResponse.new(check)
    when Constants::ID_DOCUMENT_FACE_MATCH
      FaceMatchCheckResponse.new(check)
    when Constants::ID_DOCUMENT_TEXT_DATA_CHECK
      TextDataCheckResponse.new(check)
    when Constants::LIVENESS
      LivenessCheckResponse.new(check)
    when Constants::SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK
      SupplementaryDocumentTextDataCheckResponse.new(check)
    else
      CheckResponse.new(check)
    end
  end
end