Sha256: 3ff3566439dfb3c41f4113fd1962e7e3f12e2debb57b82e333e5220191e615dd
Contents?: true
Size: 1.52 KB
Versions: 6
Compression:
Stored size: 1.52 KB
Contents
# encoding: UTF-8 # # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. require_relative 'base_action' module GoodData module LCM2 class CollectUsersBrickUsers < BaseAction DESCRIPTION = 'Enriches parameters with users from the Users Brick input.' PARAMS = define_params(self) do description 'Input source of the Users Brick. Needed to prevent ' \ 'deletion of filters for a user that is to be removed.' param :users_brick_config, instance_of(Type::UsersBrickConfig), required: true end class << self def call(params) users_brick_users = [] login_column = params.users_brick_config.login_column || 'login' users_brick_data_source = GoodData::Helpers::DataSource.new(params.users_brick_config.input_source) users_brick_data_source_file = File.open( users_brick_data_source.realize(params), 'r:UTF-8' ) CSV.foreach(users_brick_data_source_file, headers: true, return_headers: false, encoding: 'utf-8') do |row| users_brick_users << { login: row[login_column] } end { results: users_brick_users, params: { users_brick_users: users_brick_users } } end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems