Class: DmarcParser::Record

Inherits:
Object
  • Object
show all
Includes:
XmlHelper
Defined in:
lib/dmarc_parser/record.rb

Constant Summary collapse

ATTRIBUTES =
[:source_ip, :count, :disposition, :dkim, :spf, :header_from, :auth_results]

Instance Method Summary collapse

Methods included from XmlHelper

#get_int, #get_text, #get_timestamp

Constructor Details

#initialize(node) ⇒ Record

Returns a new instance of Record.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dmarc_parser/record.rb', line 15

def initialize(node)
  @node = node
  self.source_ip = get_text('row/source_ip')
  self.count = get_int('row/count')
  self.disposition = get_text('row/policy_evaluated/disposition')
  self.dkim = get_text('row/policy_evaluated/dkim')
  self.spf = get_text('row/policy_evaluated/spf')
  self.header_from = get_text('identifiers/header_from')
  self.auth_results = node.xpath('auth_results/*').map do |auth_results_node|
    DmarcParser::AuthResult.new(auth_results_node)
  end
end