Class: SemaphoreClient::Api::User
- Inherits:
-
Object
- Object
- SemaphoreClient::Api::User
- Defined in:
- lib/semaphore_client/api/user.rb
Instance Method Summary collapse
- #attach_to_team(user_id, team_id, params = nil, options = {}) ⇒ Object
- #attach_to_team!(user_id, team_id, params = nil, options = {}) ⇒ Object
- #detach_from_team(user_id, team_id, params = nil, options = {}) ⇒ Object
- #detach_from_team!(user_id, team_id, params = nil, options = {}) ⇒ Object
-
#initialize(http_client) ⇒ User
constructor
A new instance of User.
- #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
Constructor Details
#initialize(http_client) ⇒ User
Returns a new instance of User.
4 5 6 |
# File 'lib/semaphore_client/api/user.rb', line 4 def initialize(http_client) @http_client = http_client end |
Instance Method Details
#attach_to_team(user_id, team_id, params = nil, options = {}) ⇒ Object
35 36 37 38 |
# File 'lib/semaphore_client/api/user.rb', line 35 def attach_to_team(user_id, team_id, params = nil, = {}) attach_to_team!(user_id, team_id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#attach_to_team!(user_id, team_id, params = nil, options = {}) ⇒ Object
40 41 42 43 44 |
# File 'lib/semaphore_client/api/user.rb', line 40 def attach_to_team!(user_id, team_id, params = nil, = {}) path = "/teams/#{team_id}/users/#{user_id}" @http_client.post(path, params, ) end |
#detach_from_team(user_id, team_id, params = nil, options = {}) ⇒ Object
48 49 50 51 |
# File 'lib/semaphore_client/api/user.rb', line 48 def detach_from_team(user_id, team_id, params = nil, = {}) detach_from_team!(user_id, team_id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#detach_from_team!(user_id, team_id, params = nil, options = {}) ⇒ Object
53 54 55 56 57 |
# File 'lib/semaphore_client/api/user.rb', line 53 def detach_from_team!(user_id, team_id, params = nil, = {}) path = "/teams/#{team_id}/users/#{user_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/user.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/user.rb', line 14 def list_for_org!(org_id, params = nil, = {}) path = "/orgs/#{org_id}/users" @http_client.get(path, params, = {}).body.map { |e| SemaphoreClient::Model::User.load(e) } end |
#list_for_project(project_id, params = nil, options = {}) ⇒ Object
61 62 63 64 |
# File 'lib/semaphore_client/api/user.rb', line 61 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
66 67 68 69 70 |
# File 'lib/semaphore_client/api/user.rb', line 66 def list_for_project!(project_id, params = nil, = {}) path = "/projects/#{project_id}/users" @http_client.get(path, params, = {}).body.map { |e| SemaphoreClient::Model::User.load(e) } end |
#list_for_team(team_id, params = nil, options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/semaphore_client/api/user.rb', line 22 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
27 28 29 30 31 |
# File 'lib/semaphore_client/api/user.rb', line 27 def list_for_team!(team_id, params = nil, = {}) path = "/teams/#{team_id}/users" @http_client.get(path, params, = {}).body.map { |e| SemaphoreClient::Model::User.load(e) } end |