Class: Gitlab::Current::Organization

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/current/organization.rb

Constant Summary collapse

HTTP_HEADER =
'X-GitLab-Organization-ID'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params: {}, headers: nil, user: nil) ⇒ Organization

Returns a new instance of Organization.



10
11
12
13
14
# File 'lib/gitlab/current/organization.rb', line 10

def initialize(params: {}, headers: nil, user: nil)
  @params = params
  @user = user
  @headers = headers
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



6
7
8
# File 'lib/gitlab/current/organization.rb', line 6

def headers
  @headers
end

#paramsObject (readonly)

Returns the value of attribute params.



6
7
8
# File 'lib/gitlab/current/organization.rb', line 6

def params
  @params
end

#userObject (readonly)

Returns the value of attribute user.



6
7
8
# File 'lib/gitlab/current/organization.rb', line 6

def user
  @user
end

Instance Method Details

#organizationObject



16
17
18
# File 'lib/gitlab/current/organization.rb', line 16

def organization
  from_params || from_headers || from_user || fallback_organization
end