eco-helpers 1.5.11 → 1.5.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b9af4f974524b36ddd0fad5316d37281f0a9a2e7dd2f03d2f5febbaef957313
4
- data.tar.gz: '003906cbfc9389e184b238001997ad1f444355cfbccd9d609f9197445ad3a369'
3
+ metadata.gz: cb7b7377b64d086bb76f11f99c2f63f19eae2e25c67dc52fdeb034d58af888f4
4
+ data.tar.gz: d1fecbe4232a57e21a9f100fcb5ef7e0058787cdb19d5e84cb79dfc9d0082889
5
5
  SHA512:
6
- metadata.gz: 5f3b5aa580a10398ebcbf99203f2e6fd4951a20d45d2edd8fd9fff2c0e894ed18f8a54d0537fef4e281465fd7ef7326454df3647bf80051348e6c56d3215866e
7
- data.tar.gz: b53b697f1b07ad41bac8550150d3ab7d9cfe6eb842507e5cc77d8bd3a2dc4a8568621f1f2ba849d44440a42c646c7f844336f43de0db058b798c5cdebd643764
6
+ metadata.gz: 1c77b34e3ce111d4203eb54bd765f04d00044e42cdd53a05443668e3a35589193f95b877b24fe10acbdb0214aab1aaaa5031be6f6f6012983242e4e03ebcfe7a
7
+ data.tar.gz: 2cff100787f222de6300ec9d991b6dba8b36726b64a90ca7618ff35330efe1dd4b0431d197cdf952dc657701357b5ff3f9fe5799f2b749f512baf9f6dd145c83
data/.yardopts CHANGED
@@ -5,5 +5,6 @@
5
5
  --no-private
6
6
  --output-dir ./doc
7
7
  'lib/**/*.rb'
8
+ CHANGELOG.md
8
9
  -
9
10
  LICENSE
@@ -1,7 +1,18 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [1.5.11] - 2021-01-xx
4
+ ## [1.5.12] - 2021-01-xx
5
+
6
+ ### Added
7
+ - `Eco::API::Common::People::DefaultParsers::CSVParser` when cell content is `Null`, capture `nil` value.
8
+
9
+ ### Changed
10
+ - upgraded `ecoportal-api` dependency
11
+
12
+ ### Fixed
13
+
14
+
15
+ ## [1.5.11] - 2021-01-25
5
16
 
6
17
  ### Added
7
18
  - `Eco::API::Organization::TagTree#subtag?` to check if the tag is in any subtree.
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
  s.add_development_dependency "yard", ">= 0.9.18", "< 0.10"
30
30
  s.add_development_dependency "redcarpet", ">= 3.5.0", "< 3.6"
31
31
 
32
- s.add_dependency 'ecoportal-api', '>= 0.7.3', '< 0.8'
32
+ s.add_dependency 'ecoportal-api', '>= 0.7.4', '< 0.8'
33
33
  s.add_dependency 'ecoportal-api-oozes', '>= 0.7.2', '< 0.8'
34
34
  s.add_dependency 'aws-sdk-s3', '>= 1.64.0', '< 2'
35
35
  s.add_dependency 'aws-sdk-ses', '>= 1.29.0', '< 2'
@@ -5,8 +5,7 @@ class Eco::API::Common::People::DefaultParsers::CSVParser < Eco::API::Common::Lo
5
5
  Eco::CSV.parse(data, headers: true, skip_blanks: true).each_with_object([]) do |row, arr_hash|
6
6
  row_hash = row.headers.uniq.each_with_object({}) do |attr, hash|
7
7
  next if attr.to_s.strip.empty?
8
- value = row[attr]
9
- hash[attr.strip] = value.to_s.empty?? nil : value
8
+ hash[attr.strip] = parse_string(row[attr])
10
9
  end
11
10
  arr_hash.push(row_hash)
12
11
  end
@@ -23,4 +22,18 @@ class Eco::API::Common::People::DefaultParsers::CSVParser < Eco::API::Common::Lo
23
22
  CSV::Table.new(arr_rows).to_csv
24
23
  end
25
24
 
25
+ private
26
+
27
+ def parse_string(value)
28
+ return nil if value.to_s.empty?
29
+ return nil if null?(value)
30
+ value
31
+ end
32
+
33
+ def null?(value)
34
+ return true if !value
35
+ str = value.strip.upcase
36
+ ["NULL"].any? {|token| str == token}
37
+ end
38
+
26
39
  end
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "1.5.11"
2
+ VERSION = "1.5.12"
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: 1.5.11
4
+ version: 1.5.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
@@ -116,7 +116,7 @@ dependencies:
116
116
  requirements:
117
117
  - - ">="
118
118
  - !ruby/object:Gem::Version
119
- version: 0.7.3
119
+ version: 0.7.4
120
120
  - - "<"
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0.8'
@@ -126,7 +126,7 @@ dependencies:
126
126
  requirements:
127
127
  - - ">="
128
128
  - !ruby/object:Gem::Version
129
- version: 0.7.3
129
+ version: 0.7.4
130
130
  - - "<"
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0.8'