Class: NaviClient::Cloud

Inherits:
Object
  • Object
show all
Defined in:
lib/cloud/navi_cloud_client.rb

Instance Method Summary collapse

Constructor Details

#initializeCloud

Returns a new instance of Cloud.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cloud/navi_cloud_client.rb', line 7

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

Instance Method Details

#download(message, custom_uid) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cloud/navi_cloud_client.rb', line 28

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

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

    s3_filepath = upload_to_s3(out_file, encrypt(message.decoded))
    key = message.mime_type.split("/").join("_")

    h[key] = s3_filepath
    return h
  end
end