Class: SemaphoreClient::Api::Secret
- Inherits:
-
Object
- Object
- SemaphoreClient::Api::Secret
- Defined in:
- lib/semaphore_client/api/secret.rb
Instance Method Summary collapse
- #attach_to_project(secret_id, project_id, params = nil, options = {}) ⇒ Object
- #attach_to_project!(secret_id, project_id, params = nil, options = {}) ⇒ Object
- #attach_to_team(secret_id, team_id, params = nil, options = {}) ⇒ Object
- #attach_to_team!(secret_id, team_id, params = nil, options = {}) ⇒ Object
- #create_for_org(org_id, params = nil, options = {}) ⇒ Object
- #create_for_org!(org_id, params = nil, options = {}) ⇒ Object
- #delete(id, params = nil, options = {}) ⇒ Object
- #delete!(id, params = nil, options = {}) ⇒ Object
- #detach_from_project(secret_id, project_id, params = nil, options = {}) ⇒ Object
- #detach_from_project!(secret_id, project_id, params = nil, options = {}) ⇒ Object
- #detach_from_team(secret_id, team_id, params = nil, options = {}) ⇒ Object
- #detach_from_team!(secret_id, team_id, params = nil, options = {}) ⇒ Object
- #get(id, params = nil, options = {}) ⇒ Object
- #get!(id, params = nil, options = {}) ⇒ Object
-
#initialize(http_client) ⇒ Secret
constructor
A new instance of Secret.
- #list_for_org(org_id, params = nil, options = {}) ⇒ Object
- #list_for_org!(org_id, params = nil, options = {}) ⇒ Object
- #list_for_project(project_id, params = nil, options = {}) ⇒ Object
- #list_for_project!(project_id, params = nil, options = {}) ⇒ Object
- #list_for_team(team_id, params = nil, options = {}) ⇒ Object
- #list_for_team!(team_id, params = nil, options = {}) ⇒ Object
- #update(id, params = nil, options = {}) ⇒ Object
- #update!(id, params = nil, options = {}) ⇒ Object
Constructor Details
#initialize(http_client) ⇒ Secret
Returns a new instance of Secret.
4 5 6 |
# File 'lib/semaphore_client/api/secret.rb', line 4 def initialize(http_client) @http_client = http_client end |
Instance Method Details
#attach_to_project(secret_id, project_id, params = nil, options = {}) ⇒ Object
88 89 90 91 |
# File 'lib/semaphore_client/api/secret.rb', line 88 def attach_to_project(secret_id, project_id, params = nil, = {}) attach_to_project!(secret_id, project_id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#attach_to_project!(secret_id, project_id, params = nil, options = {}) ⇒ Object
93 94 95 96 97 |
# File 'lib/semaphore_client/api/secret.rb', line 93 def attach_to_project!(secret_id, project_id, params = nil, = {}) path = "/projects/#{project_id}/secrets/#{secret_id}" @http_client.post(path, params, ) end |
#attach_to_team(secret_id, team_id, params = nil, options = {}) ⇒ Object
49 50 51 52 |
# File 'lib/semaphore_client/api/secret.rb', line 49 def attach_to_team(secret_id, team_id, params = nil, = {}) attach_to_team!(secret_id, team_id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#attach_to_team!(secret_id, team_id, params = nil, options = {}) ⇒ Object
54 55 56 57 58 |
# File 'lib/semaphore_client/api/secret.rb', line 54 def attach_to_team!(secret_id, team_id, params = nil, = {}) path = "/teams/#{team_id}/secrets/#{secret_id}" @http_client.post(path, params, ) end |
#create_for_org(org_id, params = nil, options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/semaphore_client/api/secret.rb', line 22 def create_for_org(org_id, params = nil, = {}) create_for_org!(org_id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#create_for_org!(org_id, params = nil, options = {}) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/semaphore_client/api/secret.rb', line 27 def create_for_org!(org_id, params = nil, = {}) path = "/orgs/#{org_id}/secrets" response = @http_client.post(path, params, ) SemaphoreClient::Model::Secret.load(response.body) end |
#delete(id, params = nil, options = {}) ⇒ Object
128 129 130 131 |
# File 'lib/semaphore_client/api/secret.rb', line 128 def delete(id, params = nil, = {}) delete!(id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#delete!(id, params = nil, options = {}) ⇒ Object
133 134 135 136 137 |
# File 'lib/semaphore_client/api/secret.rb', line 133 def delete!(id, params = nil, = {}) path = "/secrets/#{id}" @http_client.delete(path, params) end |
#detach_from_project(secret_id, project_id, params = nil, options = {}) ⇒ Object
101 102 103 104 |
# File 'lib/semaphore_client/api/secret.rb', line 101 def detach_from_project(secret_id, project_id, params = nil, = {}) detach_from_project!(secret_id, project_id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#detach_from_project!(secret_id, project_id, params = nil, options = {}) ⇒ Object
106 107 108 109 110 |
# File 'lib/semaphore_client/api/secret.rb', line 106 def detach_from_project!(secret_id, project_id, params = nil, = {}) path = "/projects/#{project_id}/secrets/#{secret_id}" @http_client.delete(path, params, ) end |
#detach_from_team(secret_id, team_id, params = nil, options = {}) ⇒ Object
62 63 64 65 |
# File 'lib/semaphore_client/api/secret.rb', line 62 def detach_from_team(secret_id, team_id, params = nil, = {}) detach_from_team!(secret_id, team_id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#detach_from_team!(secret_id, team_id, params = nil, options = {}) ⇒ Object
67 68 69 70 71 |
# File 'lib/semaphore_client/api/secret.rb', line 67 def detach_from_team!(secret_id, team_id, params = nil, = {}) path = "/teams/#{team_id}/secrets/#{secret_id}" @http_client.delete(path, params, ) end |
#get(id, params = nil, options = {}) ⇒ Object
114 115 116 117 |
# File 'lib/semaphore_client/api/secret.rb', line 114 def get(id, params = nil, = {}) get!(id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#get!(id, params = nil, options = {}) ⇒ Object
119 120 121 122 123 124 |
# File 'lib/semaphore_client/api/secret.rb', line 119 def get!(id, params = nil, = {}) path = "/secrets/#{id}" response = @http_client.get(path, params = {}) SemaphoreClient::Model::Secret.load(response.body) end |
#list_for_org(org_id, params = nil, options = {}) ⇒ Object
9 10 11 12 |
# File 'lib/semaphore_client/api/secret.rb', line 9 def list_for_org(org_id, params = nil, = {}) list_for_org!(org_id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#list_for_org!(org_id, params = nil, options = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/semaphore_client/api/secret.rb', line 14 def list_for_org!(org_id, params = nil, = {}) path = "/orgs/#{org_id}/secrets" @http_client.get(path, params, = {}).body.map { |e| SemaphoreClient::Model::Secret.load(e) } end |
#list_for_project(project_id, params = nil, options = {}) ⇒ Object
75 76 77 78 |
# File 'lib/semaphore_client/api/secret.rb', line 75 def list_for_project(project_id, params = nil, = {}) list_for_project!(project_id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#list_for_project!(project_id, params = nil, options = {}) ⇒ Object
80 81 82 83 84 |
# File 'lib/semaphore_client/api/secret.rb', line 80 def list_for_project!(project_id, params = nil, = {}) path = "/projects/#{project_id}/secrets" @http_client.get(path, params, = {}).body.map { |e| SemaphoreClient::Model::Secret.load(e) } end |
#list_for_team(team_id, params = nil, options = {}) ⇒ Object
36 37 38 39 |
# File 'lib/semaphore_client/api/secret.rb', line 36 def list_for_team(team_id, params = nil, = {}) list_for_team!(team_id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#list_for_team!(team_id, params = nil, options = {}) ⇒ Object
41 42 43 44 45 |
# File 'lib/semaphore_client/api/secret.rb', line 41 def list_for_team!(team_id, params = nil, = {}) path = "/teams/#{team_id}/secrets" @http_client.get(path, params, = {}).body.map { |e| SemaphoreClient::Model::Secret.load(e) } end |
#update(id, params = nil, options = {}) ⇒ Object
141 142 143 144 |
# File 'lib/semaphore_client/api/secret.rb', line 141 def update(id, params = nil, = {}) update!(id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#update!(id, params = nil, options = {}) ⇒ Object
146 147 148 149 150 151 |
# File 'lib/semaphore_client/api/secret.rb', line 146 def update!(id, params = nil, = {}) path = "/secrets/#{id}" response = @http_client.patch(path, params) SemaphoreClient::Model::Secret.load(response.body) end |