Sha256: a3d40f393247ff1e817673519c5704a62a1a3b79e5a046ed4f71ed5272e96cfa

Contents?: true

Size: 1.12 KB

Versions: 25

Compression:

Stored size: 1.12 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2015 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

25 entries across 25 versions & 2 rubygems

Version Path
gooddata-edge-0.6.27.edge lib/gooddata/commands/domain.rb
gooddata-0.6.49 lib/gooddata/commands/domain.rb
gooddata-0.6.48 lib/gooddata/commands/domain.rb
gooddata-0.6.47 lib/gooddata/commands/domain.rb
gooddata-0.6.46 lib/gooddata/commands/domain.rb
gooddata-0.6.45 lib/gooddata/commands/domain.rb
gooddata-0.6.44 lib/gooddata/commands/domain.rb
gooddata-0.6.43 lib/gooddata/commands/domain.rb
gooddata-0.6.42 lib/gooddata/commands/domain.rb
gooddata-0.6.41 lib/gooddata/commands/domain.rb
gooddata-0.6.40 lib/gooddata/commands/domain.rb
gooddata-0.6.39 lib/gooddata/commands/domain.rb
gooddata-0.6.38 lib/gooddata/commands/domain.rb
gooddata-0.6.37 lib/gooddata/commands/domain.rb
gooddata-0.6.36 lib/gooddata/commands/domain.rb
gooddata-0.6.35 lib/gooddata/commands/domain.rb
gooddata-0.6.34 lib/gooddata/commands/domain.rb
gooddata-0.6.33 lib/gooddata/commands/domain.rb
gooddata-0.6.32 lib/gooddata/commands/domain.rb
gooddata-0.6.31 lib/gooddata/commands/domain.rb