ntq_excelsior_engine 1.1.2 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: adc057b1e2e3be1d8c935f86ae233f0883d0b088ee62bf8ae57254295807cf6b
4
- data.tar.gz: 7119a39155ed904925a3428294b82553d7154521fc9db7fe6d5e191cf344bc12
3
+ metadata.gz: 81b083577e259e62967ac8012e2a6bb73821af86b0ba172a44f235eb4920ae47
4
+ data.tar.gz: c870916a076995484e821d920fb9d2ec49b6177278b51225e2c1bc3098ae5068
5
5
  SHA512:
6
- metadata.gz: 3b0bd03dfed29c4d1bada5c95dea27df727259baa9750b25f8b89a4ddb4598f970aa92844fd88b804ed8a456ec0040ef307824f743d382f84163cd0ec1505c0a
7
- data.tar.gz: e8395d599387614ae95a78ab8f74133d76779303dde776ca450741f2d108d41a1c68de42702ac7edabbeba475d3d6c1a84c461abd014e117853e7a8a3f71b2ca
6
+ metadata.gz: 8361c52d30e203ba0b7803051a0193a738712b92a633760de719a0c9b10ce85213196f405c4d70f7ad11af3ed9482b90e56e3e0ba6f1f90a1672fe403e92c3f5
7
+ data.tar.gz: 4bc126b2449c9931bad6ad81ddfc7a88edc7249ed69130634e611c882fc39c1361bc7e1866103928238e64de7415008889b4c0e724b9260df5d9998b83b38c7f
@@ -1,4 +1,11 @@
1
1
  module NtqExcelsiorEngine
2
2
  class ApplicationController < ::ApplicationController
3
+ before_action :store_request
4
+
5
+ def store_request
6
+ return unless current_user
7
+
8
+ NtqExcelsiorEngine::Request.store[:whoimportit] = current_user
9
+ end
3
10
  end
4
11
  end
@@ -31,7 +31,7 @@ module NtqExcelsiorEngine
31
31
 
32
32
  def create
33
33
  @import_file = ::NtqExcelsiorEngine::Import.new import_type: params[:type]
34
- @import_file.created_by = NtqExcelsiorEngine.request.whoimportit
34
+ @import_file.created_by = NtqExcelsiorEngine.request.whoimportit.id if NtqExcelsiorEngine.request.whoimportit
35
35
  @import_file.file = file_params
36
36
  yield(@import_file) if block_given?
37
37
  @import_file.inspect
@@ -55,9 +55,9 @@ module NtqExcelsiorEngine
55
55
  end
56
56
  render :status, layout: false
57
57
  end
58
-
58
+
59
59
  private
60
-
60
+
61
61
  def ensure_valid_importer_type!
62
62
  valid_types = NtqExcelsiorEngine.importers.keys.map(&:to_s)
63
63
  return render json: {}, status: 422 unless valid_types.include?(params[:type]) || params[:type].blank?
@@ -13,8 +13,9 @@ module NtqExcelsiorEngine
13
13
  importer = context.importer.new
14
14
  importer.options ||= {}
15
15
  importer.options.merge!({
16
- import_id: import.id,
17
- })
16
+ import_id: import.id,
17
+ creator: import.created_by
18
+ })
18
19
  begin
19
20
  import.update(state: 'importing')
20
21
  importer.class.before.call(importer.context, importer.options) if importer.class.before.is_a?(Proc)
@@ -7,9 +7,15 @@ module NtqExcelsiorEngine
7
7
  enum state: { pending: 'pending', buffering: 'buffering', buffered: 'buffered', imported: 'imported',
8
8
  error: 'error', importing: 'importing', checking: 'checking', checked: 'checked' }
9
9
 
10
- serialize :options, Hash
11
- serialize :headers, Hash
12
- serialize :stats, Hash
10
+ if ActiveRecord.version >= Gem::Version.new('7.1')
11
+ serialize :options, coder: YAML, type: Hash
12
+ serialize :headers, coder: YAML, type: Hash
13
+ serialize :stats, coder: YAML, type: Hash
14
+ else
15
+ serialize :options, Hash
16
+ serialize :headers, Hash
17
+ serialize :stats, Hash
18
+ end
13
19
 
14
20
  after_create_commit :process_import!
15
21
 
@@ -2,7 +2,11 @@ module NtqExcelsiorEngine
2
2
  class ImportLine < ApplicationRecord
3
3
  self.table_name = "excelsior_import_lines"
4
4
 
5
- serialize :line, Hash
5
+ if ActiveRecord.version >= Gem::Version.new('7.1')
6
+ serialize :line, coder: YAML, type: Hash
7
+ else
8
+ serialize :line, Hash
9
+ end
6
10
 
7
11
  validates :status, inclusion: { in: %w[error success] }, allow_blank: true
8
12
  validates :action, inclusion: { in: %w[create update] }, allow_blank: true
@@ -1,3 +1,3 @@
1
1
  module NtqExcelsiorEngine
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ntq_excelsior_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-09-23 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -183,7 +182,6 @@ metadata:
183
182
  homepage_uri: https://github.com/9troisquarts/ntq-excelsior-engine
184
183
  source_code_uri: https://github.com/9troisquarts/ntq-excelsior-engine
185
184
  changelog_uri: https://github.com/9troisquarts/ntq-excelsior-engine/CHANGELOG.md
186
- post_install_message:
187
185
  rdoc_options: []
188
186
  require_paths:
189
187
  - lib
@@ -198,8 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
196
  - !ruby/object:Gem::Version
199
197
  version: '0'
200
198
  requirements: []
201
- rubygems_version: 3.3.7
202
- signing_key:
199
+ rubygems_version: 3.6.9
203
200
  specification_version: 4
204
201
  summary: NtqExcelsiorEngine.
205
202
  test_files: []