Method: Navi::LocalClient#download

Defined in:
lib/local/navi_local_client.rb

#download(message, custom_uid) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/local/navi_local_client.rb', line 26

def download(message, custom_uid)
  download_path = config['download_path']
  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