Class: SemaphoreClient::Api::Team
- Inherits:
-
Object
- Object
- SemaphoreClient::Api::Team
- Defined in:
- lib/semaphore_client/api/team.rb
Instance Method Summary collapse
- #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
- #get(id, params = nil, options = {}) ⇒ Object
- #get!(id, params = nil, options = {}) ⇒ Object
-
#initialize(http_client) ⇒ Team
constructor
A new instance of Team.
- #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_secret(secret_id, params = nil, options = {}) ⇒ Object
- #list_for_secret!(secret_id, params = nil, options = {}) ⇒ Object
- #update(id, params = nil, options = {}) ⇒ Object
- #update!(id, params = nil, options = {}) ⇒ Object
Constructor Details
#initialize(http_client) ⇒ Team
Returns a new instance of Team.
4 5 6 |
# File 'lib/semaphore_client/api/team.rb', line 4 def initialize(http_client) @http_client = http_client end |
Instance Method Details
#create_for_org(org_id, params = nil, options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/semaphore_client/api/team.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/team.rb', line 27 def create_for_org!(org_id, params = nil, = {}) path = "/orgs/#{org_id}/teams" response = @http_client.post(path, params, ) SemaphoreClient::Model::Team.load(response.body) end |
#delete(id, params = nil, options = {}) ⇒ Object
50 51 52 53 |
# File 'lib/semaphore_client/api/team.rb', line 50 def delete(id, params = nil, = {}) delete!(id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#delete!(id, params = nil, options = {}) ⇒ Object
55 56 57 58 59 |
# File 'lib/semaphore_client/api/team.rb', line 55 def delete!(id, params = nil, = {}) path = "/teams/#{id}" @http_client.delete(path, params) end |
#get(id, params = nil, options = {}) ⇒ Object
36 37 38 39 |
# File 'lib/semaphore_client/api/team.rb', line 36 def get(id, params = nil, = {}) get!(id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#get!(id, params = nil, options = {}) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/semaphore_client/api/team.rb', line 41 def get!(id, params = nil, = {}) path = "/teams/#{id}" response = @http_client.get(path, params = {}) SemaphoreClient::Model::Team.load(response.body) end |
#list_for_org(org_id, params = nil, options = {}) ⇒ Object
9 10 11 12 |
# File 'lib/semaphore_client/api/team.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/team.rb', line 14 def list_for_org!(org_id, params = nil, = {}) path = "/orgs/#{org_id}/teams" @http_client.get(path, params, = {}).body.map { |e| SemaphoreClient::Model::Team.load(e) } end |
#list_for_project(project_id, params = nil, options = {}) ⇒ Object
77 78 79 80 |
# File 'lib/semaphore_client/api/team.rb', line 77 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
82 83 84 85 86 |
# File 'lib/semaphore_client/api/team.rb', line 82 def list_for_project!(project_id, params = nil, = {}) path = "/projects/#{project_id}/teams" @http_client.get(path, params, = {}).body.map { |e| SemaphoreClient::Model::Team.load(e) } end |
#list_for_secret(secret_id, params = nil, options = {}) ⇒ Object
90 91 92 93 |
# File 'lib/semaphore_client/api/team.rb', line 90 def list_for_secret(secret_id, params = nil, = {}) list_for_secret!(secret_id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#list_for_secret!(secret_id, params = nil, options = {}) ⇒ Object
95 96 97 98 99 |
# File 'lib/semaphore_client/api/team.rb', line 95 def list_for_secret!(secret_id, params = nil, = {}) path = "/secrets/#{secret_id}/teams" @http_client.get(path, params, = {}).body.map { |e| SemaphoreClient::Model::Team.load(e) } end |
#update(id, params = nil, options = {}) ⇒ Object
63 64 65 66 |
# File 'lib/semaphore_client/api/team.rb', line 63 def update(id, params = nil, = {}) update!(id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#update!(id, params = nil, options = {}) ⇒ Object
68 69 70 71 72 73 |
# File 'lib/semaphore_client/api/team.rb', line 68 def update!(id, params = nil, = {}) path = "/teams/#{id}" response = @http_client.patch(path, params) SemaphoreClient::Model::Team.load(response.body) end |