Class: Yoti::BaseProfile
- Inherits:
-
Object
- Object
- Yoti::BaseProfile
- Defined in:
- lib/yoti/data_type/base_profile.rb
Overview
Encapsulates Yoti user profile
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Hash{String => Yoti::Attribute}
readonly
Return all attributes for the profile.
Instance Method Summary collapse
-
#get_attribute(attr_name) ⇒ Attribute?
Get attribute value by name.
-
#initialize(profile_data) ⇒ BaseProfile
constructor
A new instance of BaseProfile.
Constructor Details
#initialize(profile_data) ⇒ BaseProfile
Returns a new instance of BaseProfile.
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
#attributes ⇒ Hash{String => Yoti::Attribute} (readonly)
Return all attributes for the profile.
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.
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 |