eco-helpers 2.6.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +72 -4
- data/README.md +5 -0
- data/eco-helpers.gemspec +1 -1
- data/lib/eco/api/common/class_helpers.rb +1 -1
- data/lib/eco/api/common/loaders/case_base.rb +0 -2
- data/lib/eco/api/common/loaders/config/workflow/mailer.rb +78 -0
- data/lib/eco/api/common/loaders/config/workflow.rb +11 -0
- data/lib/eco/api/common/loaders/config.rb +29 -0
- data/lib/eco/api/common/loaders/error_handler.rb +0 -2
- data/lib/eco/api/common/loaders/parser.rb +0 -1
- data/lib/eco/api/common/loaders/policy.rb +0 -2
- data/lib/eco/api/common/loaders.rb +1 -0
- data/lib/eco/api/common/session/mailer.rb +3 -1
- data/lib/eco/api/common/version_patches/exception.rb +2 -2
- data/lib/eco/api/common/version_patches/ruby3/object.rb +18 -0
- data/lib/eco/api/common/version_patches/ruby3.rb +1 -0
- data/lib/eco/api/common/version_patches.rb +3 -0
- data/lib/eco/api/custom/config.rb +10 -0
- data/lib/eco/api/custom/mailer.rb +9 -0
- data/lib/eco/api/custom/namespace.rb +2 -0
- data/lib/eco/api/custom/workflow.rb +9 -0
- data/lib/eco/api/custom.rb +3 -0
- data/lib/eco/api/session/batch/base_policy.rb +13 -5
- data/lib/eco/api/session/batch/job.rb +10 -7
- data/lib/eco/api/session/config/workflow.rb +94 -58
- data/lib/eco/api/session/config.rb +2 -2
- data/lib/eco/api/usecases/base_io.rb +50 -4
- data/lib/eco/api/usecases/cli/dsl.rb +23 -13
- data/lib/eco/api/usecases/default/locations/cli/tagtree_extract_cli.rb +5 -0
- data/lib/eco/api/usecases/default/locations/tagtree_extract_case.rb +12 -4
- data/lib/eco/api/usecases/graphql/helpers/location/base.rb +1 -2
- data/lib/eco/api/usecases/ooze_samples/register_update_case.rb +3 -3
- data/lib/eco/api/usecases/use_case.rb +12 -2
- data/lib/eco/assets.rb +2 -2
- data/lib/eco/cli_default/workflow.rb +102 -120
- data/lib/eco/data/locations/node_base/tag_validations.rb +19 -9
- data/lib/eco/data/locations/node_base/treeify.rb +193 -18
- data/lib/eco/data/locations/node_level.rb +1 -1
- data/lib/eco/data/locations/node_plain/parsing.rb +1 -1
- data/lib/eco/data/locations/node_plain/serial.rb +1 -1
- data/lib/eco/data/locations/node_plain.rb +4 -3
- data/lib/eco/language/klass/when_inherited.rb +17 -0
- data/lib/eco/language/klass.rb +8 -0
- data/lib/eco/language/methods/delegate_missing.rb +28 -0
- data/lib/eco/language/methods/dsl_able.rb +25 -0
- data/lib/eco/language/methods.rb +9 -0
- data/lib/eco/language.rb +2 -0
- data/lib/eco/version.rb +1 -1
- metadata +16 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5b781e23d7538417c84762d636b8e10281adce9e5228cef561edf199aba5334
|
4
|
+
data.tar.gz: ab7284a1124a8bece11d8d72e8bdc2f532d746e1da3cfdc264270885d6f867d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb069c529b1f318f700672676178c52921b06dcaf2600c1b0f6c3ab5b388f781c17630a0ae4d0b815f206bc74cff8a528ab3f6df53ce5ea9068416b40174b3f2
|
7
|
+
data.tar.gz: 0fe617fa64e3bf666438ac6a8b6bf35eac83c9552280d16f9070443fe7e7b5e7e4c0e28185b5bcf853e6eac40fc465bb29d55c3112621b9d3d979dcac81436bc
|
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,84 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [2.6.1] - 2024-02-
|
4
|
+
## [2.6.1] - 2024-02-11
|
5
5
|
|
6
6
|
### Added
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
- For use case `Eco::API::UseCases::Default::Locations::TagtreeExtract`
|
8
|
+
- New `-indent` option
|
9
|
+
- `Eco::API::UseCases::UseCase`
|
10
|
+
- Defines on loader object attr reader methods `people`, `input` and `usecase` unless they already exist.
|
11
|
+
- Some class / method helpers
|
12
|
+
- `Eco::Language::Methods::DelegateMissing` to redirect missing methods to one object
|
13
|
+
- `Eco::Language::Methods::DslAble` to allow direct method calls on blocks
|
14
|
+
- `Eco::Language::Klass:WhenInherited` to allow to defined a block that gets called when the class is inherited
|
15
|
+
- **DSL** capabilities (for block calls) for
|
16
|
+
- `Eco::API::Session::Batch::BasePolicy`
|
17
|
+
- `Eco::API::Session::Batch::Job`
|
18
|
+
- `api_excluded` block to be called in the Job's context
|
19
|
+
- `Eco::API::UseCases::BaseIO`
|
20
|
+
- This shortens code lines in workflow blocks
|
21
|
+
- `Eco::API::Session::Config::Workflow#run` has been adapted to boost the evalution of the workflow blocks within the context of the `BaseIO` that is carried throughout all the run process.
|
22
|
+
- **NEW** Loaders
|
23
|
+
- `Eco::API::Custom::Config` (**DSL** alike) allows to open up configuration via class
|
24
|
+
- Redirects to `Eco::API::Common::Loaders::Config`
|
25
|
+
- Re-usable sample child classes can created with the use of `config_block`, which in combination with `when_inherited` will load the basic config to custom config classes.
|
26
|
+
- `Eco::API::Custom::Workflow` (**DSL** alike) allows to open up workflow configurations via class
|
27
|
+
- Redirects to `Eco::API::Common::Loaders::Config::Workflow`
|
28
|
+
- `Eco::API::Custom::Mailer` (first **sample**) allows to just define some constants to modify the generic behaviour of this sample class you will want to inherit to enable mailing workflow.
|
29
|
+
- Redirects to `Eco::API::Common::Loaders::Config::Workflow::Mailer`
|
30
|
+
- `Eco::Assets#cli` able to yield the `cli` to a block
|
31
|
+
- `Eco::API::UseCases::BaseIO#process_case`
|
32
|
+
- **added method** `process_case`, which allows to pass the `io` itself as a paramter.
|
33
|
+
- When this is used, the `output` swap as `input` / `people` is performed (before and after).
|
34
|
+
|
35
|
+
### Changed
|
36
|
+
- **IMPORTANT** overriden `Object#inspect` to `to_s` to prevent recursive deep introspection of object internals on `MethodError`
|
37
|
+
- `Eco::API::Common::Loaders::CaseBase`
|
38
|
+
- **removed** attr `usecase`
|
39
|
+
- `Eco::API::UseCases::BaseIO`
|
40
|
+
- `output` can be set on initialization
|
41
|
+
- `#new` carries the `output` as well.
|
42
|
+
- `Eco::API::Session::Config::Workflow`
|
43
|
+
- `#run`
|
44
|
+
- workflow blocks don't require to explicitly return the `BaseIO` when there isn't any to return. It will just keep the `io` as it was before the call.
|
45
|
+
- also made it so the returned io is **always** an **instance of** `Eco::API::UseCases::BaseIO` (so it won't return an instance of a child class). This change can be considered a fix. **Aside note:** only possible now that `output` is carried on through objects of type (so there's there's no data loss in the calls chain) `Eco::API::UseCases::BaseIO` (i.e. `io.new`)
|
46
|
+
- `#for`
|
47
|
+
- **now** it only requires a `block` if no `key` is provided
|
48
|
+
- `Eco::Data::Locations::NodeBase::TagValidations`
|
49
|
+
- made module re-usable, by removing dependency on `clean_id` method.
|
50
|
+
- Improved the **patch** on exception that adds method `#patch_full_message`
|
51
|
+
- Parameter `trace_count` added (`default: -1` for full trace)
|
52
|
+
|
53
|
+
### Fixed
|
54
|
+
- `Eco::Data::Locations::NodeBase::Treeify`
|
55
|
+
- **bug** on strings and interpolation when building the warning/error messages
|
56
|
+
- **added** detection and _warnings_ for **unlinked parents**: as `get_children` is called from the top via `nil` (those that are top level nodes), and all the call chain to collect children goes through their `parent_id` relationship.
|
57
|
+
- If the input nodes had some where there's no direct link between `nil` and a node `id` that is a `parent_id`, `parents[node.id]` would never be called. Meaning that in an input with a list of nodes, there could be clusters of subtrees that do not add/link to the top level (`nil`).
|
58
|
+
- It now gathers those separated subtrees in an `Array` parameter called `unlinked_trees`
|
59
|
+
- `Eco::API::Session::Config::Workflow`
|
60
|
+
- Returning an `Eco::API::UseCases::BaseIO` from callbacks `before`, `after` and `run` would raise an `ArgumentError`.
|
61
|
+
- **Now** the original `io` is returned otherwise the returned value is a `BaseIO`
|
62
|
+
- `Eco::API::Session::Config::Workflow`
|
63
|
+
- **changed** `open` to alias method for `with` (open was clashing)
|
64
|
+
- `Eco::API::UseCases::GraphQL::Helpers::Location::Base`
|
65
|
+
- **removed** `enviro` param for org tagtree built
|
66
|
+
- `Eco::API::UseCases::Cli::DSL`
|
67
|
+
- `::callback` was not acting like a DSL method, which would just return `nil` always (lost `block`)
|
68
|
+
- CLI arguments are unique. If a Cli class has already been run, no need to re-run it. Cli class re-usability is still not in the pipeline, and therefore, it must be run only once.
|
69
|
+
- `Eco::Data::Locations::NodePlain`
|
70
|
+
- `serializer` referred to an non existing constant.
|
71
|
+
- **IMPORTANT** `parent_id` should be `cleaned` as well. Otherwise parents with an id cleanage don't match their children's `parent_id`
|
72
|
+
- `Eco::API::Common::ClassHelpers`
|
73
|
+
- `::inerited` method must call `super` to be able to chain other calls
|
74
|
+
- `Eco::API::Common::Session::Mailer`
|
75
|
+
- The logging message was not printing who the email was sent to.
|
10
76
|
|
11
77
|
## [2.6.0] - 2024-02-03
|
12
78
|
|
13
79
|
### Added
|
80
|
+
- New use case to `-export-tree` (**tagtree extract**)
|
81
|
+
- `Eco::API::UseCases::Default::Locations::TagtreeExtract`
|
14
82
|
- `Eco::API::UseCases::UseCase`
|
15
83
|
- added `#classed_definition` to expose the original class definition
|
16
84
|
- injected further parameter as instance variables to the original class definition on run-time.
|
data/README.md
CHANGED
data/eco-helpers.gemspec
CHANGED
@@ -42,7 +42,7 @@ Gem::Specification.new do |spec|
|
|
42
42
|
spec.add_dependency 'fuzzy_match', '>= 2.1.0', '< 2.2'
|
43
43
|
spec.add_dependency 'amatch', '>= 0.4.1', '< 0.5'
|
44
44
|
spec.add_dependency 'jaro_winkler', '>= 1.5.6', '< 1.6'
|
45
|
-
spec.add_dependency 'nokogiri', '>= 1.13', '< 1.
|
45
|
+
spec.add_dependency 'nokogiri', '>= 1.13', '< 1.17'
|
46
46
|
spec.add_dependency 'roo', '>= 2.10.1', '< 2.11'
|
47
47
|
spec.add_dependency 'roo-xls', '>= 1.2.0', '< 1.3'
|
48
48
|
spec.add_dependency 'fast_excel', '>= 0.5.0', '< 0.6'
|
@@ -129,13 +129,13 @@ module Eco
|
|
129
129
|
# - mutating methods would reflect the changes on other classes as well
|
130
130
|
# - therefore, `freeze` will be called on the values that are inherited.
|
131
131
|
def inherited(subclass)
|
132
|
+
super
|
132
133
|
inheritable_class_vars.each do |var|
|
133
134
|
instance_var = instance_variable_name(var)
|
134
135
|
value = instance_variable_get(instance_var)
|
135
136
|
subclass.instance_variable_set(instance_var, value.freeze)
|
136
137
|
end
|
137
138
|
end
|
138
|
-
|
139
139
|
end
|
140
140
|
end
|
141
141
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
class Eco::API::Common::Loaders::Workflow::Mailer < Eco::API::Common::Loaders::Workflow
|
2
|
+
ORG = 'your organization'.freeze
|
3
|
+
TRACE_COUNT = 3
|
4
|
+
|
5
|
+
inheritable_class_vars :config_block
|
6
|
+
|
7
|
+
config_block do
|
8
|
+
puts "running from class #{self}"
|
9
|
+
exception do |err, io|
|
10
|
+
self.error = err
|
11
|
+
log(:debug) { err.patch_full_message }
|
12
|
+
workflow.run(:close, io: io)
|
13
|
+
end
|
14
|
+
|
15
|
+
after(:close) do |_wf, io|
|
16
|
+
next if options.dig(:workflow, :no_email)
|
17
|
+
next unless session.mailer?
|
18
|
+
next if session.config.dry_run?
|
19
|
+
next unless session.config.run_mode_remote?
|
20
|
+
next unless some_update?(io) || error?
|
21
|
+
|
22
|
+
subject = base_subject
|
23
|
+
|
24
|
+
if session.job_groups.empty? && error?
|
25
|
+
subject = "#{subject} - Exception!"
|
26
|
+
session.mail(subject: subject, body: errors_n_warnings(io))
|
27
|
+
else
|
28
|
+
subject = "#{subject} & Errors" if session.job_groups.errors?
|
29
|
+
subject = "#{subject} - Exception!" if error?
|
30
|
+
|
31
|
+
msg = "#{session.summary}\n"
|
32
|
+
msg += errors_n_warnings(io)
|
33
|
+
|
34
|
+
session.mail(subject: subject, body: msg) unless msg.strip.empty?
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class << self
|
40
|
+
attr_accessor :error
|
41
|
+
|
42
|
+
def org_name
|
43
|
+
self::ORG
|
44
|
+
end
|
45
|
+
|
46
|
+
def base_subject
|
47
|
+
"#{org_name} (#{active_enviro}) at #{Time.now.iso8601}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def some_update?(io)
|
51
|
+
cli.config.usecases.active(io: io).any? do |usecase, data|
|
52
|
+
[:transform, :sync].any? { |type| usecase.type == type }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def error?
|
57
|
+
!!error
|
58
|
+
end
|
59
|
+
|
60
|
+
def errors_n_warnings(io)
|
61
|
+
[error_message, log_err_n_warn(io)].join("\n")
|
62
|
+
end
|
63
|
+
|
64
|
+
def log_err_n_warn(io)
|
65
|
+
warn_errors = io.logger.cache.logs(level: [:error, :warn])
|
66
|
+
return if warn_errors.empty?
|
67
|
+
"WARNINGS & ERRORS:\n#{warn_errors.join('')}\n"
|
68
|
+
end
|
69
|
+
|
70
|
+
def error_message
|
71
|
+
error&.patch_full_message(trace_count: 3)
|
72
|
+
end
|
73
|
+
|
74
|
+
def trace_count
|
75
|
+
self::TRACE_COUNT
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Eco::API::Common::Loaders::Config
|
2
|
+
extend Eco::API::Common::ClassHelpers
|
3
|
+
extend Eco::Language::Methods::DelegateMissing
|
4
|
+
inheritable_class_vars :delegate_missing_to
|
5
|
+
|
6
|
+
class << self
|
7
|
+
# To create samples of configurations
|
8
|
+
def config_block(&block)
|
9
|
+
return @config_block unless block_given?
|
10
|
+
@config_block = block
|
11
|
+
end
|
12
|
+
|
13
|
+
def config
|
14
|
+
ASSETS.config
|
15
|
+
end
|
16
|
+
|
17
|
+
def cli
|
18
|
+
ASSETS.cli
|
19
|
+
end
|
20
|
+
|
21
|
+
def active_enviro
|
22
|
+
config.active_enviro
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
delegate_missing_to :config
|
27
|
+
end
|
28
|
+
|
29
|
+
require_relative 'config/workflow'
|
@@ -3,7 +3,6 @@ module Eco
|
|
3
3
|
module Common
|
4
4
|
module Loaders
|
5
5
|
class Policy < Eco::API::Common::Loaders::CaseBase
|
6
|
-
|
7
6
|
def initialize(policies)
|
8
7
|
raise "Expected Eco::API::Policies. Given #{policies.class}" unless policies.is_a?(Eco::API::Policies)
|
9
8
|
policies.define(self.name, &self.method(:main))
|
@@ -17,7 +16,6 @@ module Eco
|
|
17
16
|
def main(people, session, options, policy, job)
|
18
17
|
raise "You should implement this method"
|
19
18
|
end
|
20
|
-
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
@@ -33,7 +33,9 @@ module Eco
|
|
33
33
|
}
|
34
34
|
}
|
35
35
|
).tap do |response|
|
36
|
-
|
36
|
+
msg = "Sent email (MessageId: #{response.message_id}) to #{fetch_destination(to: to, cc: cc, bcc: bcc)}"
|
37
|
+
puts msg
|
38
|
+
logger.debug(msg)
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
class ::Exception
|
2
|
-
def patch_full_message
|
2
|
+
def patch_full_message(trace_count: -1)
|
3
3
|
begin
|
4
4
|
msg = []
|
5
5
|
tracing = backtrace ? backtrace : []
|
6
|
-
tracing = (self.class == SystemStackError) ? tracing[1..30] : tracing[1
|
6
|
+
tracing = (self.class == SystemStackError) ? tracing[1..30] : tracing[1..trace_count]
|
7
7
|
tracing ||= []
|
8
8
|
msg << "\n#{tracing.first} \n#{message} (#{self.class.to_s})"
|
9
9
|
tracing.each_with_index {|bt, i| msg << "#{" "*8}#{i+1}: from #{bt}"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Object
|
2
|
+
# From ruby3
|
3
|
+
# `NameError` prints the internals of the object as well as subobjects
|
4
|
+
# which is really unnecessary
|
5
|
+
# @example
|
6
|
+
# class Foo; attr_writer :bar; end
|
7
|
+
# foo = Foo.new
|
8
|
+
# foo2 = Foo.new
|
9
|
+
# foo.bar = foo2
|
10
|
+
# h = {a: 1, b: 2, c: foo}
|
11
|
+
# foo2.bar = h
|
12
|
+
# h.foo
|
13
|
+
# #=> undefined method `foo' for {:a=>1, :b=>2, :c=>#<Foo:0x000002343276b520 @bar=#<Foo:0x0000023437e91ca0 @bar={...}>>}:Hash (NoMethodError)
|
14
|
+
# What's the use of such a detail when it's just a missing method at the top of it?
|
15
|
+
def inspect
|
16
|
+
to_s
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'ruby3/object'
|
@@ -7,6 +7,9 @@ module Eco
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
+
if Gem::Version.create('3.0.0') <= Gem::Version.create(RUBY_VERSION)
|
11
|
+
require_relative 'version_patches/ruby3'
|
12
|
+
end
|
10
13
|
require_relative 'version_patches/object'
|
11
14
|
require_relative 'version_patches/exception'
|
12
15
|
require_relative 'version_patches/hash'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Helper class to create a custom `Config`
|
2
|
+
# @example Example of usage:
|
3
|
+
# class Custom::Config::BatchPolicies < Eco::API::Custom::Config
|
4
|
+
# batch_policies do
|
5
|
+
# create.max = 5
|
6
|
+
# update.max = 20
|
7
|
+
# end
|
8
|
+
# end
|
9
|
+
class Eco::API::Custom::Config < Eco::API::Common::Loaders::Config
|
10
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Helper class to create a custom `Config`
|
2
|
+
# @example Example of usage:
|
3
|
+
# class Custom::Workflow::Mailer < Eco::API::Custom::Mailer
|
4
|
+
# ORG = "Org Name"
|
5
|
+
# end
|
6
|
+
class Eco::API::Custom::Mailer < Eco::API::Common::Loaders::Workflow::Mailer
|
7
|
+
extend Eco::Language::Klass::WhenInherited
|
8
|
+
when_inherited(&config_block)
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Helper class to create a custom `Config`
|
2
|
+
# @example Example of usage:
|
3
|
+
# class Custom::Config::DefaultOptions < Eco::API::Custom::Workflow
|
4
|
+
# after(:options) do
|
5
|
+
# options.deep_merge!(send_invites: false) unless options.dig(:send_invites)
|
6
|
+
# end
|
7
|
+
# end
|
8
|
+
class Eco::API::Custom::Workflow < Eco::API::Common::Loaders::Workflow
|
9
|
+
end
|
data/lib/eco/api/custom.rb
CHANGED
@@ -7,6 +7,9 @@ module Eco
|
|
7
7
|
end
|
8
8
|
|
9
9
|
require_relative 'custom/namespace'
|
10
|
+
require_relative 'custom/config'
|
11
|
+
require_relative 'custom/workflow'
|
12
|
+
require_relative 'custom/mailer'
|
10
13
|
require_relative 'custom/use_case'
|
11
14
|
require_relative 'custom/policy'
|
12
15
|
require_relative 'custom/error_handler'
|
@@ -20,9 +20,10 @@ module Eco
|
|
20
20
|
# @attr_reader min [Integer] `min` **required** number of occurrences of the property
|
21
21
|
class BasePolicy
|
22
22
|
extend Eco::API::Common::ClassHierarchy
|
23
|
+
# adds evaluate method to enable block calls as DSL
|
24
|
+
include Eco::Language::Methods::DslAble
|
23
25
|
|
24
26
|
class << self
|
25
|
-
|
26
27
|
# If the class for `key` exists, it returns it. Otherwise it generates it.
|
27
28
|
# @note for this to work, `key` should be one of the submodels of the current class' `model`
|
28
29
|
# @return [Eco::API::Session::Batch::BasePolicy] or subclass thereof
|
@@ -52,16 +53,14 @@ module Eco
|
|
52
53
|
end
|
53
54
|
|
54
55
|
if block
|
55
|
-
|
56
|
+
policy.evaluate(policy, &block)
|
56
57
|
self
|
57
58
|
else
|
58
59
|
policy
|
59
60
|
end
|
60
61
|
end
|
61
|
-
|
62
62
|
end
|
63
63
|
end
|
64
|
-
|
65
64
|
end
|
66
65
|
|
67
66
|
include Enumerable
|
@@ -75,6 +74,16 @@ module Eco
|
|
75
74
|
@policies = {}
|
76
75
|
end
|
77
76
|
|
77
|
+
def max(value = :unused)
|
78
|
+
return @max if value == :unused
|
79
|
+
self.max = value
|
80
|
+
end
|
81
|
+
|
82
|
+
def min(value = :unused)
|
83
|
+
return @min if value == :unused
|
84
|
+
self.min = value
|
85
|
+
end
|
86
|
+
|
78
87
|
def attr(as_namespace: false)
|
79
88
|
return @attr if !as_namespace || root?
|
80
89
|
"#{@_parent.attr(as_namespace: true)}:#{@attr}"
|
@@ -222,7 +231,6 @@ module Eco
|
|
222
231
|
return model if model.is_a?(Hash)
|
223
232
|
model.to_h if model.respond_to?(:to_h)
|
224
233
|
end
|
225
|
-
|
226
234
|
end
|
227
235
|
end
|
228
236
|
end
|
@@ -9,6 +9,8 @@ module Eco
|
|
9
9
|
# @attr_reader status [Eco::API::Session::Batch::Status] if launched: the `status` of the `batch`
|
10
10
|
# @attr_reader feedback [Eco::API::Session::Batch::Feedback] helper class for feedback and end-user decision making
|
11
11
|
class Job < Eco::API::Common::Session::BaseSession
|
12
|
+
include Eco::Language::Methods::DslAble
|
13
|
+
|
12
14
|
@types = [:get, :create, :update, :delete]
|
13
15
|
@sets = [:core, :details, :account]
|
14
16
|
|
@@ -278,14 +280,15 @@ module Eco
|
|
278
280
|
def api_included(full_queue)
|
279
281
|
return full_queue if type == :create
|
280
282
|
return full_queue unless excluded_callback = session.config.people.api_excluded
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
else
|
287
|
-
full_queue.select {|entry| !excluded_callback.call(entry, session, options, self)}
|
283
|
+
|
284
|
+
inc_excluded = options.dig(:include, :excluded)
|
285
|
+
excluded_only = inc_excluded.is_a?(Hash) && excluded[:only]
|
286
|
+
is_excluded = Proc.new do |entry|
|
287
|
+
evaluate(entry, session, options, self, &excluded_callback)
|
288
288
|
end
|
289
|
+
return full_queue.select(&is_excluded) if excluded_only
|
290
|
+
return full_queue if inc_excluded
|
291
|
+
full_queue.reject(&is_excluded)
|
289
292
|
end
|
290
293
|
|
291
294
|
# Applies the changes introduced by api policies
|