Method: Dri::ApiClient#initialize

Defined in:
lib/dri/api_client.rb

#initialize(config, ops = false) ⇒ ApiClient

Returns a new instance of ApiClient.



19
20
21
22
23
24
25
26
27
28
# File 'lib/dri/api_client.rb', line 19

def initialize(config, ops = false)
  @token = config.read.dig("settings", "token")
  @ops_token = config.read.dig("settings", "ops_token")
  if @token.nil? || @ops_token.nil?
    raise TokenNotProvidedError, "Gitlab API client cannot be initialized without both access tokens. " \
                                 "Run `dri init` again or `dri profile --edit` to add an ops_token entry."
  end

  @ops_instance = ops
end