lib/rally_user_helper.rb
def find_user(name)
      if ( name.downcase != name )
        @logger.info "Looking for #{name.downcase} instead of #{name}"
      end

      if @cached_users.has_key?(name.downcase)
        return @cached_users[name.downcase]
      end

      single_user_query = RallyAPI::RallyQuery.new()
      single_user_query.type = :user
      single_user_query.fetch = @detail_user_fetch
      single_user_query.page_size = 200 #optional - default is 200
      single_user_query.limit = 90000 #optional - default is 99999
      single_user_query.order = "UserName Asc"
      single_user_query.query_string = "(UserName = \"" + name + "\")"

      query_results = @rally.find(single_user_query)

      if query_results.total_result_count == 0
        return nil
      else
        # Cache user for use next time
        this_user = query_results.first
        @cached_users[this_user["UserName"].downcase] = this_user
        @logger.info "Caching User: #{this_user.UserName}"

        return this_user
      end
    end
# Helper methods
# Does the user exist? If so, return the user, if not return nil
# Need to downcase the name since user names are downcased when created. Without downcase, we would not be
#  able to find 'Mark@acme.com'
Helper methods
Does the user exist. If so, return the user, if not return nil
Need to downcase the name since user names are downcased when created. Without downcase, we would not be
able to find 'Mark@acme.com'
Helper methods Does the user exist . If so return the user if not return nil Need to downcase the name since user names are downcased when created . Without downcase we would not be able to find ' Mark@acme . com '
def find_user(name)
      if ( name.downcase != name )
        @logger.info "Looking for #{name.downcase} instead of #{name}"
      end
      if @cached_users.has_key?(name.downcase)
        return @cached_users[name.downcase]
      end
      single_user_query = RallyAPI::RallyQuery.new()
      single_user_query.type = :user
      single_user_query.fetch = @detail_user_fetch
      single_user_query.page_size = 200 
      single_user_query.limit = 90000 
      single_user_query.order = "UserName Asc"
      single_user_query.query_string = "(UserName = \"" + name + "\")"
      query_results = @rally.find(single_user_query)
      if query_results.total_result_count == 0
        return nil
      else
        this_user = query_results.first
        @cached_users[this_user["UserName"].downcase] = this_user
        @logger.info "Caching User: #{this_user.UserName}"
        return this_user
      end
    end
def find_user ( name ) if ( name . downcase != name ) @logger . info "Looking for #{name.downcase} instead of #{name}" end if @cached_users . has_key? ( name . downcase ) return @cached_users [ name . downcase ] end single_user_query = RallyAPI :: RallyQuery . new ( ) single_user_query . type = :user single_user_query . fetch = @detail_user_fetch single_user_query . page_size = 200 single_user_query . limit = 90000 single_user_query . order = "UserName Asc" single_user_query . query_string = "(UserName = \"" + name + "\")" query_results = @rally . find ( single_user_query ) if query_results . total_result_count == 0 return nil else this_user = query_results . first @cached_users [ this_user [ "UserName" ] . downcase ] = this_user @logger . info "Caching User: #{this_user.UserName}" return this_user end end
Helper methods
Does the user exist?
Helper methods Does the user exist?
#optional - default is 200 #optional - default is 99999 # Cache user for use next time
name