class PhisherPhinder::MailParser::AuthenticationHeaders::Parser

Public Class Methods

new(authentication_results_parser:, received_spf_parser:) click to toggle source
# File lib/phisher_phinder/mail_parser/authentication_headers/parser.rb, line 7
def initialize(authentication_results_parser:, received_spf_parser:)
  @authentication_results_parser = authentication_results_parser
  @received_spf_parser = received_spf_parser
end

Public Instance Methods

parse(headers) click to toggle source
# File lib/phisher_phinder/mail_parser/authentication_headers/parser.rb, line 12
def parse(headers)
  {
    authentication_results: (headers[:authentication_results] || []).map do |header|
      @authentication_results_parser.parse(header[:data])
    end,
    received_spf: (headers[:received_spf] || []).map do |header|
      @received_spf_parser.parse(header[:data])
    end
  }
end