Class: SupportOps::GitLab::Invitations
- Defined in:
- lib/support_ops_gitlab/gitlab/invitations.rb
Overview
Add attributes
Stuff at docs.gitlab.com/api/invitations/
Defines the class Invitations within the module SupportOps::GitLab.
Class Method Summary collapse
-
.create!(item_id, type, data) ⇒ Array
Create a membership invitation 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
Class Method Details
.create!(item_id, type, data) ⇒ Array
Create a membership invitation for a project. This will exit on error
61 62 63 64 65 66 67 |
# File 'lib/support_ops_gitlab/gitlab/invitations.rb', line 61 def self.create!(item_id, type, data) raise "This only works for a project or group, not a #{type}" unless %w[project group].include? type.downcase.singularize response = client.connection.post("#{type.downcase.pluralize}/#{item_id}/invitations", data.to_json) body = Oj.load(response.body) raise "Failed to create invites => #{body}" unless response.status == 200 body end |