Class: SupportOps::GitLab::ProjectWebhooks
- Defined in:
- lib/support_ops_gitlab/gitlab/project_webhooks.rb
Overview
Anything list at docs.gitlab.com/api/project_webhooks
Document save!
Document delete!
Document events
Defines the class ProjectWebhooks within the module SupportOps::GitLab.
Instance Attribute Summary collapse
-
#alert_status ⇒ String
The current value of alert_status.
-
#branch_filter_strategy ⇒ String
Filter push events by branch; possible values are wildcard (default), regex, and all_branches.
-
#confidential_issues_events ⇒ Boolean
The current value of confidential_issues_events.
-
#confidential_note_events ⇒ Boolean
The current value of confidential_note_events.
-
#created_at ⇒ String
The current value of created_at.
-
#custom_headers ⇒ Array
The current value of custom_headers.
-
#custom_webhook_template ⇒ String
The current value of custom_webhook_template.
-
#deployment_events ⇒ Boolean
The current value of deployment_events.
-
#description ⇒ String
The current value of description.
-
#disabled_until ⇒ String
The current value of disabled_until.
-
#enable_ssl_verification ⇒ Boolean
The current value of enable_ssl_verification.
-
#feature_flag_events ⇒ Boolean
The current value of feature_flag_events.
-
#id ⇒ Integer
The current value of id.
-
#issues_events ⇒ Boolean
The current value of issues_events.
-
#job_events ⇒ Boolean
The current value of job_events.
-
#merge_requests_events ⇒ Boolean
The current value of merge_requests_events.
-
#name ⇒ String
The current value of name.
-
#note_events ⇒ Boolean
The current value of note_events.
-
#pipeline_events ⇒ Boolean
The current value of pipeline_events.
-
#project_id ⇒ Integer
The current value of project_id.
-
#push_events ⇒ Boolean
The current value of push_events.
-
#push_events_branch_filter ⇒ String
The current value of push_events_branch_filter.
-
#releases_events ⇒ Boolean
The current value of releases_events.
-
#repository_update_events ⇒ Boolean
The current value of repository_update_events.
-
#resource_access_token_events ⇒ Boolean
The current value of resource_access_token_events.
-
#tag_push_events ⇒ Boolean
The current value of tag_push_events.
-
#token ⇒ String
Secret token to validate received payloads; the token isn’t returned in the response (creates/updates only).
-
#url ⇒ String
The current value of url.
-
#url_variables ⇒ Array
The current value of url_variables.
-
#wiki_page_events ⇒ Boolean
The current value of wiki_page_events.
Class Method Summary collapse
-
.get(object) ⇒ Object
Get a project webhook.
-
.get!(object) ⇒ Object
Get a project webhook.
-
.list(key: value) ⇒ Array
List webhooks for a project.
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
#alert_status ⇒ String
Returns the current value of alert_status.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def alert_status @alert_status end |
#branch_filter_strategy ⇒ String
Filter push events by branch; possible values are wildcard (default), regex, and all_branches
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def branch_filter_strategy @branch_filter_strategy end |
#confidential_issues_events ⇒ Boolean
Returns the current value of confidential_issues_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def confidential_issues_events @confidential_issues_events end |
#confidential_note_events ⇒ Boolean
Returns the current value of confidential_note_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def confidential_note_events @confidential_note_events end |
#created_at ⇒ String
Returns the current value of created_at.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def created_at @created_at end |
#custom_headers ⇒ Array
Returns the current value of custom_headers.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def custom_headers @custom_headers end |
#custom_webhook_template ⇒ String
Returns the current value of custom_webhook_template.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def custom_webhook_template @custom_webhook_template end |
#deployment_events ⇒ Boolean
Returns the current value of deployment_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def deployment_events @deployment_events end |
#description ⇒ String
Returns the current value of description.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def description @description end |
#disabled_until ⇒ String
Returns the current value of disabled_until.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def disabled_until @disabled_until end |
#enable_ssl_verification ⇒ Boolean
Returns the current value of enable_ssl_verification.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def enable_ssl_verification @enable_ssl_verification end |
#feature_flag_events ⇒ Boolean
Returns the current value of feature_flag_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def feature_flag_events @feature_flag_events end |
#id ⇒ Integer
Returns the current value of id.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def id @id end |
#issues_events ⇒ Boolean
Returns the current value of issues_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def issues_events @issues_events end |
#job_events ⇒ Boolean
Returns the current value of job_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def job_events @job_events end |
#merge_requests_events ⇒ Boolean
Returns the current value of merge_requests_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def merge_requests_events @merge_requests_events end |
#name ⇒ String
Returns the current value of name.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def name @name end |
#note_events ⇒ Boolean
Returns the current value of note_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def note_events @note_events end |
#pipeline_events ⇒ Boolean
Returns the current value of pipeline_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def pipeline_events @pipeline_events end |
#project_id ⇒ Integer
Returns the current value of project_id.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def project_id @project_id end |
#push_events ⇒ Boolean
Returns the current value of push_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def push_events @push_events end |
#push_events_branch_filter ⇒ String
Returns the current value of push_events_branch_filter.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def push_events_branch_filter @push_events_branch_filter end |
#releases_events ⇒ Boolean
Returns the current value of releases_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def releases_events @releases_events end |
#repository_update_events ⇒ Boolean
Returns the current value of repository_update_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def repository_update_events @repository_update_events end |
#resource_access_token_events ⇒ Boolean
Returns the current value of resource_access_token_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def resource_access_token_events @resource_access_token_events end |
#tag_push_events ⇒ Boolean
Returns the current value of tag_push_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def tag_push_events @tag_push_events end |
#token ⇒ String
Secret token to validate received payloads; the token isn’t returned in the response (creates/updates only)
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def token @token end |
#url ⇒ String
Returns the current value of url.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def url @url end |
#url_variables ⇒ Array
Returns the current value of url_variables.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def url_variables @url_variables end |
#wiki_page_events ⇒ Boolean
Returns the current value of wiki_page_events.
46 47 48 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 46 def wiki_page_events @wiki_page_events end |
Class Method Details
.get(object) ⇒ Object
Get a project webhook
122 123 124 125 126 127 128 129 130 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 122 def self.get(object) if object.is_a? ProjectWebhooks ProjectWebhooks.new(id: id, project_id: project_id).find elsif object.is_a? Hash ProjectWebhooks.new({ id: object[:id], project_id: object[:project_id] }).find else raise 'You need an id and a project_id attribute' end end |
.get!(object) ⇒ Object
Get a project webhook
152 153 154 155 156 157 158 159 160 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 152 def self.get!(object) if object.is_a? ProjectWebhooks ProjectWebhooks.new(id: id, project_id: project_id).find! elsif object.is_a? Hash ProjectWebhooks.new({ id: object[:id], project_id: object[:project_id] }).find! else raise 'You need an id and a project_id attribute' end end |
.list(key: value) ⇒ Array
List webhooks for a project
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/support_ops_gitlab/gitlab/project_webhooks.rb', line 86 def self.list(**args) args[:project_id] = nil unless args[:project_id] raise 'You have to provide a project_id' if args[:project_id].nil? array = [] page = 1 loop do response = client.connection.get("projects/#{args[:args[:project_id]]}/hooks?per_page=100&page=#{page}") body = Oj.load(response.body) array += body.map { |w| ProjectWebhooks(w) } break if body.count < 100 page += 1 end array end |