ntq_excelsior_engine 0.4.2 → 0.4.4
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/app/controllers/ntq_excelsior_engine/imports_controller.rb +1 -0
- data/app/interactors/ntq_excelsior_engine/imports/check_lines.rb +1 -1
- data/lib/ntq_excelsior_engine/request.rb +24 -0
- data/lib/ntq_excelsior_engine/version.rb +1 -1
- data/lib/ntq_excelsior_engine.rb +4 -0
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9f31f5cb4b6498540cb0a9742e4539b6e8c259c2bbf1076d6eb3748a0579c562
         | 
| 4 | 
            +
              data.tar.gz: ef28c9579f1607e09a0325344050deb3bf7112b8744cbb56a605e2eaf7177b2d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8fbbfc93950e6cdb9532454c0ef93a3ab18a53f2add210c7f702fcd4d4747d4300307bb4ef1b8dc776a2650dfd54677e67d4bca6a9c6a1c620c0b81a770357fd
         | 
| 7 | 
            +
              data.tar.gz: 98bdcef0a3993eacf6c0d01e2798379492c1abbe3faa874becdc674c5adb26dbc3fe4ee3fa094caf3e113d20fc25996e0e2c632a331491b1449fa93a92d30abc
         | 
| @@ -32,6 +32,7 @@ module NtqExcelsiorEngine | |
| 32 32 |  | 
| 33 33 | 
             
                def create
         | 
| 34 34 | 
             
                  @import_file = ::NtqExcelsiorEngine::Import.new import_type: params[:type]
         | 
| 35 | 
            +
                  @import_file.created_by = NtqExcelsiorEngine.request.whoimportit
         | 
| 35 36 | 
             
                  @import_file.file = file_params
         | 
| 36 37 | 
             
                  yield(@import_file) if block_given?
         | 
| 37 38 | 
             
                  @import_file.inspect
         | 
| @@ -18,7 +18,7 @@ module NtqExcelsiorEngine | |
| 18 18 | 
             
                      line.update(status: result[:status], line_errors: result[:errors], action: result[:action])
         | 
| 19 19 | 
             
                    end
         | 
| 20 20 | 
             
                    sleep 2 if NtqExcelsiorEngine.debug
         | 
| 21 | 
            -
                    import.update(state: import.import_lines.in_error.any? ? 'error' : 'checked')
         | 
| 21 | 
            +
                    import.update(state: import.import_lines.in_error.any? && !NtqExcelsiorEngine.skip_import_on_errors ? 'error' : 'checked')
         | 
| 22 22 | 
             
                  rescue => e
         | 
| 23 23 | 
             
                    p e.inspect
         | 
| 24 24 | 
             
                    Appsignal.send_error(e)
         | 
| @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require "request_store"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module NtqExcelsiorEngine
         | 
| 6 | 
            +
              module Request
         | 
| 7 | 
            +
                module_function
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                def whoimportit=(value)
         | 
| 10 | 
            +
                  store[:whoimportit] = value
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                def whoimportit
         | 
| 14 | 
            +
                  who = store[:whoimportit]
         | 
| 15 | 
            +
                  who.respond_to?(:call) ? who.call : who
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                def store
         | 
| 19 | 
            +
                  RequestStore.store[:ntq_excelsior_engine] ||= {
         | 
| 20 | 
            +
                    whoimportit: nil
         | 
| 21 | 
            +
                  }
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
            end
         | 
    
        data/lib/ntq_excelsior_engine.rb
    CHANGED
    
    | @@ -1,5 +1,6 @@ | |
| 1 1 | 
             
            require "ntq_excelsior_engine/version"
         | 
| 2 2 | 
             
            require "ntq_excelsior_engine/engine"
         | 
| 3 | 
            +
            require "ntq_excelsior_engine/request"
         | 
| 3 4 |  | 
| 4 5 | 
             
            module NtqExcelsiorEngine
         | 
| 5 6 | 
             
              mattr_accessor :import_active
         | 
| @@ -26,6 +27,9 @@ module NtqExcelsiorEngine | |
| 26 27 | 
             
              mattr_accessor :skip_import_on_errors
         | 
| 27 28 | 
             
              @@skip_import_on_errors = true
         | 
| 28 29 |  | 
| 30 | 
            +
              mattr_accessor :request
         | 
| 31 | 
            +
              @@request = NtqExcelsiorEngine::Request
         | 
| 32 | 
            +
             | 
| 29 33 | 
             
              def self.setup
         | 
| 30 34 | 
             
                yield self
         | 
| 31 35 | 
             
              end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: ntq_excelsior_engine
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.4. | 
| 4 | 
            +
              version: 0.4.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Kevin
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2023- | 
| 11 | 
            +
            date: 2023-06-12 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         | 
| @@ -167,6 +167,7 @@ files: | |
| 167 167 | 
             
            - lib/generators/templates/ntq_excelsior_engine.rb
         | 
| 168 168 | 
             
            - lib/ntq_excelsior_engine.rb
         | 
| 169 169 | 
             
            - lib/ntq_excelsior_engine/engine.rb
         | 
| 170 | 
            +
            - lib/ntq_excelsior_engine/request.rb
         | 
| 170 171 | 
             
            - lib/ntq_excelsior_engine/version.rb
         | 
| 171 172 | 
             
            - lib/tasks/ntq_excelsior_engine_tasks.rake
         | 
| 172 173 | 
             
            homepage: https://github.com/9troisquarts/ntq-excelsior-engine
         |