Class: SupportOps::GitLab::Namespaces

Inherits:
Base
  • Object
show all
Defined in:
lib/support_ops_gitlab/gitlab/namespaces.rb

Overview

Defines the class Namespaces within the module SupportOps::GitLab.

Author:

  • Jason Colyer

Since:

  • 1.0.0

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

#activate!, #approve!, attributes, #badges, #ban!, #block!, client, #client=, #commits, configure, #contributors, #create_support_pin!, #deactivate!, define_attributes, #delete!, #diffs, #disable_2fa!, #discussions, #emails, #encoded_path, #events, #find, #find!, #gpg_keys, #hard_delete!, #impersonations, #initialize, #issues, #jobs, #latest_pipeline, #members, #memberships, #merge_requests, #move!, #notes, #paid?, #pats, #pipeline_variables, #pipelines, #preferences, #projects, readonly_attributes, #reject!, #revoke!, #rotate!, #save!, #ssh_keys, #status, #store_original_attributes, #subscribe!, #support_pin, to_hash, #tokens, #unban!, #unblock!, #unsubscribe!, #webhooks

Constructor Details

This class inherits a constructor from SupportOps::GitLab::Base

Instance Attribute Details

#avatar_urlString

The URL to the avatar of a namespace

Returns:

  • (String)

    the current value of avatar_url



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def avatar_url
  @avatar_url
end

#billable_members_countInteger

The billable user count of a namespace

Returns:

  • (Integer)

    the current value of billable_members_count



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def billable_members_count
  @billable_members_count
end

#end_dateString

Returns the current value of end_date.

Returns:

  • (String)

    the current value of end_date



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def end_date
  @end_date
end

#full_pathString

The full path of the namespace

Returns:

  • (String)

    the current value of full_path



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def full_path
  @full_path
end

#idInteger

The ID of the namespace

Returns:

  • (Integer)

    the current value of id



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def id
  @id
end

#kindString

The type of namespace, can be group or user

Returns:

  • (String)

    the current value of kind



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def kind
  @kind
end

#max_seats_usedInteger

The historical max seats used over the last year

Returns:

  • (Integer)

    the current value of max_seats_used



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def max_seats_used
  @max_seats_used
end

#members_count_with_descendantsInteger

The count of members include descendents for the namespace

Returns:

  • (Integer)

    the current value of members_count_with_descendants



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def members_count_with_descendants
  @members_count_with_descendants
end

#nameString

The name of the namespace

Returns:

  • (String)

    the current value of name



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def name
  @name
end

#parent_idInteger

The parent group ID for creating nested namespace

Returns:

  • (Integer)

    the current value of parent_id



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def parent_id
  @parent_id
end

#pathString

The path of the namespace

Returns:

  • (String)

    the current value of path



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def path
  @path
end

#planString

The subscription plan currently in use for the namespace

Returns:

  • (String)

    the current value of plan



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def plan
  @plan
end

#projects_countInteger

Number of projects in the namespace

Returns:

  • (Integer)

    the current value of projects_count



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def projects_count
  @projects_count
end

#root_repository_sizeInteger

Returns the current value of root_repository_size.

Returns:

  • (Integer)

    the current value of root_repository_size



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def root_repository_size
  @root_repository_size
end

#seats_in_useInteger

The billable seats in use

Returns:

  • (Integer)

    the current value of seats_in_use



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def seats_in_use
  @seats_in_use
end

#trialBoolean

If the namespace is using a trial

Returns:

  • (Boolean)

    the current value of trial



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def trial
  @trial
end

#trial_ends_onString

Timestamp the trial ends on

Returns:

  • (String)

    the current value of trial_ends_on



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def trial_ends_on
  @trial_ends_on
end

#web_urlString

The URL of the namespace

Returns:

  • (String)

    the current value of web_url



31
32
33
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 31

def web_url
  @web_url
end

Class Method Details

.exists?(path) ⇒ Boolean

Verifies if a specified namespace already exists

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.com/api/v4'
  config.token = 'abc123'
end

pp SupportOps::GitLab::Namespaces.exists?('test')
# => true
pp SupportOps::GitLab::Namespaces.exists?('testaaaaaaaaaaaa')
# => false

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



160
161
162
163
164
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 160

def self.exists?(path)
  response = client.connection.get("namespaces/#{ERB::Util.url_encode(path)}/exists")
  body = Oj.load(response.body)
  body['exists']
end

.get(object) ⇒ Object

Locates a specific namespace in the GitLab system

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.com/api/v4'
  config.token = 'abc123'
end

namespace = SupportOps::GitLab::Namespaces.get(123456)
pp namespace.plan
# => "ultimate"
require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.com/api/v4'
  config.token = 'abc123'
end

namespace = SupportOps::GitLab::Namespaces.get('jcolyer-is-awesome')
pp namespace.plan
# => "ultimate"

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



92
93
94
95
96
97
98
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 92

def self.get(object)
  if object.is_a? Namespaces
    Namespaces.new(id: id).find
  else
    Namespaces.new(id: object).find
  end
end

.get!(object) ⇒ Object

Locates a specific namespace in the GitLab system

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.com/api/v4'
  config.token = 'abc123'
end

namespace = SupportOps::GitLab::Namespaces.get(123456)
pp namespace.plan
# => "ultimate"
require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.com/api/v4'
  config.token = 'abc123'
end

namespace = SupportOps::GitLab::Namespaces.get('jcolyer-is-awesome')
pp namespace.plan
# => "ultimate"

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



131
132
133
134
135
136
137
# File 'lib/support_ops_gitlab/gitlab/namespaces.rb', line 131

def self.get!(object)
  if object.is_a? Namespaces
    Namespaces.new(id: id).find!
  else
    Namespaces.new(id: object).find!
  end
end