Module: TelemetryFlows

Instance Method Summary collapse

Instance Method Details

#emitObject



9
10
11
# File 'lib/telemetry/flows.rb', line 9

def emit
  Telemetry::Api.flow_update(self)
end

#encrypt(encrytion_key) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/telemetry/flows.rb', line 12

def encrypt(encrytion_key)
  cipher = Gibberish::AES.new(encrytion_key)
  skipped_keys = ["tag", "expires_at", "priority", "icon"]
  self.keys.each do |key|
    unless skipped_keys.include?(key)
      self[key] = {enc_json: cipher.enc(MultiJson.dump(self[key]))}
    end
  end
  puts self.to_hash
end