Method: Cts::Mpx::Aci::Tasks::Collect#collect
- Defined in:
- lib/cts/mpx/aci/tasks/collect.rb
#collect ⇒ Object
Executes the array of queries one by one. Collecting the result into the collections attribute.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cts/mpx/aci/tasks/collect.rb', line 20 def collect raise "empty queries array" if @queries&.empty? raise 'must set the queries attribute.' unless queries @entries = Entries.new queries.each do |config| query = run_query(config) if query&.entries.count.positive? log_collected_zero_entries config next end @entries += query.page.to_mpx_entries @entries.each do |entry| # if we collect the read only fields, it just messes everything up. # best to just not collect them. service_read_only_fields.each { |field| entry.fields.remove field } log_collected entry end end end |