Sha256: 4ab5cc21ddaaf6c9e4d741e80ef34e6f4694e221afbe1a017cfd4c9e83828115

Contents?: true

Size: 1.12 KB

Versions: 77

Compression:

Stored size: 1.12 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 '../exceptions/command_failed'
require_relative '../models/domain'

module GoodData
  module Command
    # Low level access to GoodData API
    class Domain
      attr_reader :name

      class << self
        def add_user(domain, login, password, opts = { :client => GoodData.connection })
          data = {
            :domain => domain,
            :login => login,
            :password => password
          }
          GoodData::Domain.add_user(data.merge(opts))
        end

        def list_users(domain_name, options = { :client => GoodData.connection })
          client = GoodData.connect(options)
          domain = client.domain(domain_name)

          rows = domain.users.to_a.map do |user|
            [user.email, user.full_name]
          end

          table = Terminal::Table.new :headings => ['Email', 'Full Name'], :rows => rows
          puts table
        end
      end
    end
  end
end

Version data entries

77 entries across 77 versions & 1 rubygems

Version Path
gooddata-2.3.1-java lib/gooddata/commands/domain.rb
gooddata-2.3.1 lib/gooddata/commands/domain.rb
gooddata-2.3.0-java lib/gooddata/commands/domain.rb
gooddata-2.3.0 lib/gooddata/commands/domain.rb
gooddata-2.2.0-java lib/gooddata/commands/domain.rb
gooddata-2.2.0 lib/gooddata/commands/domain.rb
gooddata-2.1.19-java lib/gooddata/commands/domain.rb
gooddata-2.1.19 lib/gooddata/commands/domain.rb
gooddata-2.1.17-java lib/gooddata/commands/domain.rb
gooddata-2.1.17 lib/gooddata/commands/domain.rb
gooddata-2.1.15-java lib/gooddata/commands/domain.rb
gooddata-2.1.15 lib/gooddata/commands/domain.rb
gooddata-2.1.14-java lib/gooddata/commands/domain.rb
gooddata-2.1.14 lib/gooddata/commands/domain.rb
gooddata-2.1.13-java lib/gooddata/commands/domain.rb
gooddata-2.1.13 lib/gooddata/commands/domain.rb
gooddata-2.1.12-java lib/gooddata/commands/domain.rb
gooddata-2.1.12 lib/gooddata/commands/domain.rb
gooddata-2.1.11-java lib/gooddata/commands/domain.rb
gooddata-2.1.11 lib/gooddata/commands/domain.rb