Class: Gitlab::API

Inherits:
Request show all
Defined in:
lib/gitlab/api.rb

Direct Known Subclasses

Client

Instance Attribute Summary

Attributes inherited from Request

#endpoint, #private_token

Instance Method Summary collapse

Methods inherited from Request

decode, parse, #request_defaults, #validate

Constructor Details

#initialize(options = {}) ⇒ API

Creates a new API.

Raises:

  • (Error:MissingCredentials)

13
14
15
16
17
18
19
20
# File 'lib/gitlab/api.rb', line 13

def initialize(options = {})
  options = Gitlab.options.merge(options)
  (Configuration::VALID_OPTIONS_KEYS + [:auth_token]).each do |key|
    send("#{key}=", options[key]) if options[key]
  end
  request_defaults(sudo)
  self.class.headers 'User-Agent' => user_agent
end