Class: GoodData::LCM2::AssociateClients

Inherits:
BaseAction show all
Defined in:
lib/gooddata/lcm/actions/associate_clients.rb

Constant Summary collapse

DESCRIPTION =
'Associate LCM Clients'
PARAMS =
define_params(self) do
  description 'Client Used for Connecting to GD'
  param :gdc_gd_client, instance_of(Type::GdClientType), required: true
end
RESULT_HEADER =
[
  :id,
  :status,
  :originalProject,
  :client,
  :type
]

Constants included from Dsl::Dsl

Dsl::Dsl::DEFAULT_OPTS, Dsl::Dsl::TYPES

Class Method Summary collapse

Methods inherited from BaseAction

check_params

Methods included from Dsl::Dsl

#define_params, #define_type, #process

Class Method Details

.call(params) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/gooddata/lcm/actions/associate_clients.rb', line 28

def call(params)
  # Check if all required parameters were passed
  BaseAction.check_params(PARAMS, params)

  client = params.gdc_gd_client

  domain_name = params.organization || params.domain
  domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}")

  domain.update_clients_settings(params.clients)

  delete_projects = GoodData::Helpers.to_boolean(params.delete_projects)
  delete_extra = GoodData::Helpers.to_boolean(params.delete_extra)
  options = { delete_projects: delete_projects }
  options.merge!(delete_extra_option(params)) if delete_extra

  domain.update_clients(params.clients, options)
end