Method: NaviClient::Local#download

Defined in:
lib/local/navi_local_client.rb

#download(message, custom_uid) ⇒ Object

Downloads the email content from imap-server and save it to the download_path



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/local/navi_local_client.rb', line 70

def download(message, custom_uid)
  download_path = config['download_path'] + config['username'] + '/'
  if ['text/plain', 'text/html'].include? message.mime_type

    h = Hash.new
    out_file = download_path + message.mime_type + "/"+custom_uid
    mkdir_if_not_exist(out_file)

    File.open(out_file, 'w') { |file| file.write(encrypt(message.decoded)) }
    key = message.mime_type.split("/").join("_")

    h[key] = out_file
    return h
  end
end