Module: Eco::API::MicroCases::People::Fetch::WithEachStarter
- Included in:
- Eco::API::MicroCases::People::Fetch
- Defined in:
- lib/eco/api/microcases/people/fetch/with_each_starter.rb
Instance Method Summary collapse
-
#with_each_starter(entries, people, options, log_present: false, append_created: true) {|entry, person| ... } ⇒ Eco::API::Organization::People
Detects who in the
entriesis new in the organization andyields them one by one to the given block.
Instance Method Details
#with_each_starter(entries, people, options, log_present: false, append_created: true) {|entry, person| ... } ⇒ Eco::API::Organization::People
Note:
- it also links to
person.entrythe input dataentry.
Detects who in the entries is new in the organization and yield s them one by one to the given block.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/eco/api/microcases/people/fetch/with_each_starter.rb', line 19 def with_each_starter(entries, people, , log_present: false, append_created: true) starters = [] micro.with_each(entries, people, , append_created: append_created) do |entry, person| unless person.new? if log_present log(:error) { "This person (id: '#{person.id}') already exists: #{entry.to_s(:identify)}" } end next end starters << person yield(entry, person) if block_given? end people.newFrom starters end |