Class: Readiness::GitLab::Namespaces
- Inherits:
-
Client
- Object
- Client
- Readiness::GitLab::Namespaces
show all
- Defined in:
- lib/support_readiness/gitlab/namespaces.rb
Overview
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Client
auth_error, bad_request_error, convert_actions, convert_conditions, convert_standard_names_to_ids, convert_ticket_form_agent_conditions, convert_ticket_form_brands, convert_ticket_form_end_user_conditions, convert_ticket_form_names_to_ids, convert_view_names_to_ids, convert_view_restrictions, covert_ticket_form_field_ids, create_package!, erb_renderer, handle_request_error, not_found_error, not_processible_error, put_into_archive, recursively_deflate_directory, timestamp_filename, to_clean_json, to_clean_json_with_key, to_hash, to_nearly_clean_json, to_nearly_clean_json_with_key, to_param_string, write_entries
Constructor Details
#initialize(object = {}) ⇒ Namespaces
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 24
def initialize(object = {})
@avatar_url = object['avatar_url']
@billable_members_count = object['billable_members_count']
@end_date = object['end_date']
@full_path = object['full_path']
@id = object['id']
@kind = object['kind']
@max_seats_used = object['max_seats_used']
@members_count_with_descendants = object['members_count_with_descendants']
@name = object['name']
@parent_id = object['parent_id']
@path = object['path']
@plan = object['plan']
@root_repository_size = object['root_repository_size']
@seats_in_use = object['seats_in_use']
@trial_ends_on = object['trial_ends_on']
@trial = object['trial']
@web_url = object['web_url']
end
|
Instance Attribute Details
#avatar_url ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def avatar_url
@avatar_url
end
|
#billable_members_count ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def billable_members_count
@billable_members_count
end
|
#end_date ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def end_date
@end_date
end
|
#full_path ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def full_path
@full_path
end
|
#id ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def id
@id
end
|
#kind ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def kind
@kind
end
|
#max_seats_used ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def max_seats_used
@max_seats_used
end
|
#members_count_with_descendants ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def members_count_with_descendants
@members_count_with_descendants
end
|
#name ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def name
@name
end
|
#parent_id ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def parent_id
@parent_id
end
|
#path ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def path
@path
end
|
#plan ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def plan
@plan
end
|
#root_repository_size ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def root_repository_size
@root_repository_size
end
|
#seats_in_use ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def seats_in_use
@seats_in_use
end
|
#trial ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def trial
@trial
end
|
#trial_ends_on ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def trial_ends_on
@trial_ends_on
end
|
#web_url ⇒ Object
13
14
15
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 13
def web_url
@web_url
end
|
Class Method Details
.exists?(client, name) ⇒ Boolean
Checks if a namespace exists
87
88
89
90
91
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 87
def self.exists?(client, name)
response = client.connection.get "namespaces/#{name}/exists"
handle_request_error(0, 'GitLab', response.status) unless response.status == 200
Oj.load(response.body)['exists']
end
|
.find(client, nid) ⇒ Hash
Locates a namespace within GitLab. This will not exit on error (except Authentication errors)
110
111
112
113
114
115
116
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 110
def self.find(client, nid)
response = client.connection.get "namespaces/#{nid}"
handle_request_error(0, 'GitLab', response.status, { action: 'get', id: nid }) unless response.status == 200
return Namespaces.new(Oj.load(response.body)) if response.status == 200
Oj.load(response.body)
end
|
.find!(client, nid) ⇒ Object
Locates a namespace within GitLab. This will exit on error
135
136
137
138
139
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 135
def self.find!(client, nid)
response = client.connection.get "namespaces/#{nid}"
handle_request_error(1, 'GitLab', response.status, { action: 'Find namespace', id: nid }) unless response.status == 200
Namespaces.new(Oj.load(response.body))
end
|
.is_paid?(client, namespace) ⇒ Boolean
Determines if a given namespace is paid or not
205
206
207
208
209
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 205
def self.is_paid?(client, namespace)
return true if %w[bronze silver gold premium ultimate].include? namespace.plan
false
end
|
.owners(client, namespace) ⇒ Array
Locates the group owners for a namespace within GitLab
159
160
161
162
163
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 159
def self.owners(client, namespace)
response = client.connection.get "internal/gitlab_subscriptions/namespaces/#{namespace.id}/owners"
handle_request_error(0, 'GitLab', response.status, { action: 'get', id: namespace.id }) unless response.status == 200
Oj.load(response.body)
end
|
.search(client, query, filters = []) ⇒ Array
Search for a namespace by name. This method can take a long time to run depending on the number of results found or permission level used.
63
64
65
66
67
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 63
def self.search(client, query, filters = [])
response = client.connection.get "namespaces?search=#{query}&#{to_param_string(filters)}"
handle_request_error(0, 'GitLab', response.status) unless response.status == 200
Oj.load(response.body).map { |n| Namespaces.new(n) }
end
|
.subscription(client, namespace) ⇒ Array
Locates the subscription for a namespace within GitLab
183
184
185
186
187
|
# File 'lib/support_readiness/gitlab/namespaces.rb', line 183
def self.subscription(client, namespace)
response = client.connection.get "internal/gitlab_subscriptions/namespaces/#{namespace.id}/gitlab_subscription"
handle_request_error(0, 'GitLab', response.status, { action: 'get', id: namespace.id }) unless response.status == 200
Oj.load(response.body)
end
|