eco-helpers 2.0.12 → 2.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +80 -73
- data/eco-helpers.gemspec +6 -4
- data/lib/eco-helpers.rb +1 -0
- data/lib/eco/api/common/base_loader.rb +14 -0
- data/lib/eco/api/common/loaders/use_case.rb +1 -1
- data/lib/eco/api/common/people/default_parsers/date_parser.rb +11 -1
- data/lib/eco/api/common/people/default_parsers/login_providers_parser.rb +1 -1
- data/lib/eco/api/common/people/default_parsers/policy_groups_parser.rb +11 -11
- data/lib/eco/api/common/people/person_entry.rb +9 -2
- data/lib/eco/api/common/people/supervisor_helpers.rb +27 -0
- data/lib/eco/api/common/session/file_manager.rb +2 -2
- data/lib/eco/api/common/session/mailer.rb +0 -1
- data/lib/eco/api/common/session/s3_uploader.rb +0 -1
- data/lib/eco/api/common/session/sftp.rb +0 -1
- data/lib/eco/api/error.rb +5 -3
- data/lib/eco/api/microcases.rb +3 -1
- data/lib/eco/api/microcases/append_usergroups.rb +0 -1
- data/lib/eco/api/microcases/people_cache.rb +2 -2
- data/lib/eco/api/microcases/people_load.rb +2 -2
- data/lib/eco/api/microcases/people_refresh.rb +2 -2
- data/lib/eco/api/microcases/people_search.rb +6 -6
- data/lib/eco/api/microcases/preserve_default_tag.rb +23 -0
- data/lib/eco/api/microcases/preserve_filter_tags.rb +28 -0
- data/lib/eco/api/microcases/preserve_policy_groups.rb +30 -0
- data/lib/eco/api/microcases/set_account.rb +0 -1
- data/lib/eco/api/organization.rb +1 -0
- data/lib/eco/api/organization/people.rb +7 -0
- data/lib/eco/api/organization/people_analytics.rb +60 -0
- data/lib/eco/api/organization/presets_factory.rb +116 -93
- data/lib/eco/api/organization/presets_integrity.json +58 -0
- data/lib/eco/api/organization/presets_values.json +5 -4
- data/lib/eco/api/policies/default_policies/99_user_access_policy.rb +0 -30
- data/lib/eco/api/session.rb +1 -20
- data/lib/eco/api/session/batch.rb +42 -10
- data/lib/eco/api/session/batch/job.rb +3 -0
- data/lib/eco/api/session/config.rb +16 -15
- data/lib/eco/api/session/config/api.rb +4 -0
- data/lib/eco/api/session/config/apis.rb +14 -0
- data/lib/eco/api/session/config/files.rb +7 -0
- data/lib/eco/api/session/config/people.rb +3 -19
- data/lib/eco/api/usecases.rb +2 -0
- data/lib/eco/api/usecases/default_cases.rb +4 -1
- data/lib/eco/api/usecases/default_cases/abstract_policygroup_abilities_case.rb +161 -0
- data/lib/eco/api/usecases/default_cases/analyse_people_case.rb +76 -0
- data/lib/eco/api/usecases/default_cases/codes_to_tags_case.rb +2 -3
- data/lib/eco/api/usecases/default_cases/hris_case.rb +14 -8
- data/lib/eco/api/usecases/default_cases/reset_landing_page_case.rb +11 -1
- data/lib/eco/api/usecases/default_cases/restore_db_case.rb +1 -2
- data/lib/eco/api/usecases/default_cases/supers_cyclic_identify_case.rb +72 -0
- data/lib/eco/api/usecases/default_cases/supers_hierarchy_case.rb +59 -0
- data/lib/eco/api/usecases/default_cases/to_csv_case.rb +104 -26
- data/lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb +62 -36
- data/lib/eco/cli.rb +0 -10
- data/lib/eco/cli/config/default/options.rb +19 -17
- data/lib/eco/cli/config/default/people_filters.rb +3 -3
- data/lib/eco/cli/config/default/usecases.rb +77 -25
- data/lib/eco/cli/config/default/workflow.rb +6 -1
- data/lib/eco/cli/config/help.rb +1 -0
- data/lib/eco/cli/config/options_set.rb +106 -13
- data/lib/eco/cli/config/use_cases.rb +33 -33
- data/lib/eco/cli/scripting/args_helpers.rb +30 -3
- data/lib/eco/data.rb +1 -0
- data/lib/eco/data/crypto/encryption.rb +3 -3
- data/lib/eco/data/files/directory.rb +28 -20
- data/lib/eco/data/files/helpers.rb +6 -4
- data/lib/eco/data/fuzzy_match.rb +119 -0
- data/lib/eco/data/fuzzy_match/array_helpers.rb +75 -0
- data/lib/eco/data/fuzzy_match/chars_position_score.rb +37 -0
- data/lib/eco/data/fuzzy_match/ngrams_score.rb +73 -0
- data/lib/eco/data/fuzzy_match/pairing.rb +102 -0
- data/lib/eco/data/fuzzy_match/result.rb +67 -0
- data/lib/eco/data/fuzzy_match/results.rb +53 -0
- data/lib/eco/data/fuzzy_match/score.rb +44 -0
- data/lib/eco/data/fuzzy_match/stop_words.rb +35 -0
- data/lib/eco/data/fuzzy_match/string_helpers.rb +69 -0
- data/lib/eco/version.rb +1 -1
- metadata +86 -10
- data/lib/eco/api/microcases/refresh_abilities.rb +0 -19
- data/lib/eco/api/organization/presets_reference.json +0 -59
- data/lib/eco/api/usecases/default_cases/refresh_abilities_case.rb +0 -30
@@ -288,10 +288,13 @@ module Eco
|
|
288
288
|
handlers = session.config.error_handlers
|
289
289
|
if status.errors.any? && !handlers.empty? && !error_handler?
|
290
290
|
err_types = status.errors.by_type
|
291
|
+
logger.debug("(#{self.name}) got these error types: #{err_types.keys}")
|
291
292
|
handlers.each do |handler|
|
292
293
|
if entries = err_types[handler.name]
|
293
294
|
handler_job = subjobs_add("#{self.name} => #{handler.name}", usecase: handler)
|
295
|
+
logger.debug("Running error handler #{handler.name}")
|
294
296
|
handler.launch(people: people(entries), session: session, options: options, job: handler_job)
|
297
|
+
logger.debug("Launching job of error handler: #{handler_job.name}")
|
295
298
|
handler_job.launch(simulate: simulate)
|
296
299
|
end
|
297
300
|
end
|
@@ -159,6 +159,8 @@ module Eco
|
|
159
159
|
end
|
160
160
|
|
161
161
|
def working_directory(mode: nil)
|
162
|
+
return files.working_directory if apis.active_api&.one_off?
|
163
|
+
|
162
164
|
unless mode
|
163
165
|
wd = files.working_directory
|
164
166
|
return wd unless wd.to_s.strip.empty?
|
@@ -183,12 +185,21 @@ module Eco
|
|
183
185
|
end
|
184
186
|
|
185
187
|
def require(file = nil, match: nil)
|
186
|
-
|
187
|
-
|
188
|
-
|
188
|
+
begin
|
189
|
+
if match
|
190
|
+
file_manager.dir.dir_files(pattern: match).each do |file|
|
191
|
+
require_relative File.expand_path(file)
|
192
|
+
end
|
193
|
+
else
|
194
|
+
target = File.expand_path(file_manager.dir.file(file))
|
195
|
+
require_relative target
|
196
|
+
end
|
197
|
+
rescue LoadError => e
|
198
|
+
if apis.active_api.one_off?
|
199
|
+
pp e.to_s
|
200
|
+
else
|
201
|
+
raise
|
189
202
|
end
|
190
|
-
else
|
191
|
-
require_relative "#{File.expand_path(file_manager.dir.file(file))}"
|
192
203
|
end
|
193
204
|
end
|
194
205
|
# @!endgroup
|
@@ -286,16 +297,6 @@ module Eco
|
|
286
297
|
people.default_schema = name
|
287
298
|
end
|
288
299
|
|
289
|
-
# Specify the file with the account custom abilities presets
|
290
|
-
def presets_custom=(file)
|
291
|
-
people.presets_custom = file
|
292
|
-
end
|
293
|
-
|
294
|
-
# Specify the file with the usergroup to custom presets mapping
|
295
|
-
def presets_map=(file)
|
296
|
-
people.presets_map = file
|
297
|
-
end
|
298
|
-
|
299
300
|
# @see Eco::API::Session::Config::People
|
300
301
|
# @param (see Eco::API::Session::Config::People)
|
301
302
|
# @return [Eco::API::Common::People::PersonParser] parser/serializer for the defined `format`.
|
@@ -40,6 +40,20 @@ module Eco
|
|
40
40
|
self
|
41
41
|
end
|
42
42
|
|
43
|
+
# Method to support CLI one-off API requests
|
44
|
+
def one_off
|
45
|
+
if SCR.get_arg("-api-key")
|
46
|
+
key = SCR.get_arg("-api-key", with_param: true)
|
47
|
+
enviro = SCR.get_arg("-enviro") ? SCR.get_arg("-enviro", with_param: true) : "live"
|
48
|
+
host = "#{enviro}.ecoportal.com"
|
49
|
+
org = SCR.get_arg("-org") ? SCR.get_arg("-org", with_param: true) : raise("You should specify -org NAME when using -api-key")
|
50
|
+
org = org.downcase.split(/[^a-z]+/).join("_")
|
51
|
+
org = org.to_sym
|
52
|
+
add(org, key: key, host: host)
|
53
|
+
return org
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
43
57
|
def active_api
|
44
58
|
self["active-api"]
|
45
59
|
end
|
@@ -14,6 +14,13 @@ module Eco
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def working_directory
|
17
|
+
if config.apis.active_api&.one_off?
|
18
|
+
one_off_dir = File.join("one_off", config.apis.active_name.to_s)
|
19
|
+
unless full_path = Eco::Data::Files::Directory.new(one_off_dir).create
|
20
|
+
raise "Could not create the folder '#{full_path}'"
|
21
|
+
end
|
22
|
+
self["dir"] = one_off_dir
|
23
|
+
end
|
17
24
|
self["dir"]
|
18
25
|
end
|
19
26
|
|
@@ -9,7 +9,7 @@ module Eco
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def cache
|
12
|
-
self["cache"]
|
12
|
+
self["cache"] ||= "cache/people.json"
|
13
13
|
end
|
14
14
|
|
15
15
|
def partial_cache
|
@@ -35,7 +35,7 @@ module Eco
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def requests_folder
|
38
|
-
self["requests_folder"]
|
38
|
+
self["requests_folder"] ||= "requests"
|
39
39
|
end
|
40
40
|
|
41
41
|
# people to exclude from update feeds
|
@@ -86,23 +86,7 @@ module Eco
|
|
86
86
|
def default_schema?
|
87
87
|
!!self["default_schema"]
|
88
88
|
end
|
89
|
-
|
90
|
-
def presets_custom=(file)
|
91
|
-
self["presets_custom"] = file
|
92
|
-
end
|
93
|
-
|
94
|
-
def presets_custom
|
95
|
-
self["presets_custom"]
|
96
|
-
end
|
97
|
-
|
98
|
-
def presets_map=(file)
|
99
|
-
self["presets_map"] = file
|
100
|
-
end
|
101
|
-
|
102
|
-
def presets_map
|
103
|
-
self["presets_map"]
|
104
|
-
end
|
105
|
-
|
89
|
+
|
106
90
|
# @return [Hash] with defined pairs format `key` and Person parsers.
|
107
91
|
def parsers
|
108
92
|
self["parsers"] ||= {}
|
data/lib/eco/api/usecases.rb
CHANGED
@@ -30,6 +30,7 @@ module Eco
|
|
30
30
|
@usecases = {}
|
31
31
|
@cache_init = false
|
32
32
|
@cases_by_name = {}
|
33
|
+
init_caches
|
33
34
|
end
|
34
35
|
|
35
36
|
def length
|
@@ -79,6 +80,7 @@ module Eco
|
|
79
80
|
|
80
81
|
# @return [Eco::API::UseCases] a copy of instance object of `self`.
|
81
82
|
def dup
|
83
|
+
init_caches
|
82
84
|
self.class.new.merge(self)
|
83
85
|
end
|
84
86
|
|
@@ -9,6 +9,8 @@ module Eco
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
+
require_relative 'default_cases/abstract_policygroup_abilities_case.rb'
|
13
|
+
require_relative 'default_cases/analyse_people_case'
|
12
14
|
require_relative 'default_cases/append_usergroups_case'
|
13
15
|
require_relative 'default_cases/change_email_case'
|
14
16
|
require_relative 'default_cases/codes_to_tags_case'
|
@@ -22,7 +24,6 @@ require_relative 'default_cases/hris_case'
|
|
22
24
|
require_relative 'default_cases/new_id_case'
|
23
25
|
require_relative 'default_cases/new_email_case'
|
24
26
|
require_relative 'default_cases/org_data_convert_case'
|
25
|
-
require_relative 'default_cases/refresh_abilities_case'
|
26
27
|
require_relative 'default_cases/refresh_case'
|
27
28
|
require_relative 'default_cases/reinvite_trans_case'
|
28
29
|
require_relative 'default_cases/reinvite_sync_case'
|
@@ -32,6 +33,8 @@ require_relative 'default_cases/reset_landing_page_case'
|
|
32
33
|
require_relative 'default_cases/restore_db_case'
|
33
34
|
require_relative 'default_cases/set_default_tag_case'
|
34
35
|
require_relative 'default_cases/set_supervisor_case'
|
36
|
+
require_relative 'default_cases/supers_hierarchy_case'
|
37
|
+
require_relative 'default_cases/supers_cyclic_identify_case'
|
35
38
|
require_relative 'default_cases/switch_supervisor_case'
|
36
39
|
require_relative 'default_cases/to_csv_case'
|
37
40
|
require_relative 'default_cases/to_csv_detailed_case'
|
@@ -0,0 +1,161 @@
|
|
1
|
+
class Eco::API::UseCases::DefaultCases::AbstractPolicyGroupAbilities < Eco::API::Common::Loaders::UseCase
|
2
|
+
name "abstract-policygroup-abilities"
|
3
|
+
type :export
|
4
|
+
|
5
|
+
attr_reader :session, :people, :options
|
6
|
+
|
7
|
+
def main(people, session, options, usecase)
|
8
|
+
options[:end_get] = false
|
9
|
+
@session = session; @options = options; @people = people
|
10
|
+
|
11
|
+
generate_csv!
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def file
|
17
|
+
@file ||= options.dig(:output, :file) || "suggested_abilities.csv"
|
18
|
+
end
|
19
|
+
|
20
|
+
def generate_csv!
|
21
|
+
policy_groups.each_with_object({}) do |group, data|
|
22
|
+
data[group.id] ||= {}
|
23
|
+
data[group.id][:name] = group.name
|
24
|
+
data[group.id][:suggested] = group_suggestions(group.id)
|
25
|
+
data[group.id][:percents] = group_abilities(group.id)
|
26
|
+
end.yield_self do |data|
|
27
|
+
abilities_list = Eco::API::Organization::PresetsFactory.abilities
|
28
|
+
CSV.open(file, "w") do |csv|
|
29
|
+
csv << ["Type", "UserGroup", "ID", *abilities_list]
|
30
|
+
# Dump the final suggestions
|
31
|
+
data.each do |id, meta|
|
32
|
+
csv << ["Suggested", meta[:name], id, *meta[:suggested].values_at(*abilities_list)]
|
33
|
+
end
|
34
|
+
# Dump the percentaged levels of each ability
|
35
|
+
data.each do |id, meta|
|
36
|
+
analysis = meta[:percents].values_at(*abilities_list).each_with_object([]) do |levels, values|
|
37
|
+
values << levels.map do |level, percentil|
|
38
|
+
"#{level ? level : "null"} => #{percentil}"
|
39
|
+
end.join("\n")
|
40
|
+
end
|
41
|
+
csv << ["Analysis", meta[:name], id, *analysis]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
puts "Generated file #{file}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def policy_groups
|
49
|
+
@policy_groups ||= session.policy_groups
|
50
|
+
end
|
51
|
+
|
52
|
+
# Suggests 1 final set of abilities for a usergroup
|
53
|
+
def group_suggestions(id)
|
54
|
+
group_abilities(id).each_with_object({}) do |(key, levels), set|
|
55
|
+
data = levels.to_a.sort_by(&:last).reverse.first
|
56
|
+
set[key] = data ? data.shift : nil
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Cleans up each ability's levels by:
|
61
|
+
# 1. cutting at some minimum threshold percentage
|
62
|
+
# 2. directly selecting those greater than 70%
|
63
|
+
def group_abilities(id)
|
64
|
+
@group_abilities ||= {}
|
65
|
+
@group_abilities[id] ||= ability_levels_percent(id).each_with_object({}) do |(ability, levels), out|
|
66
|
+
outstanding = nil
|
67
|
+
levels.select do |level, percentil|
|
68
|
+
outstanding ||= level if percentil >= 75
|
69
|
+
percentil > 15
|
70
|
+
end.yield_self do |filtered|
|
71
|
+
out[ability] = outstanding ? filtered.slice(outstanding) : filtered
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# With given the percentages of sets of abilities
|
77
|
+
# it abstracts the percentage of each level of each ability
|
78
|
+
def ability_levels_percent(id)
|
79
|
+
@ability_levels_percent ||= {}
|
80
|
+
@ability_levels_percent[id] ||= Eco::API::Organization::PresetsFactory.abilities.each_with_object({}) do |key, out|
|
81
|
+
out[key] ||= {}
|
82
|
+
ability_sets_percent(id).each_with_object(out[key]) do |(set, percentil), levels|
|
83
|
+
levels[set[key]] ||= 0
|
84
|
+
levels[set[key]] = (levels[set[key]] + percentil).round(2)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# Give a percentage to each set of abilities
|
90
|
+
def ability_sets_percent(id)
|
91
|
+
@ability_sets_percent ||= {}
|
92
|
+
@ability_sets_percent[id] ||= scoped_relevant_raw_data(id).yield_self do |data|
|
93
|
+
# Transform ability sets counter to percentage
|
94
|
+
total = data[:count]
|
95
|
+
abilities = data[:abilities]
|
96
|
+
data[:abilities].transform_values do |val|
|
97
|
+
percent(val, total)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# Get rid of data simingly irrelevant
|
103
|
+
def scoped_relevant_raw_data(id)
|
104
|
+
sp = single_percent(id)
|
105
|
+
sing = single(id); mult = multiple(id)
|
106
|
+
|
107
|
+
# Scope Relevant Raw Data
|
108
|
+
case
|
109
|
+
when sp >= 80
|
110
|
+
sing
|
111
|
+
when sp < 15
|
112
|
+
mult
|
113
|
+
else # combine
|
114
|
+
all_abilities = sing[:abilities].keys | mult[:abilities].keys
|
115
|
+
data = {count: sing[:count] + mult[:count], abilities: {}}
|
116
|
+
all_abilities.each_with_object(data) do |abilities, merged|
|
117
|
+
scount = sing[:abilities][abilities] || 0
|
118
|
+
mcount = mult[:abilities][abilities] || 0
|
119
|
+
merged[:abilities][abilities] = scount + mcount
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def single_percent(id)
|
125
|
+
percent(single(id)[:count], count(id))
|
126
|
+
end
|
127
|
+
|
128
|
+
def single(id)
|
129
|
+
groups_abilities.dig(id, :single) || {count: 0, abilities: {}}
|
130
|
+
end
|
131
|
+
|
132
|
+
def multiple(id)
|
133
|
+
groups_abilities.dig(id, :multiple) || {count: 0, abilities: {}}
|
134
|
+
end
|
135
|
+
|
136
|
+
def count(id)
|
137
|
+
groups_abilities.dig(id, :count) || 0
|
138
|
+
end
|
139
|
+
|
140
|
+
def groups_abilities
|
141
|
+
@groups_abilities ||= people.users.each_with_object({}) do |user, groups|
|
142
|
+
abilities = Eco::API::Organization::PresetsFactory.all_abilities(user.account.permissions_custom)
|
143
|
+
ids = user.account.policy_group_ids
|
144
|
+
category = ids.count > 1 ? :multiple : :single
|
145
|
+
|
146
|
+
ids.each do |id|
|
147
|
+
groups[id] ||= {count: 0}
|
148
|
+
groups[id][:count] += 1
|
149
|
+
groups[id][category] ||= {count: 0, abilities: {}}
|
150
|
+
groups[id][category][:count] += 1
|
151
|
+
groups[id][category][:abilities][abilities] ||= 0
|
152
|
+
groups[id][category][:abilities][abilities] += 1
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def percent(num, total)
|
158
|
+
(100 * num.to_f / total).round(2)
|
159
|
+
end
|
160
|
+
|
161
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
class Eco::API::UseCases::DefaultCases::AnalysePeople < Eco::API::Common::Loaders::UseCase
|
2
|
+
name "analyse-people"
|
3
|
+
type :export
|
4
|
+
|
5
|
+
attr_reader :session, :people, :options
|
6
|
+
|
7
|
+
def main(people, session, options, usecase)
|
8
|
+
@session = session; @options = options; @people = people
|
9
|
+
|
10
|
+
save!(cyclic_sets)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def identify_double_ups
|
16
|
+
analytics.similarity
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
def analytics
|
21
|
+
@analytics ||= people.analytics
|
22
|
+
end
|
23
|
+
|
24
|
+
def file
|
25
|
+
@file ||= options.dig(:output, :file) || "analytics.txt"
|
26
|
+
end
|
27
|
+
|
28
|
+
def save!(data)
|
29
|
+
if data.empty?
|
30
|
+
session.logger.info("There were no cyclic supervisors identified!!")
|
31
|
+
return
|
32
|
+
end
|
33
|
+
|
34
|
+
ext = File.extname(file).downcase.delete(".")
|
35
|
+
|
36
|
+
File.open(file, "w") do |fd|
|
37
|
+
if ext == "txt"
|
38
|
+
create_file(data, file: file, format: :txt)
|
39
|
+
elsif ext == "html"
|
40
|
+
puts "html is still not supported"
|
41
|
+
exit(1)
|
42
|
+
create_file(data, file: file, format: :html)
|
43
|
+
elsif ext == "json"
|
44
|
+
puts "json is still not supported"
|
45
|
+
exit(1)
|
46
|
+
create_file(data, file: file, format: :json)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def create_file(sets, file:, format: :txt)
|
52
|
+
File.open(file, "w") do |fd|
|
53
|
+
fd << sets_to_str(sets, format: format)
|
54
|
+
end
|
55
|
+
puts "Generated file #{file}"
|
56
|
+
end
|
57
|
+
|
58
|
+
def sets_to_str(sets, format: :txt)
|
59
|
+
raise "Required Array. Given: #{sets.class}" unless sets.is_a?(Array)
|
60
|
+
"".tap do |str|
|
61
|
+
sets.each do |set|
|
62
|
+
str << set_to_str(set, format: format)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def set_to_str(set, lev: 0, format: :txt)
|
68
|
+
raise "Required Array. Given: #{set.class}" unless set.is_a?(Array)
|
69
|
+
"".tap do |str|
|
70
|
+
entry = set.shift
|
71
|
+
str << "#{" " * lev}#{(lev > 0)? "+-#{lev}- " : ""}#{entry.name} (#{entry.external_id}|#{entry.email}|#{entry.id})\n"
|
72
|
+
str << set_to_str(set, lev: lev + 1, format: format) unless !set || set.empty?
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
@@ -16,10 +16,9 @@ class Eco::API::UseCases::DefaultCases::CodesToTagsCase < Eco::API::Common::Load
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def main(session, options, usecase)
|
19
|
-
|
20
|
-
@options = options
|
19
|
+
options[:end_get] = false
|
20
|
+
@session = session; @options = options
|
21
21
|
codes_to_tags
|
22
|
-
exit
|
23
22
|
end
|
24
23
|
|
25
24
|
private
|