Module: Trufina::Elements::EasyElementAccess

Included in:
AccessResponseGroup, Name, ResidenceAddressRequest, ResidenceAddressResponse
Defined in:
lib/elements.rb

Instance Method Summary collapse

Instance Method Details

#present_and_verifiedObject

Shortcut to collecting any information that’s present and available



73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/elements.rb', line 73

def present_and_verified
  yes = []
  self.class.elements.map(&:method_name).each  do |p|
    next unless val = self.send(p)
    
    if val.respond_to?(:present_and_verified)
      yes << {p.to_sym => val.present_and_verified}
    else
      yes << {p.to_sym => val} if val.state == 'verified' && val.status == 'present'
    end
  end
  yes
end