Class: PhisherPhinder::MailParser::AuthenticationHeaders::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/phisher_phinder/mail_parser/authentication_headers/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(authentication_results_parser:, received_spf_parser:) ⇒ Parser

Returns a new instance of Parser.



7
8
9
10
# 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

Instance Method Details

#parse(headers) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# 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