Class: ConnectorsSdk::GitLab::CustomClient

Inherits:
Base::CustomClient show all
Defined in:
lib/connectors_sdk/gitlab/custom_client.rb

Defined Under Namespace

Classes: ClientError

Constant Summary

Constants inherited from Base::CustomClient

Base::CustomClient::MAX_RETRIES

Instance Attribute Summary

Attributes inherited from Base::CustomClient

#base_url, #ensure_fresh_auth, #middleware

Instance Method Summary collapse

Methods inherited from Base::CustomClient

#default_middleware, #http_client, #http_client!, #middleware!, #retry_config

Constructor Details

#initialize(base_url:, api_token:, ensure_fresh_auth: nil) ⇒ CustomClient

Returns a new instance of CustomClient.



26
27
28
29
# File 'lib/connectors_sdk/gitlab/custom_client.rb', line 26

def initialize(base_url:, api_token:, ensure_fresh_auth: nil)
  @api_token = api_token
  super(:base_url => base_url, :ensure_fresh_auth => ensure_fresh_auth)
end

Instance Method Details

#additional_middlewareObject



31
32
33
34
35
36
37
# File 'lib/connectors_sdk/gitlab/custom_client.rb', line 31

def additional_middleware
  [
    ::FaradayMiddleware::FollowRedirects,
    [ConnectorsShared::Middleware::RestrictHostnames, { :allowed_hosts => [base_url, API_BASE_URL] }],
    [ConnectorsShared::Middleware::BearerAuth, { :bearer_auth_token => @api_token }]
  ]
end