Class: Yoti::BaseProfile

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

Overview

Encapsulates Yoti user profile

Direct Known Subclasses

ApplicationProfile, Profile

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(profile_data) ⇒ BaseProfile

Returns a new instance of BaseProfile.

Parameters:



16
17
18
# File 'lib/yoti/data_type/base_profile.rb', line 16

def initialize(profile_data)
  @attributes = profile_data.is_a?(Object) ? profile_data : {}
end

Instance Attribute Details

#attributesHash{String => Yoti::Attribute} (readonly)

Return all attributes for the profile.

Returns:



11
12
13
# File 'lib/yoti/data_type/base_profile.rb', line 11

def attributes
  @attributes
end

Instance Method Details

#get_attribute(attr_name) ⇒ Attribute?

Get attribute value by name.

Parameters:

  • attr_name (String)

Returns:



27
28
29
30
31
# File 'lib/yoti/data_type/base_profile.rb', line 27

def get_attribute(attr_name)
  return nil unless @attributes.key? attr_name

  @attributes[attr_name]
end