Class: GoodData::LCM2::ApplyCustomMaql
- Inherits:
-
BaseAction
- Object
- BaseAction
- GoodData::LCM2::ApplyCustomMaql
- Defined in:
- lib/gooddata/lcm/actions/apply_custom_maql.rb
Overview
Applies custom MAQL DDL to all client projects so customized labels and fiscal calendars are not deleted. To ease up further automation, the MAQL DDL may be stored in separate field in lcm_release table as we will need custom Release brick action which will populate it.
Constant Summary collapse
- DESCRIPTION =
'Apply Custom MAQL DDL'- PARAMS =
define_params(self) do description 'Should be custom MAQL DDL Applied' param :apply_maql_ddl, instance_of(Type::BooleanType), required: false, default: false end
- RESULT_HEADER =
[ :segment, :maql, :status ]
Constants included from Dsl::Dsl
Dsl::Dsl::DEFAULT_OPTS, Dsl::Dsl::TYPES
Class Method Summary collapse
Methods inherited from BaseAction
Methods included from Dsl::Dsl
#define_params, #define_type, #process
Class Method Details
.call(params) ⇒ Object
31 32 33 34 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 64 65 66 |
# File 'lib/gooddata/lcm/actions/apply_custom_maql.rb', line 31 def call(params) return [] unless params.apply_maql_ddl.to_b client = params.gdc_gd_client domain_name = params.organization || params.domain domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}") segment_ids = params.segments.map(&:segment_id) domain_segments = domain.segments.select do |ds| segment_ids.include?(ds.segment_id) end res = [] domain_segments.peach do |ds| maql = 'CREATE DATASET {dataset.quotes} VISUAL (TITLE "Stock Quotes Data");' unless maql.empty? ds.clients.peach do |dc| project = dc.project r = project.execute_maql(maql) item = { segment: ds.segment_id, maql: maql, status: r } res.push(item) end end end res end |