eco-helpers 1.3.18 → 1.5.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 +4 -4
- data/CHANGELOG.md +36 -1
- data/eco-helpers.gemspec +1 -1
- data/lib/eco/api/common/version_patches/ecoportal_api.rb +0 -2
- data/lib/eco/api/common/version_patches/ecoportal_api/external_person.rb +0 -4
- data/lib/eco/api/common/version_patches/exception.rb +2 -2
- data/lib/eco/api/organization/presets_reference.json +20 -3
- data/lib/eco/api/organization/presets_values.json +5 -1
- data/lib/eco/csv.rb +8 -3
- data/lib/eco/data/files/helpers.rb +7 -2
- data/lib/eco/version.rb +1 -1
- metadata +9 -11
- data/lib/eco/api/common/version_patches/ecoportal_api/account_preferences.rb +0 -32
- data/lib/eco/api/common/version_patches/ecoportal_api/base_model.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27ff9c6e496ac4cc7d08cb7f8fec22096ccd6aa915103de89048229e334cbc46
|
4
|
+
data.tar.gz: 0baecbe3aeb2ea75ce995395f15d2daba1b59a8e5587d2ce1537d99c92db9c61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c435f203bf8d3829829e8d00b74714a479544f48f0d0e081c83b1441a84a5bf6d9be678cab4aa60c09e9f5de3642388904ea52462477c83d259ba6960bab109
|
7
|
+
data.tar.gz: 7750b44622529f48bc58d577e4783affa8b1b5c7db58e780ff974634ee88dadcc4b0a93fe86879eec8cc4854959ce95ffa5cf7c256d5f458a2814715c7b9b6bc
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,42 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [1.
|
4
|
+
## [1.5.0] - 2020-09-11
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- `Eco::Data::Files#file_empty?` to prevent error when checking encoding
|
8
|
+
### Changed
|
9
|
+
- change abilities to align with ecoPortal release `1.5.2`
|
10
|
+
### Fixed
|
11
|
+
- `Eco::CSV#parse` and `Eco::CSV#read` should use the proper `encoding` when it's `bom`
|
12
|
+
* apparently, this can only be achieved by passing an argument such as `rb:bom|utf-8`
|
13
|
+
* best reference found: https://stackoverflow.com/a/60794851/4352306
|
14
|
+
|
15
|
+
## [1.4.2] - 2020-07-23
|
16
|
+
|
17
|
+
### Added
|
18
|
+
### Changed
|
19
|
+
### Fixed
|
20
|
+
- preserve backtrace on logging
|
21
|
+
|
22
|
+
## [1.4.0] - 2020-07-14
|
23
|
+
|
24
|
+
### Added
|
25
|
+
### Changed
|
26
|
+
- change abilities to align with ecoPortal release `1.5.0`
|
27
|
+
- remove some patches on `ecoportal-api`
|
28
|
+
- removed patch method `Ecoportal::API::V1::Person#sync`
|
29
|
+
### Fixed
|
30
|
+
- `Eco::CSV#parse` and `Eco::CSV#read` should use the proper `:encoding` when it's `bom`
|
31
|
+
|
32
|
+
## [1.3.19] - 2020-07-23
|
33
|
+
|
34
|
+
### Added
|
35
|
+
### Changed
|
36
|
+
### Fixed
|
37
|
+
- preserve backtrace on logging
|
38
|
+
|
39
|
+
## [1.3.18] - 2020-07-08
|
5
40
|
|
6
41
|
### Added
|
7
42
|
### Changed
|
data/eco-helpers.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_development_dependency "yard", "~> 0.9", ">= 0.9.18"
|
29
29
|
s.add_development_dependency "redcarpet", "~> 3.5", ">= 3.5.0"
|
30
30
|
|
31
|
-
s.add_dependency 'ecoportal-api', '~> 0.
|
31
|
+
s.add_dependency 'ecoportal-api', '~> 0.7', '>= 0.7.0'
|
32
32
|
s.add_dependency 'aws-sdk-s3', '~> 1', '>= 1.64.0'
|
33
33
|
s.add_dependency 'aws-sdk-ses', '~> 1', '>= 1.29.0'
|
34
34
|
s.add_dependency 'dotenv', '~> 2.7', '>= 2.7.0'
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class ::Exception
|
2
2
|
def patch_full_message
|
3
3
|
msg = []
|
4
|
-
msg << "#{backtrace.
|
5
|
-
backtrace.
|
4
|
+
msg << "\n#{backtrace.first} \n#{message} (#{self.class.to_s})"
|
5
|
+
backtrace[1..-1].each_with_index {|bt, i| msg << "#{" "*8}#{i+1}: from #{bt}"}
|
6
6
|
msg.join("\n")
|
7
7
|
end
|
8
8
|
end
|
@@ -5,6 +5,11 @@
|
|
5
5
|
"reports": "view",
|
6
6
|
"organization": null,
|
7
7
|
"people": null,
|
8
|
+
"person_core": null,
|
9
|
+
"person_core_create": null,
|
10
|
+
"person_core_edit": null,
|
11
|
+
"person_account": null,
|
12
|
+
"person_details": null,
|
8
13
|
"pages": "view",
|
9
14
|
"page_editor": null,
|
10
15
|
"registers": "view"
|
@@ -14,7 +19,11 @@
|
|
14
19
|
"data": "view",
|
15
20
|
"reports": "view",
|
16
21
|
"organization": null,
|
17
|
-
"
|
22
|
+
"person_core": "attach",
|
23
|
+
"person_core_create": null,
|
24
|
+
"person_core_edit": null,
|
25
|
+
"person_account": null,
|
26
|
+
"person_details": "view",
|
18
27
|
"pages": "create",
|
19
28
|
"page_editor": "basic",
|
20
29
|
"registers": "view"
|
@@ -24,7 +33,11 @@
|
|
24
33
|
"data": "update",
|
25
34
|
"reports": "edit",
|
26
35
|
"organization": "view",
|
27
|
-
"
|
36
|
+
"person_core": "view_people_manager",
|
37
|
+
"person_core_create": null,
|
38
|
+
"person_core_edit": null,
|
39
|
+
"person_account": "view",
|
40
|
+
"person_details": "view",
|
28
41
|
"pages": "create",
|
29
42
|
"page_editor": "intermediate",
|
30
43
|
"registers": "view"
|
@@ -34,7 +47,11 @@
|
|
34
47
|
"data": "administrate",
|
35
48
|
"reports": "administrate",
|
36
49
|
"organization": "administrate",
|
37
|
-
"
|
50
|
+
"person_core": "view_people_manager",
|
51
|
+
"person_core_create": "create",
|
52
|
+
"person_core_edit": "edit",
|
53
|
+
"person_account": "edit",
|
54
|
+
"person_details": "edit_private",
|
38
55
|
"pages": "administrate",
|
39
56
|
"page_editor": "advanced",
|
40
57
|
"registers": "dashboard"
|
@@ -3,7 +3,11 @@
|
|
3
3
|
"data": [null, "view", "update", "administrate", "implement"],
|
4
4
|
"reports": [null, "view", "edit", "administrate"],
|
5
5
|
"organization": [null, "view", "administrate", "implement"],
|
6
|
-
"
|
6
|
+
"person_core": [null, "attach", "view_people_manager", "dashboard"],
|
7
|
+
"person_core_create": [null, "create"],
|
8
|
+
"person_core_edit": [null, "edit"],
|
9
|
+
"person_account": [null, "view", "create", "edit"],
|
10
|
+
"person_details": [null, "view", "edit_public", "view_private", "edit_private"],
|
7
11
|
"pages": [null, "view", "update", "create", "administrate"],
|
8
12
|
"page_editor": [null, "basic", "intermediate", "advanced", "implement"],
|
9
13
|
"registers": [null, "view", "dashboard", "administrate", "implement"]
|
data/lib/eco/csv.rb
CHANGED
@@ -15,9 +15,14 @@ module Eco
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def read(file, **kargs)
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
kargs = {headers: true, skip_blanks: true}.merge(kargs)
|
19
|
+
|
20
|
+
args = [file].tap do |arg|
|
21
|
+
coding = Eco::API::Common::Session::FileManager.encoding(file)
|
22
|
+
arg.push("rb:bom|utf-8") if coding == "bom"
|
23
|
+
end
|
24
|
+
|
25
|
+
out = super(*args, **kargs).reject do |row|
|
21
26
|
values = row.to_hash.values
|
22
27
|
values.all?(&:nil?) || values.map(&:to_s).all?(&:empty?)
|
23
28
|
end
|
@@ -62,8 +62,13 @@ module Eco
|
|
62
62
|
File.write(dest_file, File.read(source_file))
|
63
63
|
end
|
64
64
|
|
65
|
+
def file_empty?(path)
|
66
|
+
return true if !File.file?(path)
|
67
|
+
File.zero?(path)
|
68
|
+
end
|
69
|
+
|
65
70
|
def has_bom?(path)
|
66
|
-
return false if !path
|
71
|
+
return false if !path || file_empty?(path)
|
67
72
|
File.open(path, "rb") do |f|
|
68
73
|
bytes = f.read(3)
|
69
74
|
return bytes.unpack("C*") == [239, 187, 191]
|
@@ -71,7 +76,7 @@ module Eco
|
|
71
76
|
end
|
72
77
|
|
73
78
|
def encoding(path)
|
74
|
-
has_bom?(path) ? "bom
|
79
|
+
has_bom?(path) ? "bom" : "utf-8"
|
75
80
|
end
|
76
81
|
|
77
82
|
def script_subfolder
|
data/lib/eco/version.rb
CHANGED
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.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
@@ -108,22 +108,22 @@ dependencies:
|
|
108
108
|
name: ecoportal-api
|
109
109
|
requirement: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- - "~>"
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version: '0.5'
|
114
111
|
- - ">="
|
115
112
|
- !ruby/object:Gem::Version
|
116
|
-
version: 0.
|
113
|
+
version: 0.7.0
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0.7'
|
117
117
|
type: :runtime
|
118
118
|
prerelease: false
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '0.5'
|
124
121
|
- - ">="
|
125
122
|
- !ruby/object:Gem::Version
|
126
|
-
version: 0.
|
123
|
+
version: 0.7.0
|
124
|
+
- - "~>"
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0.7'
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: aws-sdk-s3
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -253,8 +253,6 @@ files:
|
|
253
253
|
- lib/eco/api/common/session/sftp.rb
|
254
254
|
- lib/eco/api/common/version_patches.rb
|
255
255
|
- lib/eco/api/common/version_patches/ecoportal_api.rb
|
256
|
-
- lib/eco/api/common/version_patches/ecoportal_api/account_preferences.rb
|
257
|
-
- lib/eco/api/common/version_patches/ecoportal_api/base_model.rb
|
258
256
|
- lib/eco/api/common/version_patches/ecoportal_api/external_person.rb
|
259
257
|
- lib/eco/api/common/version_patches/ecoportal_api/internal_person.rb
|
260
258
|
- lib/eco/api/common/version_patches/exception.rb
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module Ecoportal
|
2
|
-
module API
|
3
|
-
class Internal
|
4
|
-
class Preferences < Common::BaseModel
|
5
|
-
passthrough :kiosk_enabled, :kiosk_workflow_message, :kiosk_create_button_label,
|
6
|
-
:kiosk_create_button_help, :kiosk_return_button_label, :kiosk_return_button_help,
|
7
|
-
:kiosk_dashboard_button_label, :kiosk_dashboard_button_help
|
8
|
-
|
9
|
-
[
|
10
|
-
:show_sidebar,
|
11
|
-
:show_shortcuts,
|
12
|
-
:show_coming_soon,
|
13
|
-
:show_recently_visited_forms,
|
14
|
-
:show_tasks,
|
15
|
-
:show_task_bubbles
|
16
|
-
].map(&:to_s).each do |field|
|
17
|
-
define_method(field) do
|
18
|
-
if doc.key?(field)
|
19
|
-
doc[field]
|
20
|
-
else
|
21
|
-
true
|
22
|
-
end
|
23
|
-
end
|
24
|
-
define_method("#{field}=") do |value|
|
25
|
-
doc[field] = !!value
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Ecoportal
|
2
|
-
module API
|
3
|
-
module Common
|
4
|
-
class BaseModel
|
5
|
-
|
6
|
-
attr_reader :initial_doc
|
7
|
-
|
8
|
-
def initialize(doc = {}, parent: self, key: nil)
|
9
|
-
@_parent = parent
|
10
|
-
@_key = key
|
11
|
-
if !_parent || !_key
|
12
|
-
@doc = doc
|
13
|
-
@original_doc = JSON.parse(@doc.to_json)
|
14
|
-
@initial_doc = JSON.parse(@doc.to_json)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def initial_doc
|
19
|
-
raise UnlinkedModel.new unless linked?
|
20
|
-
return @initial_doc if is_root?
|
21
|
-
_parent.initial_doc.dig(*[_key].flatten)
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|