Method: GoodData::LCM2::SynchronizeAttributeDrillpath.call

Defined in:
lib/gooddata/lcm/actions/synchronize_attribute_drillpaths.rb

.call(params) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/gooddata/lcm/actions/synchronize_attribute_drillpaths.rb', line 35

def call(params)
  results = []

  client = params.gdc_gd_client
  development_client = params.development_client

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

    from_project = development_client.projects(from) || fail("Invalid 'from' project specified - '#{from}'")
    to_projects = to.pmap do |entry|
      pid = entry[:pid]
      client.projects(pid) || fail("Invalid 'to' project specified - '#{pid}'")
    end

    GoodData::LCM.transfer_attribute_drillpaths(from_project, to_projects)

    to_projects.each do |project|
      results << {
        from: from,
        to: project.pid,
        status: 'ok'
      }
    end
  end

  results
end