lib/eco/api/usecases/base_io.rb in eco-helpers-1.2.1 vs lib/eco/api/usecases/base_io.rb in eco-helpers-1.2.2

- old
+ new

@@ -23,15 +23,15 @@ # @param type [Symbol] a valid type (among `self.class.types`) # @param input [Eco::API::Common::People::Entries, Eco::API::Organization::People] the input data of reference. # @param people [Eco::API::Organization::People] people object. # @param session [Eco::API:Session] # @param options [Hash] hash with symbol keys (i.e. behaviour modifiers, cli trackers, filters, etc.) - def initialize(type: nil, input: nil, people: nil, session:, options: {}) + def initialize(type: nil, input: nil, people: nil, session:, options: {}, validate: true) @output = nil self.type = type if type - if self.type + if self.type && validate validate_args(input: input, people: people, session: session, options: options) end @input = input @people = people @@ -52,11 +52,11 @@ Eco::API::UseCases::BaseIO.new(**kargs) end # @see Eco::API::UseCases::BaseIO#initialize # @return [Eco::API::UseCases::BaseIO] - def new(type: self.type, input: self.input, people: self.people, session: self.session, options: self.options) - self.class.new(type: type, input: input, people: people, session: session, options: options) + def new(type: self.type, input: self.input, people: self.people, session: self.session, options: self.options, validate: true) + self.class.new(type: type, input: input, people: people, session: session, options: options, validate: validate) end # Helper to build a `Hash` of symbol keys or `Array` with params to do callbacks. def params(keyed: false) kargs = {}