Class: Rallycat::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/rallycat/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username = nil, password = nil) ⇒ Connection

Returns a new instance of Connection.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rallycat/connection.rb', line 9

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

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



7
8
9
# File 'lib/rallycat/connection.rb', line 7

def api
  @api
end