navi_client 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/local/navi_local_client.rb +12 -5
- 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: 50d073876d1eadbec8a1e79f80aca5026e543559f2648d23c54aaba5997aba7e
|
4
|
+
data.tar.gz: e7ecc32401669850c76251e53bcb242be53f3cb5c515813006dbd3b6d2d309cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ea63491dd0914cee7ad46296c69aaf06aeb7f23a98164e32a74ac4ed93b48afa408884d7fbbcbe73012c0a5c39be3ee770b266aba7d47533c8600399668eb64
|
7
|
+
data.tar.gz: a4da4ae35837bd9c0fc612e854c93b1529d4b261577e6fa42cfa1e99eda447b88734f0a29ec80d8f7e0efbb9dcfd5d3a2ef1fe10154975e713b67697f787abaa
|
@@ -146,7 +146,7 @@ module NaviClient
|
|
146
146
|
# retrieve any mail from a folder, following specified search condition
|
147
147
|
# for any mail retrieved call a specified block
|
148
148
|
#
|
149
|
-
def idle_loop(imap, search_condition, folder, server, username, password)
|
149
|
+
def idle_loop(imap, search_condition, folder, server, username, password, callback = nil, navi_control = nil)
|
150
150
|
|
151
151
|
@logger.info "\nwaiting new mails (IDLE loop)..."
|
152
152
|
|
@@ -158,8 +158,9 @@ module NaviClient
|
|
158
158
|
# You'll get all the things from the server. For new emails (EXISTS)
|
159
159
|
if resp.kind_of?(Net::IMAP::UntaggedResponse) and resp.name == "EXISTS"
|
160
160
|
|
161
|
-
@logger.debug resp.inspect if @debug
|
161
|
+
# @logger.debug resp.inspect if @debug
|
162
162
|
# Got something. Send DONE. This breaks you out of the blocking call
|
163
|
+
@logger.debug "New mail received" if @debug
|
163
164
|
imap.idle_done
|
164
165
|
end
|
165
166
|
end
|
@@ -167,12 +168,20 @@ module NaviClient
|
|
167
168
|
# We're out, which means there are some emails ready for us.
|
168
169
|
# Go do a search for UNSEEN and fetch them.
|
169
170
|
filenames = []
|
170
|
-
retrieve_emails(imap, search_condition, folder) { |mail, i, isLast, id|
|
171
|
+
retrieve_emails(imap, search_condition, folder) { |mail, i, isLast, id|
|
172
|
+
callback.call(mail, i, id, false) unless callback.nil?
|
173
|
+
filenames << process_email(mail, id)
|
174
|
+
callback.call(mail, i, id, true) unless callback.nil?
|
175
|
+
}
|
176
|
+
|
177
|
+
@logger.info "Sending Request for #{filenames.size} emails to Navi AI."
|
178
|
+
navi_control.call(true) unless navi_control.nil?
|
171
179
|
self.send_request(filenames)
|
172
180
|
|
173
181
|
HTTPService::NaviAI.generate_csv("#{@gen_csv_url}?email=#{username}", @token)
|
174
182
|
|
175
183
|
@logger.debug "Process Completed." if @debug
|
184
|
+
navi_control.call(false) unless navi_control.nil?
|
176
185
|
|
177
186
|
rescue SignalException => e
|
178
187
|
# http://stackoverflow.com/questions/2089421/capturing-ctrl-c-in-ruby
|
@@ -181,8 +190,6 @@ module NaviClient
|
|
181
190
|
|
182
191
|
rescue Net::IMAP::Error => e
|
183
192
|
@logger.error "Net::IMAP::Error at #{time_now}: #{e.class}. #{e.message}"
|
184
|
-
|
185
|
-
# timeout ? reopen connection
|
186
193
|
imap = imap_connection(server, username, password) #if e.message == 'connection closed'
|
187
194
|
@logger.info "reconnected to server: #{server}"
|
188
195
|
|
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.4.
|
4
|
+
version: 1.4.2
|
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-
|
13
|
+
date: 2018-05-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|