Sha256: 04e3518d06990ab5cc2a956eed0401f415e99e47127e30cf56ee9d74aa6239bd
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require 'yaml' require 'rally_rest_api' module Rallycat class InvalidConfigError < StandardError; end class InvalidCredentialsError < StandardError; end class Connection attr_reader :api def initialize(username=nil, password=nil) @username = username @password = password config = parse_config begin @api = RallyRestAPI.new \ base_url: 'https://rally1.rallydev.com/slm', username: config.fetch('username'), password: config.fetch('password') rescue Rally::NotAuthenticatedError raise InvalidCredentialsError.new('Your Rally credentials are invalid.') end end private def parse_config rc_file_path = File.expand_path '~/.rallycatrc' if @username || @password { 'username' => @username, 'password' => @password } else begin YAML.load_file(rc_file_path) rescue StandardError message = "Your rallycat config file is missing or invalid. Please RTFM." raise InvalidConfigError.new message end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rallycat-0.1.0 | lib/rallycat/connection.rb |