class Yoti::BaseProfile

Encapsulates Yoti user profile

Attributes

attributes[R]

Return all attributes for the profile.

@return [Hash{String => Yoti::Attribute}]

Public Class Methods

new(profile_data) click to toggle source

@param [Hash{String => Yoti::Attribute}] profile_data

# File lib/yoti/data_type/base_profile.rb, line 16
def initialize(profile_data)
  @attributes = profile_data.is_a?(Object) ? profile_data : {}
end

Public Instance Methods

get_attribute(attr_name) click to toggle source

Get attribute value by name.

@param [String] attr_name

@return [Attribute, nil]

# 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

Protected Instance Methods

find_attributes_starting_with(name) click to toggle source

Find attributes starting with provided name.

@param [String] name

@return [Array]

# File lib/yoti/data_type/base_profile.rb, line 42
def find_attributes_starting_with(name)
  @attributes.select { |key| key.to_s.start_with?(name) }
end