<commit_before># encoding: UTF-8

module GoodData
  class Domain
    attr_reader :name

    class << self
      def add_user(domain, login, password)
        data = {
          :accountSetting => {
            :login => login,
            :password => password,
            :verifyPassword => password,
            :email => login
          }
        }

        url = "/gdc/account/domains/#{domain}/users"
        GoodData.post(url, data)
      end

      def list_users(domain)
        result = []

        tmp = GoodData.get("/gdc/account/domains/#{domain}/users")
        tmp['accountSettings']['items'].each do |account|
          result << account['accountSetting']
        end

        result
      end

      def [](domain_name)
        GoodData::Domain.new(domain_name)
      end
    end

    def initialize(domain_name)
      self.name = domain_name
    end

    # Add user to login
    #
    # Example
    #
    # GoodData.connect '<EMAIL>' '<PASSWORD>-password'
    # domain = GoodData::Domain['gooddata-tomas-korcak']
    # domain.add_user '<EMAIL>', '<PASSWORD>'
    #
    def add_user(login, password)
      GoodData::Domain.add_user(self.name, login, password)
    end

    # List users in domain
    #
    # Example
    #
    # GoodData.connect '<EMAIL>' '<PASSWORD>-password'
    # domain = GoodData::Domain['gooddata-tomas-korcak']
    # pp domain.list_users
    #
    def list_users
      GoodData::Domain.list_users(self.name)
    end

    private

    def name=(domain_name)
      @name = domain_name
    end

  end
end
<commit_msg>Throw error when 'all' used<commit_after># encoding: UTF-8

module GoodData
  class Domain
    attr_reader :name

    class << self
      def add_user(domain, login, password)
        data = {
          :accountSetting => {
            :login => login,
            :password => password,
            :verifyPassword => password,
            :email => login
          }
        }

        url = "/gdc/account/domains/#{domain}/users"
        GoodData.post(url, data)
      end

      def list_users(domain)
        result = []

        tmp = GoodData.get("/gdc/account/domains/#{domain}/users")
        tmp['accountSettings']['items'].each do |account|
          result << account['accountSetting']
        end

        result
      end

      def [](domain_name)
        fail "Using pseudo-id 'all' is not supported by GoodData::Domain" if domain_name.to_s == 'all'
        GoodData::Domain.new(domain_name)
      end
    end

    def initialize(domain_name)
      self.name = domain_name
    end

    # Add user to login
    #
    # Example
    #
    # GoodData.connect '<EMAIL>' 'your-password'
    # domain = GoodData::Domain['gooddata-tomas-korcak']
    # domain.add_user '<EMAIL>', 'sup3rS3cr3tP4ssW0rtH'
    #
    def add_user(login, password)
      GoodData::Domain.add_user(self.name, login, password)
    end

    # List users in domain
    #
    # Example
    #
    # GoodData.connect '<EMAIL>' '<PASSWORD>-password'
    # domain = GoodData::Domain['gooddata-tomas-korcak']
    # pp domain.list_users
    #
    def list_users
      GoodData::Domain.list_users(self.name)
    end

    private

    def name=(domain_name)
      @name = domain_name
    end

  end
end

{'fraction_non_alphanumeric': 0.11892226695571384, 'fraction_numerical': 0.0021678538247135335, 'mean_word_length': 2.08206106870229, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4201633', 'n_tokens_mistral': 1018, 'n_tokens_neox': 984, 'n_words': 210}