Class: Yoti::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/yoti/data_type/attribute.rb

Overview

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.

Constant Summary collapse

FAMILY_NAME =
'family_name'
GIVEN_NAMES =
'given_names'
FULL_NAME =
'full_name'
DATE_OF_BIRTH =
'date_of_birth'
GENDER =
'gender'
NATIONALITY =
'nationality'
PHONE_NUMBER =
'phone_number'
SELFIE =
'selfie'
EMAIL_ADDRESS =
'email_address'
POSTAL_ADDRESS =
'postal_address'
STRUCTURED_POSTAL_ADDRESS =
'structured_postal_address'
DOCUMENT_IMAGES =
'document_images'
DOCUMENT_DETAILS =
'document_details'
APPLICATION_NAME =
'application_name'
APPLICATION_LOGO =
'application_logo'
APPLICATION_URL =
'application_url'
APPLICATION_RECEIPT_BGCOLOR =
'application_receipt_bgcolor'
AGE_OVER =
'age_over:'
AGE_UNDER =
'age_under:'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value, sources, verifiers, anchors_list = {}) ⇒ Attribute

Returns a new instance of Attribute.

Parameters:

  • name (String)
  • value (String)
  • sources (Array<Yoti::Anchor>)
  • verifiers (Array<Yoti::Anchor>)
  • anchors_list (Hash<String => Array>) (defaults to: {})


79
80
81
82
83
84
85
# 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

Instance Attribute Details

#anchorsArray<Yoti::Anchor> (readonly)

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.

Returns:



70
71
72
# File 'lib/yoti/data_type/attribute.rb', line 70

def anchors
  @anchors
end

#nameString (readonly)

Gets the name of the attribute.

Returns:

  • (String)


37
38
39
# File 'lib/yoti/data_type/attribute.rb', line 37

def name
  @name
end

#sourcesArray<Yoti::Anchor> (readonly)

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

Returns:



53
54
55
# File 'lib/yoti/data_type/attribute.rb', line 53

def sources
  @sources
end

#valueString (readonly)

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

Returns:

  • (String)


45
46
47
# File 'lib/yoti/data_type/attribute.rb', line 45

def value
  @value
end

#verifiersArray<Yoti::Anchor> (readonly)

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

Returns:



61
62
63
# File 'lib/yoti/data_type/attribute.rb', line 61

def verifiers
  @verifiers
end