module Sepa
  class DanskeResponse < Response

    # Namespace used in danske bank certificate responses and requests
    TNS = 'http://danskebank.dk/PKI/PKIFactoryService/elements'

    def bank_encryption_cert
      extract_cert(doc, 'BankEncryptionCert', TNS)
    end

    def bank_signing_cert
      extract_cert(doc, 'BankSigningCert', TNS)
    end

    def bank_root_cert
      extract_cert(doc, 'BankRootCert', TNS)
    end

    def own_encryption_cert
      extract_cert(doc, 'EncryptionCert', TNS)
    end

    def own_signing_cert
      extract_cert(doc, 'SigningCert', TNS)
    end

    def ca_certificate
      extract_cert(doc, 'CACert', TNS)
    end

  end
end

module Sepa
  class DanskeResponse < Response

    def bank_encryption_cert
      @bank_encryption_cert ||= extract_cert(doc, 'BankEncryptionCert', DANSKE_PKI)
    end

    def bank_signing_cert
      @bank_signing_cert ||= extract_cert(doc, 'BankSigningCert', DANSKE_PKI)
    end

    def bank_root_cert
      @bank_root_cert ||= extract_cert(doc, 'BankRootCert', DANSKE_PKI)
    end

    def own_encryption_cert
      @own_encryption_cert ||= extract_cert(doc, 'EncryptionCert', DANSKE_PKI)
    end

    def own_signing_cert
      @own_signing_cert ||= extract_cert(doc, 'SigningCert', DANSKE_PKI)
    end

    def ca_certificate
      @ca_certificate ||= extract_cert(doc, 'CACert', DANSKE_PKI)
    end

  end
end

Use xml namespace constant from sepafm.rb and add memoization to methods
Use xml namespace constant from sepafm.rb and add memoization to methods
