Class XhochY::Drossellog::DailyReport
In: xhochy/drossellog/dailyreport.rb
Parent: Object
PageCounter EntryCounter ImpressionCounter DataCounter LogFileParser WeeklyReport CodeCounter MonthlyReport LogLine DailyReport DailyIPCounter IPCounter ImpressionBlacklist Drossellog XhochY dot/f_1.png

Reprents the daily report for 1 Domain

Methods

Attributes

codecounter  [R] 
datacounter  [R] 
entrycounter  [R] 
impressioncounter  [R] 
ipcounter  [R] 
requestcounter  [R] 

Public Class methods

Creates a new DailyReport Object

Takes a Hash as information provider (optional)

[Source]

    # File xhochy/drossellog/dailyreport.rb, line 22
22:       def initialize(data = nil)
23:         @ipcounter = IPCounter.new
24:         @entrycounter = EntryCounter.new
25:         @impressioncounter = ImpressionCounter.new
26:         @requestcounter = PageCounter.new
27:         @datacounter = DataCounter.new
28:         @codecounter = CodeCounter.new
29:         
30:         if data != nil
31:           data['lines'].each do |line|
32:             @ipcounter.add line['ip']
33:             if line['referrer'] == '-'
34:               @entrycounter.add line['path']
35:             end
36:             @impressioncounter.add line['path']
37:             @requestcounter.add line['path']
38:             @datacounter.add line['size'].to_i
39:             @codecounter.add line['http_code'], line['path']
40:           end
41:         end #^ data != nil
42:       end

Public Instance methods

Returns the data of that day as multidimensional a hash

[Source]

    # File xhochy/drossellog/dailyreport.rb, line 45
45:       def get_data
46:         data = {
47:           'ip' => @ipcounter.to_hash,
48:           'entrypages' => @entrycounter.to_hash,
49:           'impressions' => @impressioncounter.to_hash,
50:           'requests' => @requestcounter.to_hash,
51:           'data' => @datacounter.to_i,
52:           'codes' => @codecounter.to_hash,
53:           'codes_simple' => @codecounter.to_simple_hash
54:         }
55:      end

load report data (reverse to get_data)

[Source]

    # File xhochy/drossellog/dailyreport.rb, line 58
58:      def load_report_data(data)
59:        @ipcounter.from_hash data['ip']
60:        @entrycounter.from_hash data['entrypages']
61:        @impressioncounter.from_hash data['impressions']
62:        @requestcounter.from_hash data['requests']
63:        @datacounter.from_i data['data']
64:        @codecounter.from_hash data['codes']
65:      end

[Validate]