Method: BWCLI::Configuration#bwapi

Defined in:
lib/bwcli/configuration.rb

#bwapiObject

Creates and returns bwapi instance

Returns:

  • (Object)

    bwapi the bwapi instance



49
50
51
52
53
54
55
# File 'lib/bwcli/configuration.rb', line 49

def bwapi
  abort "You have no current user set!".yellow unless current_user_exists?
  abort "There is no access token set for the current user".yellow if config.current_user.access_token.nil?
  abort "There is no environment set for the current user".yellow if config.current_user.environment.nil?

  return @bwapi ||= BWAPI::Client.new(:username => current_user.username, :password => decrypt_password(current_user.username, current_user.password), :api_endpoint => api_endpoint)
end