lib/client.rb in navi_client-1.4.3 vs lib/client.rb in navi_client-1.4.4
- old
+ new
@@ -129,11 +129,11 @@
##
# Process each email downloaded from imap-server and creates meta file that will be sent over to the navi-ai service.
# Meta will content information like: ['from', 'to', 'cc', ..., 'body_url']. This information is then used by navi-ai to parse the body content.
#
- def process_email(mail, uid)
+ def process_email(mail, uid, stamp = nil)
meta = Hash.new
custom_uid = (Time.now.to_f * 1000).to_s + "_" + mail.__id__.to_s
meta["from"] = mail[:from].to_s
meta["to"] = mail[:to].to_s
@@ -149,10 +149,15 @@
else
m = download(mail, custom_uid)
meta.merge!(m) unless m.nil?
end
- save(meta, "meta/#{uid.to_s + '_' + custom_uid}")
+ if stamp.nil?
+ save(meta, "meta/#{uid.to_s + '_' + custom_uid}")
+ else
+ save(meta, "meta/#{uid.to_s + '_' + custom_uid}", stamp)
+ end
+
end
def encrypt(data)
Base64.encode64(data)
end