Class: SupportOps::GitLab::GPGKeys
- Defined in:
- lib/support_ops_gitlab/gitlab/gpg_keys.rb
Overview
Get an GPG key for a user > docs.gitlab.com/api/user_keys/#get-a-gpg-key-for-a-user
Add an GPG key for a user > docs.gitlab.com/api/user_keys/#add-a-gpg-key-for-a-user
Delete an GPG key for a user > docs.gitlab.com/api/user_keys/#delete-n-gpg-key-for-a-user
Defines the class GPGKeys within the module SupportOps::GitLab.
Instance Attribute Summary collapse
-
#created_at ⇒ String
Timestamp for when the key was created.
-
#id ⇒ Integer
ID value of the key.
-
#key ⇒ String
Public key value.
Class Method Summary collapse
-
.list(key: value) ⇒ Array
Lists all GPG keys for a user.
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
#created_at ⇒ String
Timestamp for when the key was created
18 19 20 |
# File 'lib/support_ops_gitlab/gitlab/gpg_keys.rb', line 18 def created_at @created_at end |
#id ⇒ Integer
ID value of the key
18 19 20 |
# File 'lib/support_ops_gitlab/gitlab/gpg_keys.rb', line 18 def id @id end |
#key ⇒ String
Public key value
18 19 20 |
# File 'lib/support_ops_gitlab/gitlab/gpg_keys.rb', line 18 def key @key end |
Class Method Details
.list(key: value) ⇒ Array
Lists all GPG keys for a user
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/support_ops_gitlab/gitlab/gpg_keys.rb', line 48 def self.list(**args) args[:user_id] = nil unless args[:user_id] url = if args[:user_id].nil? 'user/gpg_keys' else "users/#{args[:user_id]}/gpg_keys" end response = client.connection.get(url) body = Oj.load(response.body) raise "Unable to get GPG keys of user => #{body}" if response.status != 200 body.map { |g| GPGKeys.new(g) } end |