Class: Readiness::GitLab::Projects

Inherits:
Client
  • Object
show all
Defined in:
lib/support_readiness/gitlab/projects.rb

Overview

TODO:

Anything listed on docs.gitlab.com/ee/api/projects.html not currently here

Defines the class Projects within the module Readiness::GitLab.

Author:

  • Jason Colyer

Since:

  • 1.0.0

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 = {}) ⇒ Projects

Creates a new Readiness::GitLab::Projects instance

Examples:

require 'support_readiness'
Readiness::GitLab::Projects.new

Parameters:

Author:

  • Jason Colyer

Since:

  • 1.0.0



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/support_readiness/gitlab/projects.rb', line 25

def initialize(object = {})
  @allow_merge_on_skipped_pipeline = object['allow_merge_on_skipped_pipeline']
  @allow_pipeline_trigger_approve_deployment = object['allow_pipeline_trigger_approve_deployment']
  @analytics_access_level = object['analytics_access_level']
  @approvals_before_merge = object['approvals_before_merge']
  @archived = object['archived']
  @auto_cancel_pending_pipelines = object['auto_cancel_pending_pipelines']
  @autoclose_referenced_issues = object['autoclose_referenced_issues']
  @auto_devops_deploy_strategy = object['auto_devops_deploy_strategy']
  @auto_devops_enabled = object['auto_devops_enabled']
  @avatar_url = object['avatar_url']
  @build_git_strategy = object['build_git_strategy']
  @builds_access_level = object['builds_access_level']
  @build_timeout = object['build_timeout']
  @can_create_merge_request_in = object['can_create_merge_request_in']
  @ci_allow_fork_pipelines_to_run_in_parent_project = object['ci_allow_fork_pipelines_to_run_in_parent_project']
  @ci_config_path = object['ci_config_path']
  @ci_default_git_depth = object['ci_default_git_depth']
  @ci_forward_deployment_enabled = object['ci_forward_deployment_enabled']
  @ci_forward_deployment_rollback_allowed = object['ci_forward_deployment_rollback_allowed']
  @ci_id_token_sub_claim_components = object['ci_id_token_sub_claim_components']
  @ci_job_token_scope_enabled = object['ci_job_token_scope_enabled']
  @ci_pipeline_variables_minimum_override_role = object['ci_pipeline_variables_minimum_override_role']
  @ci_push_repository_for_job_token_allowed = object['ci_push_repository_for_job_token_allowed']
  @ci_restrict_pipeline_cancellation_role = object['ci_restrict_pipeline_cancellation_role']
  @ci_separated_caches = object['ci_separated_caches']
  @compliance_frameworks = object['compliance_frameworks']
  @container_expiration_policy = object['container_expiration_policy']
  @container_registry_access_level = object['container_registry_access_level']
  @container_registry_enabled = object['container_registry_enabled']
  @container_registry_image_prefix = object['container_registry_image_prefix']
  @created_at = object['created_at']
  @creator_id = object['creator_id']
  @custom_attributes = object['custom_attributes']
  @default_branch = object['default_branch']
  @description = object['description']
  @description_html = object['description_html']
  @emails_disabled = object['emails_disabled']
  @emails_enabled = object['emails_enabled']
  @empty_repo = object['empty_repo']
  @enforce_auth_checks_on_uploads = object['enforce_auth_checks_on_uploads']
  @environments_access_level = object['environments_access_level']
  @external_authorization_classification_label = object['external_authorization_classification_label']
  @feature_flags_access_level = object['feature_flags_access_level']
  @forked_from_project = object['forked_from_project']
  @forking_access_level = object['forking_access_level']
  @forks_count = object['forks_count']
  @group_runners_enabled = object['group_runners_enabled']
  @http_url_to_repo = object['http_url_to_repo']
  @id = object['id']
  @import_error = object['import_error']
  @import_status = object['import_status']
  @import_type = object['import_type']
  @import_url = object['import_url']
  @infrastructure_access_level = object['infrastructure_access_level']
  @issue_branch_template = object['issue_branch_template']
  @issues_access_level = object['issues_access_level']
  @issues_enabled = object['issues_enabled']
  @issues_template = object['issues_template']
  @jobs_enabled = object['jobs_enabled']
  @keep_latest_artifact = object['keep_latest_artifact']
  @last_activity_at = object['last_activity_at']
  @lfs_enabled = object['lfs_enabled']
  @license = object['license']
  @license_url = object['license_url']
  @_links = object['_links']
  @marked_for_deletion_at = object['marked_for_deletion_at']
  @marked_for_deletion_on = object['marked_for_deletion_on']
  @merge_commit_template = object['merge_commit_template']
  @merge_method = object['merge_method']
  @merge_pipelines_enabled = object['merge_pipelines_enabled']
  @merge_requests_access_level = object['merge_requests_access_level']
  @merge_requests_enabled = object['merge_requests_enabled']
  @merge_requests_template = object['merge_requests_template']
  @merge_trains_enabled = object['merge_trains_enabled']
  @merge_trains_skip_train_allowed = object['merge_trains_skip_train_allowed']
  @mirror = object['mirror']
  @model_experiments_access_level = object['model_experiments_access_level']
  @model_registry_access_level = object['model_registry_access_level']
  @monitor_access_level = object['monitor_access_level']
  @mr_default_target_self = object['mr_default_target_self']
  @name = object['name']
  @namespace_id = object['namespace_id']
  @namespace = object['namespace']
  @name_with_namespace = object['name_with_namespace']
  @only_allow_merge_if_all_discussions_are_resolved = object['only_allow_merge_if_all_discussions_are_resolved']
  @only_allow_merge_if_all_status_checks_passed = object['only_allow_merge_if_all_status_checks_passed']
  @only_allow_merge_if_pipeline_succeeds = object['only_allow_merge_if_pipeline_succeeds']
  @open_issues_count = object['open_issues_count']
  @packages_enabled = object['packages_enabled']
  @pages_access_level = object['pages_access_level']
  @path = object['path']
  @path_with_namespace = object['path_with_namespace']
  @permissions = object['permissions']
  @pre_receive_secret_detection_enabled = object['pre_receive_secret_detection_enabled']
  @prevent_merge_without_jira_issue = object['prevent_merge_without_jira_issue']
  @printing_merge_request_link_enabled = object['printing_merge_request_link_enabled']
  @public_jobs = object['public_jobs']
  @readme_url = object['readme_url']
  @releases_access_level = object['releases_access_level']
  @remove_source_branch_after_merge = object['remove_source_branch_after_merge']
  @repository_access_level = object['repository_access_level']
  @repository_object_format = object['repository_object_format']
  @repository_storage = object['repository_storage']
  @request_access_enabled = object['request_access_enabled']
  @requirements_access_level = object['requirements_access_level']
  @requirements_enabled = object['requirements_enabled']
  @resolve_outdated_diff_discussions = object['resolve_outdated_diff_discussions']
  @restrict_user_defined_variables = object['restrict_user_defined_variables']
  @runners_token = object['runners_token']
  @runner_token_expiration_interval = object['runner_token_expiration_interval']
  @security_and_compliance_access_level = object['security_and_compliance_access_level']
  @security_and_compliance_enabled = object['security_and_compliance_enabled']
  @service_desk_address = object['service_desk_address']
  @service_desk_enabled = object['service_desk_enabled']
  @shared_runners_enabled = object['shared_runners_enabled']
  @shared_with_groups = object['shared_with_groups']
  @snippets_access_level = object['snippets_access_level']
  @snippets_enabled = object['snippets_enabled']
  @squash_commit_template = object['squash_commit_template']
  @squash_option = object['squash_option']
  @ssh_url_to_repo = object['ssh_url_to_repo']
  @star_count = object['star_count']
  @statistics = object['statistics']
  @suggestion_commit_message = object['suggestion_commit_message']
  @tag_list = object['tag_list']
  @topics = object['topics']
  @updated_at = object['updated_at']
  @visibility = object['visibility']
  @warn_about_potentially_unwanted_characters = object['warn_about_potentially_unwanted_characters']
  @web_url = object['web_url']
  @wiki_access_level = object['wiki_access_level']
  @wiki_enabled = object['wiki_enabled']
end

Instance Attribute Details

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def _links
  @_links
end

#allow_merge_on_skipped_pipelineObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def allow_merge_on_skipped_pipeline
  @allow_merge_on_skipped_pipeline
end

#allow_pipeline_trigger_approve_deploymentObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def allow_pipeline_trigger_approve_deployment
  @allow_pipeline_trigger_approve_deployment
end

#analytics_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def analytics_access_level
  @analytics_access_level
end

#approvals_before_mergeObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def approvals_before_merge
  @approvals_before_merge
end

#archivedObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def archived
  @archived
end

#auto_cancel_pending_pipelinesObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def auto_cancel_pending_pipelines
  @auto_cancel_pending_pipelines
end

#auto_devops_deploy_strategyObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def auto_devops_deploy_strategy
  @auto_devops_deploy_strategy
end

#auto_devops_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def auto_devops_enabled
  @auto_devops_enabled
end

#autoclose_referenced_issuesObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def autoclose_referenced_issues
  @autoclose_referenced_issues
end

#avatar_urlObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def avatar_url
  @avatar_url
end

#build_git_strategyObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def build_git_strategy
  @build_git_strategy
end

#build_timeoutObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def build_timeout
  @build_timeout
end

#builds_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def builds_access_level
  @builds_access_level
end

#can_create_merge_request_inObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def can_create_merge_request_in
  @can_create_merge_request_in
end

#ci_allow_fork_pipelines_to_run_in_parent_projectObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def ci_allow_fork_pipelines_to_run_in_parent_project
  @ci_allow_fork_pipelines_to_run_in_parent_project
end

#ci_config_pathObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def ci_config_path
  @ci_config_path
end

#ci_default_git_depthObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def ci_default_git_depth
  @ci_default_git_depth
end

#ci_forward_deployment_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def ci_forward_deployment_enabled
  @ci_forward_deployment_enabled
end

#ci_forward_deployment_rollback_allowedObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def ci_forward_deployment_rollback_allowed
  @ci_forward_deployment_rollback_allowed
end

#ci_id_token_sub_claim_componentsObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def ci_id_token_sub_claim_components
  @ci_id_token_sub_claim_components
end

#ci_job_token_scope_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def ci_job_token_scope_enabled
  @ci_job_token_scope_enabled
end

#ci_pipeline_variables_minimum_override_roleObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def ci_pipeline_variables_minimum_override_role
  @ci_pipeline_variables_minimum_override_role
end

#ci_push_repository_for_job_token_allowedObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def ci_push_repository_for_job_token_allowed
  @ci_push_repository_for_job_token_allowed
end

#ci_restrict_pipeline_cancellation_roleObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def ci_restrict_pipeline_cancellation_role
  @ci_restrict_pipeline_cancellation_role
end

#ci_separated_cachesObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def ci_separated_caches
  @ci_separated_caches
end

#compliance_frameworksObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def compliance_frameworks
  @compliance_frameworks
end

#container_expiration_policyObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def container_expiration_policy
  @container_expiration_policy
end

#container_registry_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def container_registry_access_level
  @container_registry_access_level
end

#container_registry_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def container_registry_enabled
  @container_registry_enabled
end

#container_registry_image_prefixObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def container_registry_image_prefix
  @container_registry_image_prefix
end

#created_atObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def created_at
  @created_at
end

#creator_idObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def creator_id
  @creator_id
end

#custom_attributesObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def custom_attributes
  @custom_attributes
end

#default_branchObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def default_branch
  @default_branch
end

#descriptionObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def description
  @description
end

#description_htmlObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def description_html
  @description_html
end

#emails_disabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def emails_disabled
  @emails_disabled
end

#emails_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def emails_enabled
  @emails_enabled
end

#empty_repoObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def empty_repo
  @empty_repo
end

#enforce_auth_checks_on_uploadsObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def enforce_auth_checks_on_uploads
  @enforce_auth_checks_on_uploads
end

#environments_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def environments_access_level
  @environments_access_level
end

#external_authorization_classification_labelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def external_authorization_classification_label
  @external_authorization_classification_label
end

#feature_flags_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def feature_flags_access_level
  @feature_flags_access_level
end

#forked_from_projectObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def forked_from_project
  @forked_from_project
end

#forking_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def forking_access_level
  @forking_access_level
end

#forks_countObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def forks_count
  @forks_count
end

#group_runners_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def group_runners_enabled
  @group_runners_enabled
end

#http_url_to_repoObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def http_url_to_repo
  @http_url_to_repo
end

#idObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def id
  @id
end

#import_errorObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def import_error
  @import_error
end

#import_statusObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def import_status
  @import_status
end

#import_typeObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def import_type
  @import_type
end

#import_urlObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def import_url
  @import_url
end

#infrastructure_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def infrastructure_access_level
  @infrastructure_access_level
end

#issue_branch_templateObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def issue_branch_template
  @issue_branch_template
end

#issues_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def issues_access_level
  @issues_access_level
end

#issues_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def issues_enabled
  @issues_enabled
end

#issues_templateObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def issues_template
  @issues_template
end

#jobs_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def jobs_enabled
  @jobs_enabled
end

#keep_latest_artifactObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def keep_latest_artifact
  @keep_latest_artifact
end

#last_activity_atObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def last_activity_at
  @last_activity_at
end

#lfs_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def lfs_enabled
  @lfs_enabled
end

#licenseObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def license
  @license
end

#license_urlObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def license_url
  @license_url
end

#marked_for_deletion_atObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def marked_for_deletion_at
  @marked_for_deletion_at
end

#marked_for_deletion_onObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def marked_for_deletion_on
  @marked_for_deletion_on
end

#merge_commit_templateObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def merge_commit_template
  @merge_commit_template
end

#merge_methodObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def merge_method
  @merge_method
end

#merge_pipelines_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def merge_pipelines_enabled
  @merge_pipelines_enabled
end

#merge_requests_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def merge_requests_access_level
  @merge_requests_access_level
end

#merge_requests_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def merge_requests_enabled
  @merge_requests_enabled
end

#merge_requests_templateObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def merge_requests_template
  @merge_requests_template
end

#merge_trains_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def merge_trains_enabled
  @merge_trains_enabled
end

#merge_trains_skip_train_allowedObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def merge_trains_skip_train_allowed
  @merge_trains_skip_train_allowed
end

#mirrorObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def mirror
  @mirror
end

#model_experiments_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def model_experiments_access_level
  @model_experiments_access_level
end

#model_registry_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def model_registry_access_level
  @model_registry_access_level
end

#monitor_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def monitor_access_level
  @monitor_access_level
end

#mr_default_target_selfObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def mr_default_target_self
  @mr_default_target_self
end

#nameObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def name
  @name
end

#name_with_namespaceObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def name_with_namespace
  @name_with_namespace
end

#namespaceObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def namespace
  @namespace
end

#namespace_idObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def namespace_id
  @namespace_id
end

#only_allow_merge_if_all_discussions_are_resolvedObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def only_allow_merge_if_all_discussions_are_resolved
  @only_allow_merge_if_all_discussions_are_resolved
end

#only_allow_merge_if_all_status_checks_passedObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def only_allow_merge_if_all_status_checks_passed
  @only_allow_merge_if_all_status_checks_passed
end

#only_allow_merge_if_pipeline_succeedsObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def only_allow_merge_if_pipeline_succeeds
  @only_allow_merge_if_pipeline_succeeds
end

#open_issues_countObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def open_issues_count
  @open_issues_count
end

#packages_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def packages_enabled
  @packages_enabled
end

#pages_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def pages_access_level
  @pages_access_level
end

#pathObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def path
  @path
end

#path_with_namespaceObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def path_with_namespace
  @path_with_namespace
end

#permissionsObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def permissions
  @permissions
end

#pre_receive_secret_detection_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def pre_receive_secret_detection_enabled
  @pre_receive_secret_detection_enabled
end

#prevent_merge_without_jira_issueObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def prevent_merge_without_jira_issue
  @prevent_merge_without_jira_issue
end

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def printing_merge_request_link_enabled
  @printing_merge_request_link_enabled
end

#public_jobsObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def public_jobs
  @public_jobs
end

#readme_urlObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def readme_url
  @readme_url
end

#releases_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def releases_access_level
  @releases_access_level
end

#remove_source_branch_after_mergeObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def remove_source_branch_after_merge
  @remove_source_branch_after_merge
end

#repository_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def repository_access_level
  @repository_access_level
end

#repository_object_formatObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def repository_object_format
  @repository_object_format
end

#repository_storageObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def repository_storage
  @repository_storage
end

#request_access_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def request_access_enabled
  @request_access_enabled
end

#requirements_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def requirements_access_level
  @requirements_access_level
end

#requirements_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def requirements_enabled
  @requirements_enabled
end

#resolve_outdated_diff_discussionsObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def resolve_outdated_diff_discussions
  @resolve_outdated_diff_discussions
end

#restrict_user_defined_variablesObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def restrict_user_defined_variables
  @restrict_user_defined_variables
end

#runner_token_expiration_intervalObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def runner_token_expiration_interval
  @runner_token_expiration_interval
end

#runners_tokenObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def runners_token
  @runners_token
end

#security_and_compliance_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def security_and_compliance_access_level
  @security_and_compliance_access_level
end

#security_and_compliance_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def security_and_compliance_enabled
  @security_and_compliance_enabled
end

#service_desk_addressObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def service_desk_address
  @service_desk_address
end

#service_desk_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def service_desk_enabled
  @service_desk_enabled
end

#shared_runners_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def shared_runners_enabled
  @shared_runners_enabled
end

#shared_with_groupsObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def shared_with_groups
  @shared_with_groups
end

#snippets_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def snippets_access_level
  @snippets_access_level
end

#snippets_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def snippets_enabled
  @snippets_enabled
end

#squash_commit_templateObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def squash_commit_template
  @squash_commit_template
end

#squash_optionObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def squash_option
  @squash_option
end

#ssh_url_to_repoObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def ssh_url_to_repo
  @ssh_url_to_repo
end

#star_countObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def star_count
  @star_count
end

#statisticsObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def statistics
  @statistics
end

#suggestion_commit_messageObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def suggestion_commit_message
  @suggestion_commit_message
end

#tag_listObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def tag_list
  @tag_list
end

#topicsObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def topics
  @topics
end

#updated_atObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def updated_at
  @updated_at
end

#visibilityObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def visibility
  @visibility
end

#warn_about_potentially_unwanted_charactersObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def warn_about_potentially_unwanted_characters
  @warn_about_potentially_unwanted_characters
end

#web_urlObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def web_url
  @web_url
end

#wiki_access_levelObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def wiki_access_level
  @wiki_access_level
end

#wiki_enabledObject

Since:

  • 1.0.0



14
15
16
# File 'lib/support_readiness/gitlab/projects.rb', line 14

def wiki_enabled
  @wiki_enabled
end

Class Method Details

.access_tokens(client, project) ⇒ Array

Lists all access tokens for a project

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
tokens = Readiness::GitLab::Projects.access_tokens(client, project)
pp tokens.first['active']
# => false

Parameters:

Returns:

  • (Array)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



328
329
330
331
332
# File 'lib/support_readiness/gitlab/projects.rb', line 328

def self.access_tokens(client, project)
  response = client.connection.get "projects/#{project.id}/access_tokens"
  handle_request_error(0, 'GitLab', response.status) unless response.status == 200
  Oj.load(response.body)
end

.all_members(client, project, filters = []) ⇒ Array

Lists all members in a project. This method can take a long time to run depending on the parameters used.

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
members = Readiness::GitLab::Projects.all_members(client, project)
pp members.first['username']
# => "alice_one"

Parameters:

  • client (Object)

    An instance of Client

  • project (Object)
  • filters (Array) (defaults to: [])

    An array of filter Strings to use. Should be in the format of key=value

Returns:

  • (Array)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/support_readiness/gitlab/projects.rb', line 420

def self.all_members(client, project, filters = [])
  array = []
  page = 1
  loop do
    response = client.connection.get "projects/#{project.id}/members/all?per_page=100&page=#{page}&#{to_param_string(filters)}"
    handle_request_error(0, 'GitLab', response.status) unless response.status == 200
    body = Oj.load(response.body)
    array += body
    break if body.count < 100

    page += 1
  end
  array
end

.create!(client, project) ⇒ Object

Creates a project within GitLab. This will exit on error

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.new
project.name = 'Test project'
project.path = 'jason-test-project
new_project = Readiness::GitLab::Projects.create!(client, project)
puts new_project.web_url
# => "https://gitlab.com/jason/jason-test-project"

Parameters:

Returns:

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.124



304
305
306
307
308
# File 'lib/support_readiness/gitlab/projects.rb', line 304

def self.create!(client, project)
  response = client.connection.post 'projects', to_clean_json(project)
  handle_request_error(1, 'GitLab', response.status, { action: 'Create project', id: '' }) unless response.status == 200
  Projects.new(Oj.load(response.body))
end

.create_badge!(client, project, params) ⇒ Hash

Creates a badge in a project.

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
bdge_params = {
  link_url: 'https://gitlab.com/gitlab-org/gitlab-foss/commits/main',
  image_url: 'https://shields.io/my/badge1',
  name: 'mybadge'
}
badge = Readiness::GitLab::Projects.create_badge!(client, project, bdge_params)
pp badge['id']
# => 7

Parameters:

  • client (Object)

    An instance of Client

  • project (Object)
  • params (Hash)

    The parameters to use to create the badge

Returns:

  • (Hash)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



483
484
485
486
487
# File 'lib/support_readiness/gitlab/projects.rb', line 483

def self.create_badge!(client, project, params)
  response = client.connection.post "projects/#{project.id}/badges", params.to_json
  handle_request_error(1, 'GitLab', response.status, { action: 'Create badge', id: project.id }) unless response.status == 200
  Oj.load(response.body)
end

.create_invitation!(client, project, data) ⇒ Array

Create a membership invitation for a project. This will exit on error

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
data = {
  email: 'bob@example.com',
  access_level: 50
}
invite = Readiness::GitLab::Projects.create_invitation!(client, project, data)
pp invite
# => {"status"=>"success"}
require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
data = {
  user_id: 123456,
  access_level: 40
}
invite = Readiness::GitLab::Projects.create_invitation!(client, project, data)
pp invite
# => {"status"=>"success"}

Parameters:

Returns:

  • (Array)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.124



685
686
687
688
689
# File 'lib/support_readiness/gitlab/projects.rb', line 685

def self.create_invitation!(client, project, data)
  response = client.connection.post "projects/#{project.id}/invitations", data.to_json
  handle_request_error(1, 'GitLab', response.status, { action: 'Invite people', id: project.id }) unless response.status == 200
  Oj.load(response.body)
end

.delete_badge!(client, project, bid) ⇒ Boolean

Deletes a badge in a project.

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
badge = Readiness::GitLab::Projects.delete_badge!(client, project, 7)
pp badge
# => true

Parameters:

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



537
538
539
540
541
# File 'lib/support_readiness/gitlab/projects.rb', line 537

def self.delete_badge!(client, project, bid)
  response = client.connection.delete "projects/#{project.id}/badges/#{bid}"
  handle_request_error(1, 'GitLab', response.status, { action: 'Delete badge', id: project.id }) unless response.status == 200
  true
end

.find(client, pid, attributes = []) ⇒ Hash

Locates a project within GitLab. This will not exit on error (except Authentication errors)

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find(client, 1083469)
pp project.web_url
# => "https://gitlab.com/gitlab-com/support/support-team-meta"

Parameters:

  • client (Object)

    An instance of Client

  • pid (Integer)

    The project ID to find

  • attributes (Array) (defaults to: [])

    An array of attribute Strings to use. Should be in the format of key=value

Returns:

  • (Hash)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



213
214
215
216
217
218
219
220
221
222
# File 'lib/support_readiness/gitlab/projects.rb', line 213

def self.find(client, pid,  attributes = [])
  response = client.connection.get("projects/#{pid}?#{to_param_string(attributes)}")
  if response.status == 301
    response = client.connection.get("projects/#{response.body.split('/').last}?#{to_param_string(attributes)}")
  end
  handle_request_error(0, 'GitLab', response.status,  { action: 'get', id: pid }) unless response.status == 200
  return Projects.new(Oj.load(response.body)) if response.status == 200

  Oj.load(response.body)
end

.find!(client, pid, attributes = []) ⇒ Object

Locates a project within GitLab. This will exit on error

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
pp project.web_url
# => "https://gitlab.com/gitlab-com/support/support-team-meta"

Parameters:

  • client (Object)

    An instance of Client

  • pid (Integer)

    The project ID to find

  • attributes (Array) (defaults to: [])

    An array of attribute Strings to use. Should be in the format of key=value

Returns:

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



242
243
244
245
246
247
248
249
# File 'lib/support_readiness/gitlab/projects.rb', line 242

def self.find!(client, pid, attributes = [])
  response = client.connection.get("projects/#{pid}?#{to_param_string(attributes)}")
  if response.status == 301
    response = client.connection.get("projects/#{response.body.split('/').last}?#{to_param_string(attributes)}")
  end
  handle_request_error(1, 'GitLab', response.status, { action: 'Find project', id: pid }) unless response.status == 200
  Projects.new(Oj.load(response.body))
end

.jobs(client, project, limit = 0, filters = []) ⇒ Array

Lists all project jobs. This is a wrapper of Jobs.list_project

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
pipeline = Readiness::GitLab::Pipelines.find!(client, project, 2)
jobs = Readiness::GitLab::Pipelines.jobs(client, pipeline, 2)
puts jobs.count
# => 187

Parameters:

  • client (Object)

    An instance of Client

  • project (Object)
  • limit (Integer) (defaults to: 0)

    The number of pages to stop at. Using 0 means to list all.

  • filters (Array) (defaults to: [])

    An array of filter Strings to use. Should be in the format of key=value

Returns:

  • (Array)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.13



623
624
625
# File 'lib/support_readiness/gitlab/projects.rb', line 623

def self.jobs(client, project, limit = 0, filters = [])
  Jobs.list_project(client, project, limit, filters)
end

.list(client, limit = 0, filters = []) ⇒ Array

Lists projects. Does not stop until it ends or the page limit is hit. This method can take a long time to run depending on the parameters used.

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
projects = Readiness::GitLab::Projects.list(client, 1)
pp projects.count
# => 100

Parameters:

  • client (Object)

    An instance of Client

  • limit (Integer) (defaults to: 0)

    The number of pages to stop at. Using 0 means to list all.

  • filters (Array) (defaults to: [])

    An array of filter Strings to use. Should be in the format of key=value

Returns:

  • (Array)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/support_readiness/gitlab/projects.rb', line 179

def self.list(client, limit = 0, filters = [])
  array = []
  url = "projects?per_page=100&pagination=keyset&order_by=id&sort=asc&id_after=0&#{to_param_string(filters)}"
  loop do
    response = client.connection.get url
    handle_request_error(0, 'GitLab', response.status) unless response.status == 200
    body = Oj.load(response.body)
    array += body.map { |p| Projects.new(p) }
    break if body.count < 100
    break if limit != 0 && array.count >= (limit * 100)

    url = "projects?per_page=100&pagination=keyset&order_by=id&sort=asc&id_after=#{body.last['id']}&#{to_param_string(filters)}"
  end
  array
end

.list_badges(client, project) ⇒ Array

Lists badges in a project.

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
badges = Readiness::GitLab::Projects.list_badges(client, project)
pp badges.first['name']
# => "Coverage"

Parameters:

Returns:

  • (Array)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



453
454
455
456
457
# File 'lib/support_readiness/gitlab/projects.rb', line 453

def self.list_badges(client, project)
  response = client.connection.get "projects/#{project.id}/badges"
  handle_request_error(0, 'GitLab', response.status) unless response.status == 200
  Oj.load(response.body)
end

.members(client, project, filters = []) ⇒ Array

Lists direct members in a project. This method can take a long time to run depending on the parameters used.

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
members = Readiness::GitLab::Projects.members(client, project)
pp members.first['username']
# => "jsmith"

Parameters:

  • client (Object)

    An instance of Client

  • project (Object)
  • filters (Array) (defaults to: [])

    An array of filter Strings to use. Should be in the format of key=value

Returns:

  • (Array)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/support_readiness/gitlab/projects.rb', line 385

def self.members(client, project, filters = [])
  array = []
  page = 1
  loop do
    response = client.connection.get "projects/#{project.id}/members?per_page=100&page=#{page}&#{to_param_string(filters)}"
    handle_request_error(0, 'GitLab', response.status) unless response.status == 200
    body = Oj.load(response.body)
    array += body
    break if body.count < 100

    page += 1
  end
  array
end

.milestones(client, project, filters = []) ⇒ Array

Lists all milestones in a project. This method can take a long time to run depending on the parameters used.

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
milestones = Readiness::GitLab::Projects.milestones(client, project)
pp milestones.count
# => 25

Parameters:

  • client (Object)

    An instance of Client

  • project (Object)
  • filters (Array) (defaults to: [])

    An array of filter Strings to use. Should be in the format of key=value

Returns:

  • (Array)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.12



563
564
565
566
567
568
569
570
571
572
573
574
575
576
# File 'lib/support_readiness/gitlab/projects.rb', line 563

def self.milestones(client, project, filters = [])
  array = []
  page = 1
  loop do
    response = client.connection.get "projects/#{project.id}/milestones?per_page=100&page=#{page}&#{to_param_string(filters)}"
    handle_request_error(0, 'GitLab', response.status) unless response.status == 200
    body = Oj.load(response.body)
    array += body
    break if body.count < 100

    page += 1
  end
  array
end

.pipelines(client, project, limit = 0, filters = []) ⇒ Array

Lists all pipelines for an object. This is a wrapper of Readiness::GitLab::Pipelines.list

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
pipelines = Readiness::GitLab::Projects.pipelines(client, project, 2, ["name=Check System", "status=failed"])
puts pipelines.first.web_url
# => "https://gitlab.com/gitlab-com/support/support-team-meta/-/pipelines/2"

Parameters:

  • client (Object)

    An instance of Client

  • project (Object)
  • limit (Integer) (defaults to: 0)

    The number of pages to stop at. Using 0 means to list all.

  • filters (Array) (defaults to: [])

    An array of filter Strings to use. Should be in the format of key=value

Returns:

  • (Array)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.13



598
599
600
# File 'lib/support_readiness/gitlab/projects.rb', line 598

def self.pipelines(client, project, limit = 0, filters = [])
  Pipelines.list(client, project, limit, filters)
end

.rotate_token!(client, project, tid, expiration = (Date.today + 1.year).iso8601) ⇒ Hash

Rotates an access token for a project (revokes it and makes a new one with the same user)

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
tokens = Readiness::GitLab::Projects.access_tokens(client, project)
tokens.select { |t| Date.parse(t['expires_at']) <= (Date.today + 5.days) }.each do |token|
  new_token = Readiness::GitLab::Projects.rotate_token!(client, project, token['id'])
  pp new_token['token']
end
# => "s3cr3t1"
# => "s3cr3t2"
# => "s3cr3t3"

Parameters:

  • client (Object)

    An instance of Client

  • project (Object)
  • tid (Integer)

    The access token ID to rotate

  • expiration (String) (defaults to: (Date.today + 1.year).iso8601)

    The expiration date to use (must be in ISO format)

Returns:

  • (Hash)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



359
360
361
362
363
# File 'lib/support_readiness/gitlab/projects.rb', line 359

def self.rotate_token!(client, project, tid, expiration = (Date.today + 1.year).iso8601)
  response = client.connection.post "projects/#{project.id}/access_tokens/#{tid}/rotate", { expires_at: expiration }.to_json
  handle_request_error(1, 'GitLab', response.status, { action: 'Rotate access token', id: project.id }) unless response.status == 200
  Oj.load(response.body)
end

.search(client, query) ⇒ Array

Search for a project by name. This method can take a long time to run depending on the number of results found.

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
projects = Readiness::GitLab::Projects.search(client, "support-team-meta")
pp projects.first.web_url
# => "https://gitlab.com/gitlab-com/support/support-team-meta"

Parameters:

  • client (Object)

    An instance of Client

  • query (String)

    The name to search for

Returns:

  • (Array)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/support_readiness/gitlab/projects.rb', line 269

def self.search(client, query)
  array = []
  url = "projects?per_page=100&pagination=keyset&order_by=id&sort=asc&id_after=0&search=#{query}"
  loop do
    response = client.connection.get url
    handle_request_error(0, 'GitLab', response.status) unless response.status == 200
    body = Oj.load(response.body)
    array += body.map { |p| Projects.new(p) }
    break if body.count < 100

    url = "projects?per_page=100&pagination=keyset&order_by=id&sort=asc&id_after=#{body.last['id']}&search=#{query}"
  end
  array
end

.update_badge!(client, project, bid, params) ⇒ Hash

Updates a badge in a project.

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
bdge_params = {
  image_url: 'https://shields.io/my/badge'
}
badge = Readiness::GitLab::Projects.update_badge!(client, project, 7, bdge_params)
pp badge['name']
# => "mybadge"

Parameters:

  • client (Object)

    An instance of Client

  • project (Object)
  • bid (Integer)

    The badge ID to update

  • params (Hash)

    The parameters to use to update the badge

Returns:

  • (Hash)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



512
513
514
515
516
# File 'lib/support_readiness/gitlab/projects.rb', line 512

def self.update_badge!(client, project, bid, params)
  response = client.connection.put "projects/#{project.id}/badges/#{bid}", params.to_json
  handle_request_error(1, 'GitLab', response.status, { action: 'Update badge', id: project.id }) unless response.status == 200
  Oj.load(response.body)
end

.webhooks(client, project) ⇒ Array

Lists all project webhooks. This is a wrapper of Readiness::GitLab::ProjectWebhooks.list

Examples:

require 'support_readiness'
config = Readiness::GitLab::Configuration.new
config.token = 'test123abc'
client = Readiness::GitLab::Client.new(config)
project = Readiness::GitLab::Projects.find!(client, 1083469)
hooks = Readiness::GitLab::Projects.webhooks(client, project)
puts hooks.count
# => 2

Parameters:

Returns:

  • (Array)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.124



645
646
647
# File 'lib/support_readiness/gitlab/projects.rb', line 645

def self.webhooks(client, project)
  ProjectWebhooks.list(client, project)
end