Sha256: deaa550a47c202424a8030842d2d59f15109289b546ef94fe26bcfe435353879

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require './lib/client'
module NaviClient
  include Client
  class Local

    def initialize
     # flag to print Ruby library debug info (very detailed)
     @net_imap_debug = false

     # flag to mark email as read after gets downloaded.
     @mark_as_read = false

     # flag to turn on/off debug mode.
     @debug = false

     # override the log file
     mkdir_if_not_exist(config['client_log_file'])
     @logger = Logger.new(config['client_log_file'])

     # naviai command
     @cmd = 'naviai'

     # authentication token received from sso_web used to authenticate the request to database_api
     @token = nil
   end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
navi_client-0.1.5 lib/local/navi_local_client.rb