Class: DmarcParser::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/dmarc_parser/report.rb

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Report

Returns a new instance of Report.



8
9
10
11
# File 'lib/dmarc_parser/report.rb', line 8

def initialize(xml)
  @xml = xml
  @node = Nokogiri::XML(xml)
end

Instance Method Details

#metadataObject



13
14
15
# File 'lib/dmarc_parser/report.rb', line 13

def 
  @metadata ||= DmarcParser::Metadata.new(@node)
end

#policyObject



17
18
19
# File 'lib/dmarc_parser/report.rb', line 17

def policy
  @policy ||=DmarcParser::Policy.new(@node)
end

#recordsObject



21
22
23
24
25
# File 'lib/dmarc_parser/report.rb', line 21

def records
  @records ||= @node.xpath('feedback/record').map do |node|
    DmarcParser::Record.new(node)
  end
end