eco-helpers 2.3.3 → 2.4.3
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 +13 -5
- data/eco-helpers.gemspec +2 -2
- data/lib/eco/api/common/people/entry_factory.rb +4 -2
- data/lib/eco/api/microcases/take_email_from_account.rb +26 -5
- data/lib/eco/version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84e0b3626647d968a77ecc7dbc9dbe052be392ff7590f9f32c2402d4a0fdb45b
|
4
|
+
data.tar.gz: cfd6e253e91d50bd62ffb4cbad8556214a3519ccaf9fdd148c681170ad150466
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4162b785935a8f161ad5030e8ffbd72defd3ed10f50b6d4944b219c0faed84f5cd57efee5a1c43ed41c2f4efdbbcb5ab7356c426dbecd2ebaca2a0da79bba90a
|
7
|
+
data.tar.gz: 5c5ad42b25f53b92fcac214555fb7b2ab9b5af0c033367b375b6ae55334ce0ffa7ecca74d05bac7dd3a75aba7761d9f7be91d5fab44310eb664eeed3df758f83
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,23 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [2.
|
4
|
+
## [2.4.4] - 2023-03-xx
|
5
5
|
|
6
6
|
### Added
|
7
|
-
- Added new option `-input-encoding` to specify the encoding of an input file
|
8
|
-
|
9
7
|
### Changed
|
10
|
-
|
8
|
+
### Fixed
|
9
|
+
|
10
|
+
## [2.4.3] - 2023-03-23
|
11
11
|
|
12
12
|
### Fixed
|
13
|
+
- `Eco::API::MicroCases#take_email_from_account` it was failing at the very (when restoring the original account)
|
14
|
+
- Comes from back-end issue. Adding account with preferences.kiosk_enabled would return:
|
15
|
+
- `{"errors"=>["account > preferences > kiosk_enabled is an unknown field"]}`
|
16
|
+
|
17
|
+
## [2.4.2] - 2023-03-17
|
18
|
+
|
19
|
+
### Fixed
|
20
|
+
- `Eco::API::Common::People::EntryFactory#entries` _bom_ **encoding** (get back support)
|
13
21
|
|
14
22
|
## [2.3.3] - 2023-03-16
|
15
23
|
|
@@ -18,7 +26,7 @@ All notable changes to this project will be documented in this file.
|
|
18
26
|
|
19
27
|
### Changed
|
20
28
|
- `ecoportal-api` **gem** update
|
21
|
-
|
29
|
+
|
22
30
|
|
23
31
|
## [2.3.2] - 2023-03-10
|
24
32
|
|
data/eco-helpers.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://www.ecoportal.com"
|
15
15
|
spec.licenses = %w[MIT]
|
16
16
|
|
17
|
-
spec.required_ruby_version = '>= 2.
|
17
|
+
spec.required_ruby_version = '>= 2.7.2'
|
18
18
|
|
19
19
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
20
20
|
f.match(%r{^(test|spec|features)/})
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
#spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
|
-
spec.add_development_dependency "bundler", ">= 2.
|
27
|
+
spec.add_development_dependency "bundler", ">= 2.4.8", "< 2.5"
|
28
28
|
spec.add_development_dependency "rspec", ">= 3.10.0", "< 3.11"
|
29
29
|
spec.add_development_dependency "rake", ">= 13.0.3", "< 13.1"
|
30
30
|
spec.add_development_dependency "yard", ">= 0.9.26", "< 0.10"
|
@@ -193,14 +193,16 @@ module Eco
|
|
193
193
|
logger.error("File does not exist: #{file}")
|
194
194
|
exit(1)
|
195
195
|
end
|
196
|
-
ext = File.extname(file)
|
196
|
+
#ext = File.extname(file)
|
197
197
|
encoding ||= Eco::API::Common::Session::FileManager.encoding(file)
|
198
|
+
encoding = (encoding == "bom") ? "#{encoding}|utf-8": encoding
|
199
|
+
puts "File encoding: '#{encoding}'" unless !encoding || encoding == 'utf-8'
|
198
200
|
read_with_tolerance(file, encoding: encoding)
|
199
201
|
end
|
200
202
|
|
201
203
|
def read_with_tolerance(file, encoding:)
|
202
204
|
if content = File.read(file, encoding: encoding)
|
203
|
-
content = content.encode("utf-8")
|
205
|
+
content = content.encode("utf-8") unless encoding.include?('utf-8')
|
204
206
|
tolerance = 5
|
205
207
|
content.scrub do |bytes|
|
206
208
|
replacement = '<' + bytes.unpack('H*')[0] + '>'
|
@@ -36,27 +36,33 @@ module Eco
|
|
36
36
|
return false if dest_email.to_s.strip.empty?
|
37
37
|
end
|
38
38
|
|
39
|
-
account_json =
|
39
|
+
account_json = _take_email_account_json(account)
|
40
40
|
person.email = account_email
|
41
41
|
|
42
42
|
if success = _take_email_remove_account!(person, context: context)
|
43
43
|
if success = _take_email_acquire_account!(person, target_email, account: {}, context: context)
|
44
44
|
if success = _take_email_email_free_up!(person, dest_email: dest_email, context: context)
|
45
45
|
if success = _take_email_remove_account!(person, context: context)
|
46
|
+
# Bring back the original account
|
46
47
|
if success = _take_email_acquire_account!(person, account_email, account: account_json, context: context)
|
48
|
+
success = true
|
47
49
|
person.email = target_email
|
48
50
|
end
|
49
51
|
end
|
50
52
|
else # free up target email
|
51
53
|
# restore
|
52
|
-
|
53
|
-
|
54
|
+
reverted = false
|
55
|
+
if reverted ||= _take_email_remove_account!(person, context: context)
|
56
|
+
reverted ||= _take_email_acquire_account!(person, account_email, account: account_json, context: context)
|
54
57
|
end
|
58
|
+
puts "Could not revert back to the original account #{person.identify}" unless reverted
|
55
59
|
success = false
|
56
60
|
end
|
57
61
|
else # aquire other account
|
58
62
|
# restore
|
59
|
-
_take_email_acquire_account!(person, account_email, account: account_json, context: context)
|
63
|
+
unless _take_email_acquire_account!(person, account_email, account: account_json, context: context)
|
64
|
+
puts "Could not bring back the original account we want to update the email to '#{target_email}' #{person.identify}"
|
65
|
+
end
|
60
66
|
success = false
|
61
67
|
end
|
62
68
|
end
|
@@ -65,6 +71,21 @@ module Eco
|
|
65
71
|
|
66
72
|
private
|
67
73
|
|
74
|
+
def _take_email_account_json(account)
|
75
|
+
JSON.parse(account.to_json).tap do |hash|
|
76
|
+
hash.delete("user_id")
|
77
|
+
hash.delete("permissions_merged")
|
78
|
+
hash.delete("permissions_preset")
|
79
|
+
hash.delete("prefilter")
|
80
|
+
if pref = hash["preferences"]
|
81
|
+
hash["preferences"] = pref.reject do |attr, value|
|
82
|
+
attr.start_with?("kiosk")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# Bring the account of the `target_email` taken, so we can change the email of this account
|
68
89
|
def _take_email_acquire_account!(person, target_email, account: {}, context: "Session")
|
69
90
|
person.account = account
|
70
91
|
person.account.send_invites = false
|
@@ -72,6 +93,7 @@ module Eco
|
|
72
93
|
micro.person_update!(person, reason: "bring account with email '#{target_email}'", context: context)
|
73
94
|
end
|
74
95
|
|
96
|
+
# Free up the email (`target_email`) of the account that has it taken to `dest_email`
|
75
97
|
def _take_email_email_free_up!(person, dest_email:, target_email: nil, context: "Session")
|
76
98
|
target_email ||= person.email
|
77
99
|
person.email = dest_email.is_a?(Proc)? dest_email.call(target_email) : dest_email
|
@@ -83,7 +105,6 @@ module Eco
|
|
83
105
|
person.account = nil
|
84
106
|
micro.person_update!(person, reason: "remove account", context: context)
|
85
107
|
end
|
86
|
-
|
87
108
|
end
|
88
109
|
end
|
89
110
|
end
|
data/lib/eco/version.rb
CHANGED
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eco-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2018-09-05 00:00:00.000000000 Z
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.4.8
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '2.
|
22
|
+
version: '2.5'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.
|
29
|
+
version: 2.4.8
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '2.
|
32
|
+
version: '2.5'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rspec
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -390,7 +390,7 @@ dependencies:
|
|
390
390
|
- - "<"
|
391
391
|
- !ruby/object:Gem::Version
|
392
392
|
version: '0.7'
|
393
|
-
description:
|
393
|
+
description:
|
394
394
|
email:
|
395
395
|
- oscar@ecoportal.co.nz
|
396
396
|
executables: []
|
@@ -675,7 +675,7 @@ homepage: https://www.ecoportal.com
|
|
675
675
|
licenses:
|
676
676
|
- MIT
|
677
677
|
metadata: {}
|
678
|
-
post_install_message:
|
678
|
+
post_install_message:
|
679
679
|
rdoc_options: []
|
680
680
|
require_paths:
|
681
681
|
- lib
|
@@ -683,15 +683,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
683
683
|
requirements:
|
684
684
|
- - ">="
|
685
685
|
- !ruby/object:Gem::Version
|
686
|
-
version: 2.
|
686
|
+
version: 2.7.2
|
687
687
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
688
688
|
requirements:
|
689
689
|
- - ">="
|
690
690
|
- !ruby/object:Gem::Version
|
691
691
|
version: '0'
|
692
692
|
requirements: []
|
693
|
-
rubygems_version: 3.
|
694
|
-
signing_key:
|
693
|
+
rubygems_version: 3.1.4
|
694
|
+
signing_key:
|
695
695
|
specification_version: 4
|
696
696
|
summary: eco-helpers to manage people api cases
|
697
697
|
test_files: []
|