class GoodData::LCM2::ImportObjectCollections

Constants

DESCRIPTION
PARAMS

Public Class Methods

call(params) click to toggle source
# File lib/gooddata/lcm/actions/import_object_collections.rb, line 26
def call(params)
  results = []

  client = params.gdc_gd_client
  development_client = params.development_client

  params.synchronize.peach do |info|
    from = info.from
    to_projects = info.to
    transfer_uris = info.transfer_uris

    from_project = development_client.projects(from) || fail("Invalid 'from' project specified - '#{from}'")

    to_projects.peach do |entry|
      pid = entry[:pid]
      to_project = client.projects(pid) || fail("Invalid 'to' project specified - '#{pid}'")

      if transfer_uris.any?
        from_project.partial_md_export(transfer_uris, project: to_project)
      end

      results << {
        from: from,
        to: pid,
        status: 'ok'
      }
    end
  end

  results
end