eco-helpers 2.0.29 → 2.0.30

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: 89eb45172e9558ceb184ec289f435c5d2d853d8c7740f7922b0f3fe8727341a3
4
- data.tar.gz: 7419eaed8d878f2f7d333928683a6f03ddeec94c13fa1fceabb716f8ece9cc4a
3
+ metadata.gz: 3488b397afbd0ba2691eb14dd6983891737a973e1a6f1ba31e61d8233f4d5764
4
+ data.tar.gz: 3faa75a89cf0602b92e270bbf77b61452e64d38b6fa3949a537b7b705a58b7e1
5
5
  SHA512:
6
- metadata.gz: '00395c4a6f51be7b846a37db9bb9b407ef21dbf8e86f76c41a58cb6ac9a34341f3a9c399d41de14a0f5922b46d9ee7b812750d9db7b1c7b7f4c131f5c17fb0aa'
7
- data.tar.gz: df59209eaf8b90dfe43019150b0569398a0fb26ad96894da2641ad453a1d3aa815495ce9f035555a8f7a804689d931dc43e0882022a705bb9f1a650f75cae996
6
+ metadata.gz: 2a2e5cb8179c1aa5b171d01586675c5c8d71ab3acc6bb400f66f41610339ac1a5265370774bc27d6e2963b775e56e7f238a9ea928d1ab7f136e970e662108c03
7
+ data.tar.gz: 5c5895f563af52455c318976f854c39e48773a46b38851f4ba37343fafb68faffa0049dc6ccb7054db24f44ff54b1abceac07808ec7c522d3e97e9d55e086e6c
data/CHANGELOG.md CHANGED
@@ -1,12 +1,18 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [2.0.29] - 2021-07-08
4
+ ## [2.0.30] - 2021-07-xx
5
5
 
6
6
  ### Added
7
+ * `Eco::API::Common::People::DefaultParsers::XLSParser` uses as default the `fields_map.json` to identify the headers.
7
8
 
8
9
  ### Changed
9
10
 
11
+ ### Fixed
12
+ * `Eco::API::Common::People::DefaultParsers::XLSParser` should return all `String` values
13
+
14
+ ## [2.0.29] - 2021-07-08
15
+
10
16
  ### Fixed
11
17
  - `Eco::API::Common::People::PersonEntryAttributeMapper#details_attrs`
12
18
  * What a mess this was doing to the `csv` export :/
@@ -75,9 +81,6 @@ All notable changes to this project will be documented in this file.
75
81
  * when in `dry-run` it fakes the `id` with a counter
76
82
  - `Eco::API::Common::People::PersonFactory` gets `subordinates` initialized to `0` (when **creating** a `new` person)
77
83
 
78
- ### Fixed
79
-
80
-
81
84
  ## [2.0.25] - 2021-06-23
82
85
 
83
86
  ### Added
@@ -5,7 +5,7 @@ module Eco
5
5
  class Base
6
6
  extend Eco::API::Common::ClassHelpers
7
7
 
8
- class << self
8
+ class << self
9
9
  # Sort order
10
10
  def <=>(other)
11
11
  created_at <=> other.created_at
@@ -6,7 +6,12 @@ class Eco::API::Common::People::DefaultParsers::XLSParser < Eco::API::Common::Lo
6
6
 
7
7
  def parser(file, deps)
8
8
  @file = file
9
- rows.tap {|r| @file = nil}
9
+ rows.tap do |rws|
10
+ @file = nil
11
+ rws.each do |row|
12
+ to_string!(row)
13
+ end
14
+ end
10
15
  end
11
16
 
12
17
  def serializer(array_hash, deps)
@@ -15,8 +20,18 @@ class Eco::API::Common::People::DefaultParsers::XLSParser < Eco::API::Common::Lo
15
20
 
16
21
  private
17
22
 
23
+ def to_string!(row)
24
+ row.transform_values! do |val|
25
+ next nil unless val
26
+ next val if val.is_a?(String)
27
+ val.to_s
28
+ end
29
+ end
30
+
31
+
18
32
  def headers
19
- raise "You should implement this method"
33
+ logger.warn("Headers detection is using your fields_map.json file (native behaviour)")
34
+ session.fields_mapper.list(:external).uniq
20
35
  end
21
36
 
22
37
  def sheet_name
@@ -34,7 +49,7 @@ class Eco::API::Common::People::DefaultParsers::XLSParser < Eco::API::Common::Lo
34
49
 
35
50
  def rows(target = headers)
36
51
  begin
37
- spreadheet.parse(header_search: target)
52
+ spreadheet.parse(header_search: target, clean: true)
38
53
  rescue Roo::HeaderRowNotFoundError => e
39
54
  missing = JSON.parse(e.message)
40
55
  logger.warn("The input file is missing these headers: #{missing}")
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "2.0.29"
2
+ VERSION = "2.0.30"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.29
4
+ version: 2.0.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura