imp_exp 1.1.2 → 1.2.0

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: b590fb77458ecbbde482ccc594ac06b3480551b6f32ad6361c9e34b30cd4c49b
4
- data.tar.gz: 5ac34f8c6a50ec3a2d1571ffa83ccb9a07241c1822ab4860b217d3980c941961
3
+ metadata.gz: 94c393f1951d6c5ce96e649b5ddebeb783e4602d136808852826903bdc656374
4
+ data.tar.gz: e4ddda971aeaa6f46fce2fa376dfd904b7e3f1fc43a289aef5d6980ec6520e0e
5
5
  SHA512:
6
- metadata.gz: 1551c0ad5706897955e9be29229686b9b1c65b0307654114c23dea08ce62771e90bbdcbcc5df867012b0ed9e8774caffded874cc5d4da6ed62ecc450e9c14162
7
- data.tar.gz: b677f5e62d8e066bc1254efdfc00faa15f39266ddb95945d2e800f5178b912a25e87cc14ff7a80d0d4ae9a789b7ae5d4908cd23eb7ace35dede73161c011c4da
6
+ metadata.gz: 0d192022028986ba40750b6abe36b480c0a7167657b71cb2a2528edc4760bfaa61f1a543a73a6893cdf1fd916bfd70ccc2d8aee6f5cbaa95107d9801a79fc2be
7
+ data.tar.gz: 8ffdaf906fa00dbc63613d18334aef5f5c89007e892dcc17669f35efcbe7cea9696fd3d43696e2f8435e1ee2fe93f804c4567d5f0ea3444bf6fc36109ec45f9f
@@ -82,8 +82,7 @@ module ImpExp
82
82
  end
83
83
 
84
84
  begin
85
- if record.save(context: :import)
86
- model.after_save(record)
85
+ if model.save(record)
87
86
  @imported[model.model_name] += 1
88
87
  next
89
88
  end
@@ -145,7 +144,7 @@ module ImpExp
145
144
 
146
145
  full_file_path = File.join(files_directory_path, file_path.strip)
147
146
  begin
148
- file = File.open(full_file_path)
147
+ file = File.open(full_file_path) # rubocop:disable Style/FileOpen
149
148
  record.send(file_attribute_name).attach(io: file, filename: File.basename(file_path))
150
149
  rescue Errno::ENOENT
151
150
  error_msg = I18n.t('imp_exp.importer.file_not_found', file_path: file_path)
@@ -143,7 +143,9 @@ module ImpExp
143
143
  "#{active_storage_file.name}-#{active_storage_file.record.code}#{file_extension(active_storage_file)}"
144
144
  end
145
145
 
146
- def after_save(_record); end
146
+ def save(record)
147
+ record.save(context: :import)
148
+ end
147
149
 
148
150
  private
149
151
 
@@ -26,7 +26,7 @@ module ImpExp
26
26
  return [ImpExp::Serializers::Errors::WrongFormat.new("#{relation_name} error | #{message}")]
27
27
  end
28
28
 
29
- unless data.is_a?(Array) && data.all? { |datum| datum.is_a?(Hash) }
29
+ unless data.is_a?(Array) && data.all?(Hash)
30
30
  return [ImpExp::Serializers::Errors::WrongFormat.new("#{relation_name} should be an array of hashes")]
31
31
  end
32
32
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ImpExp
4
- VERSION = "1.1.2"
4
+ VERSION = "1.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imp_exp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dev team Nerya
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  requirements: []
142
- rubygems_version: 4.0.3
142
+ rubygems_version: 4.0.10
143
143
  specification_version: 4
144
144
  summary: Import data from xlsx into a rails app and export data to xlsx from a rails
145
145
  app