navi_email_sync 0.0.1 → 0.0.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/cloud/navi_cloud_client.rb +2 -2
- data/lib/http_service/naviai.rb +2 -2
- data/lib/local/navi_local_client.rb +4 -4
- 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: 934537074827c79c56832c092e7bd92d6c288e839907625753e7d0b1710b6150
         | 
| 4 | 
            +
              data.tar.gz: efac55ec81d6230e7e8ccfce6a0f2ad021c63fe61447c23c4a476bbca0bc0c59
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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 |  | 
    
        data/lib/http_service/naviai.rb
    CHANGED
    
    | @@ -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. | 
| 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 |  | 
    
        data/lib/navi_client/version.rb
    CHANGED
    
    
    
        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. | 
| 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- | 
| 11 | 
            +
            date: 2018-06-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |