navi_client 1.3.8 → 1.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/client.rb +9 -3
- data/lib/cloud/navi_cloud_client.rb +17 -1
- data/lib/local/navi_local_client.rb +7 -1
- data/lib/navi_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8c3281c7fe9cefc025a5f027e1628704c3e3f48ad3e44d9d78145f44811af9b
|
4
|
+
data.tar.gz: 363af32e8f32120620fe5997c045c11960cdb526ca1c840cb9ef644b21868176
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45d8b5a96116df63b3752d3fb2ac6d37e2a4fb294519f991c554d21c3d3e62b258ea33289412d59ccc512ff10f88cf5d2eb7f7f737fce1b1bc0b860349d1f71b
|
7
|
+
data.tar.gz: dcb3be86e1b65c41da9e11bcfe1cabb73a518611fd22c62ddf0079ebea4c2573639d3db2af2dc2a2f3a4d3a06c52ee8bdcc3615a78343f4fcb302feb8f453e21
|
data/lib/client.rb
CHANGED
@@ -81,7 +81,8 @@ module Client
|
|
81
81
|
message_ids = imap.uid_search(search_condition)
|
82
82
|
|
83
83
|
meta_dir = @download_path + 'meta/'
|
84
|
-
|
84
|
+
|
85
|
+
message_ids_saved = getMessageUUIds(meta_dir)
|
85
86
|
|
86
87
|
message_ids = message_ids - message_ids_saved
|
87
88
|
|
@@ -113,7 +114,12 @@ module Client
|
|
113
114
|
end
|
114
115
|
end
|
115
116
|
rescue => e
|
116
|
-
|
117
|
+
|
118
|
+
unless logger.nil?
|
119
|
+
logger.info "Issue processing email for uuid ##{message_id}, #{e.message}"
|
120
|
+
end
|
121
|
+
|
122
|
+
logToLoggly({event:"EMAIL_SYNC_FAILED", env: @env, storage: @client_type, email: @current_user_email, uuid: message_id, error: e.message})
|
117
123
|
end
|
118
124
|
end
|
119
125
|
end
|
@@ -216,7 +222,7 @@ module Client
|
|
216
222
|
end
|
217
223
|
|
218
224
|
else
|
219
|
-
if @debug
|
225
|
+
if @debug && !@logger.nil?
|
220
226
|
@logger.info "Logging to Loggly disabled"
|
221
227
|
@logger.info messageBody
|
222
228
|
end
|
@@ -13,7 +13,7 @@ module NaviClient
|
|
13
13
|
|
14
14
|
attr_reader :id
|
15
15
|
|
16
|
-
def initialize(sso_web_url = "http://localhost:3008/")
|
16
|
+
def initialize(sso_web_url = "http://localhost:3008/", env = "development")
|
17
17
|
super()
|
18
18
|
|
19
19
|
# client-id used to track the process
|
@@ -41,6 +41,7 @@ module NaviClient
|
|
41
41
|
|
42
42
|
# set email_address of current_user for s3 folder name
|
43
43
|
@current_user_email = nil
|
44
|
+
@env = env
|
44
45
|
end
|
45
46
|
|
46
47
|
def override_logger(logger)
|
@@ -117,6 +118,21 @@ module NaviClient
|
|
117
118
|
return ""
|
118
119
|
end
|
119
120
|
|
121
|
+
def s3_resource_files(bucket_name, prefix)
|
122
|
+
files = []
|
123
|
+
credentials = Aws::Credentials.new(config[:aws_key], config[:aws_secret])
|
124
|
+
s3 = Aws::S3::Resource.new(credentials: credentials, region: config[:aws_region])
|
125
|
+
s3.bucket(bucket_name).objects(prefix: prefix).each do |obj|
|
126
|
+
files << obj.key
|
127
|
+
end
|
128
|
+
return files
|
129
|
+
end
|
130
|
+
|
131
|
+
def getMessageUUIds(prefix)
|
132
|
+
files = s3_resource_files(config[:s3_bucket], prefix)
|
133
|
+
files.empty? ? [] : files.map { |i| i.empty? ? 0 : i.split('/').last.split("_").first.to_i }
|
134
|
+
end
|
135
|
+
|
120
136
|
def config
|
121
137
|
YAML.load_file(Rails.root.join("config/navi_client.yml")).with_indifferent_access
|
122
138
|
end
|
@@ -10,7 +10,7 @@ module NaviClient
|
|
10
10
|
include Client
|
11
11
|
CONFIG_PATH = File.join(ENV['HOME'], '/.navi/config.yml')
|
12
12
|
|
13
|
-
def initialize(sso_web_url = 'http://localhost:3008', client_type = "local", gen_csv_url = "http://localhost:3020/v2/generate_csv_input", debug = true)
|
13
|
+
def initialize(sso_web_url = 'http://localhost:3008', client_type = "local", gen_csv_url = "http://localhost:3020/v2/generate_csv_input", debug = true, env = "development")
|
14
14
|
# flag to print Ruby library debug info (very detailed)
|
15
15
|
@net_imap_debug = false
|
16
16
|
|
@@ -30,10 +30,12 @@ module NaviClient
|
|
30
30
|
@token = nil
|
31
31
|
|
32
32
|
@download_path = config['download_path'] + config['username'] + '/'
|
33
|
+
@current_user_email = config['username']
|
33
34
|
|
34
35
|
# client_type
|
35
36
|
@client_type = client_type
|
36
37
|
@gen_csv_url = gen_csv_url
|
38
|
+
@env = env
|
37
39
|
end
|
38
40
|
|
39
41
|
#
|
@@ -185,6 +187,10 @@ module NaviClient
|
|
185
187
|
return aes_key_path, iv_path
|
186
188
|
end
|
187
189
|
|
190
|
+
def getMessageUUIds(path)
|
191
|
+
File.directory?(path) ? (Dir.entries path).map { |i| i.split("_").first.to_i } : []
|
192
|
+
end
|
193
|
+
|
188
194
|
def update_config(data)
|
189
195
|
File.write(CONFIG_PATH, YAML.dump(data))
|
190
196
|
end
|
data/lib/navi_client/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: navi_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sujit
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-03
|
13
|
+
date: 2018-04-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|