Module: RCS::CalendarEvidence

Defined in:
lib/rcs-common/evidence/calendar.rb

Instance Method Summary collapse

Instance Method Details

#contentObject



6
7
8
# File 'lib/rcs-common/evidence/calendar.rb', line 6

def content
  raise "Not implemented!"
end

#decode_content(common_info, chunks) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/rcs-common/evidence/calendar.rb', line 14

def decode_content(common_info, chunks)
  stream = StringIO.new chunks.join

  until stream.eof?
    info =  Hash[common_info]
    info[:data] ||= Hash.new

    @calendar = CalendarSerializer.new.unserialize stream

    info[:data][:event] = @calendar.fields[:subject]
    info[:data][:type] = @calendar.fields[:categories]
    info[:data][:begin] = @calendar.start_date.to_i
    info[:data][:end] = @calendar.end_date.to_i
    info[:data][:info] = ""

    trace :debug, "#{info[:data]}"

    unless @calendar.fields[:recipients].nil?
      recipients = @calendar.fields[:recipients]
      unless recipients.empty?
        info[:data][:recipients] = recipients
        info[:data][:info] += "#{recipients}"
      end
    end

    unless @calendar.fields[:location].nil?
      location = @calendar.fields[:location]
      unless location.empty?
        info[:data][:location] = location
        info[:data][:info] += " - " unless info[:data][:info].empty?
        info[:data][:info] += "#{location}"
      end
    end

    unless @calendar.fields[:body].nil?
      body = @calendar.fields[:body]
      unless body.empty?
        info[:data][:body] = body
        info[:data][:info] += " - " unless info[:data][:info].empty?
        info[:data][:info] += "#{body}"
      end
    end

    yield info if block_given?
  end
  :keep_raw
end

#generate_contentObject



10
11
12
# File 'lib/rcs-common/evidence/calendar.rb', line 10

def generate_content
  raise "Not implemented!"
end