Class: SemaphoreClient::Api::Project
- Inherits:
-
Object
- Object
- SemaphoreClient::Api::Project
- Defined in:
- lib/semaphore_client/api/project.rb
Instance Method Summary collapse
- #attach_to_team(project_id, team_id, params = nil, options = {}) ⇒ Object
- #attach_to_team!(project_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
- #detach_from_team(project_id, team_id, params = nil, options = {}) ⇒ Object
- #detach_from_team!(project_id, team_id, params = nil, options = {}) ⇒ Object
-
#initialize(http_client) ⇒ Project
constructor
A new instance of Project.
- #list_for_org(org_id, params = nil, options = {}) ⇒ Object
- #list_for_org!(org_id, params = nil, options = {}) ⇒ Object
- #list_for_secret(secret_id, params = nil, options = {}) ⇒ Object
- #list_for_secret!(secret_id, params = nil, options = {}) ⇒ Object
- #list_for_team(team_id, params = nil, options = {}) ⇒ Object
- #list_for_team!(team_id, params = nil, options = {}) ⇒ Object
Constructor Details
#initialize(http_client) ⇒ Project
Returns a new instance of Project.
4 5 6 |
# File 'lib/semaphore_client/api/project.rb', line 4 def initialize(http_client) @http_client = http_client end |
Instance Method Details
#attach_to_team(project_id, team_id, params = nil, options = {}) ⇒ Object
49 50 51 52 |
# File 'lib/semaphore_client/api/project.rb', line 49 def attach_to_team(project_id, team_id, params = nil, = {}) attach_to_team!(project_id, team_id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#attach_to_team!(project_id, team_id, params = nil, options = {}) ⇒ Object
54 55 56 57 58 |
# File 'lib/semaphore_client/api/project.rb', line 54 def attach_to_team!(project_id, team_id, params = nil, = {}) path = "/teams/#{team_id}/projects/#{project_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/project.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/project.rb', line 27 def create_for_org!(org_id, params = nil, = {}) path = "/orgs/#{org_id}/projects" response = @http_client.post(path, params, ) SemaphoreClient::Model::Project.load(response.body) end |
#detach_from_team(project_id, team_id, params = nil, options = {}) ⇒ Object
62 63 64 65 |
# File 'lib/semaphore_client/api/project.rb', line 62 def detach_from_team(project_id, team_id, params = nil, = {}) detach_from_team!(project_id, team_id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#detach_from_team!(project_id, team_id, params = nil, options = {}) ⇒ Object
67 68 69 70 71 |
# File 'lib/semaphore_client/api/project.rb', line 67 def detach_from_team!(project_id, team_id, params = nil, = {}) path = "/teams/#{team_id}/projects/#{project_id}" @http_client.delete(path, params, ) end |
#list_for_org(org_id, params = nil, options = {}) ⇒ Object
9 10 11 12 |
# File 'lib/semaphore_client/api/project.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/project.rb', line 14 def list_for_org!(org_id, params = nil, = {}) path = "/orgs/#{org_id}/projects" @http_client.get(path, params, = {}).body.map { |e| SemaphoreClient::Model::Project.load(e) } end |
#list_for_secret(secret_id, params = nil, options = {}) ⇒ Object
75 76 77 78 |
# File 'lib/semaphore_client/api/project.rb', line 75 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
80 81 82 83 84 |
# File 'lib/semaphore_client/api/project.rb', line 80 def list_for_secret!(secret_id, params = nil, = {}) path = "/secrets/#{secret_id}/projects" @http_client.get(path, params, = {}).body.map { |e| SemaphoreClient::Model::Project.load(e) } end |
#list_for_team(team_id, params = nil, options = {}) ⇒ Object
36 37 38 39 |
# File 'lib/semaphore_client/api/project.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/project.rb', line 41 def list_for_team!(team_id, params = nil, = {}) path = "/teams/#{team_id}/projects" @http_client.get(path, params, = {}).body.map { |e| SemaphoreClient::Model::Project.load(e) } end |