class Yoti::Attribute

A class to represent a Yoti attribute.

A Yoti attribute consists of the attribute name, an associated attribute value, and a list of Anchors from Yoti.

It may hold one or more anchors, which specify how an attribute has been provided and how it has been verified within the Yoti platform.

Constants

AGE_OVER
AGE_UNDER
APPLICATION_NAME
APPLICATION_RECEIPT_BGCOLOR
APPLICATION_URL
DATE_OF_BIRTH
DOCUMENT_DETAILS
DOCUMENT_IMAGES
EMAIL_ADDRESS
FAMILY_NAME
FULL_NAME
GENDER
GIVEN_NAMES
NATIONALITY
PHONE_NUMBER
POSTAL_ADDRESS
SELFIE
STRUCTURED_POSTAL_ADDRESS

Attributes

anchors[R]

Get the anchors for an attribute. If an attribute has only one SOURCE Anchor with the value set to “USER_PROVIDED” and zero VERIFIER Anchors, then the attribute is a self-certified one.

@return [Array<Yoti::Anchor>]

name[R]

Gets the name of the attribute.

@return [String]

sources[R]

Sources are a subset of the anchors associated with an attribute, where the anchor type is SOURCE.

@return [Array<Yoti::Anchor>]

value[R]

Retrieves the value of an attribute. If this is null, the default value for the type is returned.

@return [String]

verifiers[R]

Verifiers are a subset of the anchors associated with an attribute, where the anchor type is VERIFIER.

@return [Array<Yoti::Anchor>]

Public Class Methods

new(name, value, sources, verifiers, anchors_list = {}) click to toggle source

@param [String] name @param [String] value @param [Array<Yoti::Anchor>] sources @param [Array<Yoti::Anchor>] verifiers @param [Hash<String => Array>] anchors_list

# File lib/yoti/data_type/attribute.rb, line 79
def initialize(name, value, sources, verifiers, anchors_list = {})
  @name = name
  @value = value
  @sources = sources
  @verifiers = verifiers
  @anchors = process_anchors_list(anchors_list)
end

Private Instance Methods

process_anchors_list(anchors_list) click to toggle source

Flattens anchor lists into single array.

@param [Hash<String => Array>] anchors_list

@return [Array<Yoti::Anchor>] <description>

# File lib/yoti/data_type/attribute.rb, line 96
def process_anchors_list(anchors_list)
  anchors = []
  anchors_list.each { |_type, list| anchors += list }
  anchors
end