lib/gooddata/lcm/actions/collect_segments.rb in gooddata-0.6.53 vs lib/gooddata/lcm/actions/collect_segments.rb in gooddata-0.6.54

- old
+ new

@@ -22,22 +22,21 @@ param :segments_filter, array_of(instance_of(Type::StringType)), required: false end class << self def call(params) - client = params.gdc_gd_client + data_product = params.data_product + data_product_segments = data_product.segments + params.gdc_logger.info("Domain segments: #{data_product_segments}") - domain_name = params.organization || params.domain - domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}") - domain_segments = domain.segments - if params.segments_filter - domain_segments.select! do |segment| + params.gdc_logger.info("Segments filter: #{params.segments_filter}") + data_product_segments.select! do |segment| params.segments_filter.include?(segment.segment_id) end end - segments = domain_segments.pmap do |segment| + segments = data_product_segments.pmap do |segment| project = nil begin project = segment.master_project rescue RestClient::BadRequest => e