Sha256: 7435d6814063574598d08b8035303948bb776e3f8a51fec16ec16b4567c6e027

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

require 'yaml'
require 'rally_rest_api'
require 'logger'

module Rallycat 
  class Connection
    attr_reader :api

    def initialize(username=nil, password=nil)
      @config = Config.new

      username ||= @config['username']
      password ||= @config['password']

      begin
        logger = ENV['RALLY_DEBUG'] ? Logger.new(STDOUT) : Logger.new(nil)

        @api = RallyRestAPI.new \
         base_url: 'https://rally1.rallydev.com/slm',
         username: username,
         password: password,
         logger: logger

      rescue Rally::NotAuthenticatedError
        raise InvalidCredentialsError.new('Your Rally credentials are invalid.')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rallycat-0.4.0 lib/rallycat/connection.rb