Class: Vx::ServiceConnector::GitlabV5::DeployKeys
- Inherits:
-
Struct
- Object
- Struct
- Vx::ServiceConnector::GitlabV5::DeployKeys
show all
- Defined in:
- lib/vx/service_connector/gitlab_v5/deploy_keys.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#repo ⇒ Object
Returns the value of attribute repo
4
5
6
|
# File 'lib/vx/service_connector/gitlab_v5/deploy_keys.rb', line 4
def repo
@repo
end
|
#session ⇒ Object
Returns the value of attribute session
4
5
6
|
# File 'lib/vx/service_connector/gitlab_v5/deploy_keys.rb', line 4
def session
@session
end
|
Instance Method Details
#all ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/vx/service_connector/gitlab_v5/deploy_keys.rb', line 6
def all
begin
session.get "/projects/#{repo.id}/keys"
rescue RequestError
[]
end
end
|
#create(key_name, public_key) ⇒ Object
14
15
16
|
# File 'lib/vx/service_connector/gitlab_v5/deploy_keys.rb', line 14
def create(key_name, public_key)
session.post "/projects/#{repo.id}/keys", title: key_name, key: public_key
end
|
#destroy(key_name) ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/vx/service_connector/gitlab_v5/deploy_keys.rb', line 18
def destroy(key_name)
all.select do |key|
key.title == key_name
end.map do |key|
session.delete "/projects/#{repo.id}/keys/#{key.id}"
end
end
|