navi_email_sync 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb23348504b8e7954bdf7093b22ed565df930c368131827938098ab926aec925
4
- data.tar.gz: 9232cb2fea5c1dbcb207ed450a827f8864f5094824d578ebee179a3eba94df32
3
+ metadata.gz: 934537074827c79c56832c092e7bd92d6c288e839907625753e7d0b1710b6150
4
+ data.tar.gz: efac55ec81d6230e7e8ccfce6a0f2ad021c63fe61447c23c4a476bbca0bc0c59
5
5
  SHA512:
6
- metadata.gz: 61d2b62886f6c3873721f5abe46ba3ba0733cf72cb6c26a656cf4b2a4cec6f8bad3c4dda5a47c6624de0336d4405c4876e5190042362e8eb4f6e5a11c5e9c0c0
7
- data.tar.gz: 247f7c139a5d5beaec3b7e1a070f0c8bf115ba6a8a8e74d760b0301a571cd16c7acfac0d09d5ef34437a9149e7e03811b4794a1a01ea77be02ac639281ee81fe
6
+ metadata.gz: 44d59ea927679c55fa2d02b1e0498dab9392c06f9d885c2cf9e8d8da8a7768e63ecb098a8fee57ab2ff174880415d73b7ce2b0c4dbd04d413149b5211d002086
7
+ data.tar.gz: f40da4bc55e6680fe6db4ab2ba56624e75b65cf2eba47160aa9271a5f3e3d8615126cecc63252eeaa4ed845d0e3c4db37d5f1f236fba11a3f58db7fbfa035b8e
@@ -65,13 +65,13 @@ module NaviEmailSync
65
65
  ##
66
66
  # send bulk request to navi-ai service with list of input files downloaded from imap server.
67
67
  #
68
- def send_request(in_filenames = [], is_last: false)
68
+ def send_request(in_filenames = [], is_last: false, email_count:)
69
69
  unless in_filenames.blank?
70
70
  download_path = config['s3_download_folder'] + "/" + @current_user_email
71
71
  filepath = download_path + "/inputs/" + (Time.now.to_f * 1000).to_s
72
72
  filename = upload_to_s3(filepath, in_filenames.join("\n"))
73
73
 
74
- HTTPService::NaviAI.start(filepath: filename, client_id: @id, client_type: @client_type, token: @token, email: @current_user_email, is_last: is_last)
74
+ HTTPService::NaviAI.start(filepath: filename, client_id: @id, client_type: @client_type, token: @token, email: @current_user_email, is_last: is_last, email_count: email_count)
75
75
  end
76
76
  end
77
77
 
@@ -3,9 +3,9 @@ require "httparty"
3
3
  module HTTPService
4
4
  class NaviAI
5
5
 
6
- def self.start(filepath:, client_id: nil, client_type:, token:, email:, is_last: false)
6
+ def self.start(filepath:, client_id: nil, client_type:, token:, email:, is_last: false, email_count:)
7
7
  go_url = "#{ENV['parser_url']}/v2/metas"
8
- HTTParty.post(go_url, body: { client_id: client_id, client_type: client_type, list_meta_path: filepath, token: token, email: email, is_last: is_last }.to_json, timeout: 400)
8
+ HTTParty.post(go_url, body: { client_id: client_id, client_type: client_type, list_meta_path: filepath, token: token, email: email, is_last: is_last, email_count: email_count }.to_json, timeout: 400)
9
9
  end
10
10
 
11
11
  def self.generate_csv(url, token)
@@ -110,7 +110,7 @@ module NaviEmailSync
110
110
  ##
111
111
  # send bulk request to navi-ai service with list of input files downloaded from imap server.
112
112
  #
113
- def send_request(in_filenames = [], stamp, is_last: false)
113
+ def send_request(in_filenames = [], stamp, is_last: false, email_count:)
114
114
  unless in_filenames.empty?
115
115
  filename = @download_path + "inputs/#{stamp}"
116
116
 
@@ -120,7 +120,7 @@ module NaviEmailSync
120
120
  in_filenames.each { |element| f.puts(element) }
121
121
  end
122
122
 
123
- response = HTTPService::NaviAI.start(filepath: filename, client_type: @client_type, token: @token, email: config['username'], is_last: is_last)
123
+ response = HTTPService::NaviAI.start(filepath: filename, client_type: @client_type, token: @token, email: config['username'], is_last: is_last, email_count: email_count)
124
124
  return response
125
125
  end
126
126
  end
@@ -170,9 +170,9 @@ module NaviEmailSync
170
170
  callback.call(mail, i, id, true) unless callback.nil?
171
171
  }
172
172
 
173
- @logger.info "Sending Request for #{filenames.size} emails to Navi AI."
173
+ @logger.info "Sending Request for #{filenames.length} emails to Navi AI."
174
174
  navi_control.call(true) unless navi_control.nil?
175
- self.send_request(filenames, stamp, is_last: true)
175
+ self.send_request(filenames, stamp, is_last: true, email_count: filenames.length)
176
176
 
177
177
  # HTTPService::NaviAI.generate_csv("#{@gen_csv_url}?email=#{username}", @token)
178
178
 
@@ -1,3 +1,3 @@
1
1
  module NaviEmailSync
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: navi_email_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sanjib
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-13 00:00:00.000000000 Z
11
+ date: 2018-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler