class Yoti::AgeVerification

Wraps an 'Age Verify/Condition' attribute to provide behaviour specific to verifying someone's age.

Attributes

age[R]

The age that was that checked, as specified on Yoti Hub.

@return [Integer]

attribute[R]

The wrapped profile attribute.

Use this if you need access to the underlying list of Anchors.

@return [Yoti::Attribute]

check_type[R]

The type of age check performed, as specified on Yoti Hub.

Among the possible values are 'age_over' and 'age_under'.

@return [String]

result[R]

Whether or not the profile passed the age check.

@return [Boolean]

Public Class Methods

new(attribute) click to toggle source

@param [Yoti::Attribute] attribute

# File lib/yoti/data_type/age_verification.rb, line 42
def initialize(attribute)
  raise(ArgumentError, "'#{attribute.name}' is not a valid age verification") unless /^[^:]+:(?!.*:)[0-9]+$/.match?(attribute.name)

  @attribute = attribute

  split = attribute.name.split(':')
  @check_type = split[0]

  @age = split[1].to_i
  @result = attribute.value == 'true'
end