Class: Basecamp::Services::PeopleService
- Inherits:
-
BaseService
- Object
- BaseService
- Basecamp::Services::PeopleService
- Defined in:
- lib/basecamp/generated/services/people_service.rb
Overview
Service for People operations
Instance Method Summary collapse
-
#disable_out_of_office(person_id:) ⇒ void
Disable out of office for a person.
-
#enable_out_of_office(person_id:, out_of_office:) ⇒ Hash
Enable or replace out of office for a person.
-
#get(person_id:) ⇒ Hash
Get a person by ID.
-
#get_my_preferences ⇒ Hash
Get the current user's preferences.
-
#get_out_of_office(person_id:) ⇒ Hash
Get the out of office status for a person.
-
#list(page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List all people visible to the current user.
-
#list_assignable ⇒ Array<Hash>
List people who can be assigned todos.
-
#list_for_project(project_id:, page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List all active people on a project.
-
#list_pingable(max_items: nil) ⇒ ListEnumerator<Hash>
List all account users who can be pinged.
-
#my_profile ⇒ Hash
Get the current authenticated user's profile.
-
#update_my_preferences(person:) ⇒ Hash
Update the current user's preferences.
-
#update_my_profile(name: nil, email_address: nil, title: nil, bio: nil, location: nil, time_zone_name: nil, first_week_day: nil, time_format: nil) ⇒ void
Update the current authenticated user's profile (returns 204 No Content).
-
#update_project_access(project_id:, grant: nil, revoke: nil, create: nil) ⇒ Hash
Update project access (grant/revoke/create people).
Constructor Details
This class inherits a constructor from Basecamp::Services::BaseService
Instance Method Details
#disable_out_of_office(person_id:) ⇒ void
This method returns an undefined value.
Disable out of office for a person.
103 104 105 106 107 108 |
# File 'lib/basecamp/generated/services/people_service.rb', line 103 def disable_out_of_office(person_id:) with_operation(service: "people", operation: "disable_out_of_office", is_mutation: true, resource_id: person_id) do http_delete("/people/#{person_id}/out_of_office.json") nil end end |
#enable_out_of_office(person_id:, out_of_office:) ⇒ Hash
Enable or replace out of office for a person.
94 95 96 97 98 |
# File 'lib/basecamp/generated/services/people_service.rb', line 94 def enable_out_of_office(person_id:, out_of_office:) with_operation(service: "people", operation: "enable_out_of_office", is_mutation: true, resource_id: person_id) do http_post("/people/#{person_id}/out_of_office.json", body: compact_params(out_of_office: out_of_office)).json end end |
#get(person_id:) ⇒ Hash
Get a person by ID
75 76 77 78 79 |
# File 'lib/basecamp/generated/services/people_service.rb', line 75 def get(person_id:) with_operation(service: "people", operation: "get", is_mutation: false, resource_id: person_id) do http_get("/people/#{person_id}", operation: "GetPerson").json end end |
#get_my_preferences ⇒ Hash
Get the current user's preferences
21 22 23 24 25 |
# File 'lib/basecamp/generated/services/people_service.rb', line 21 def get_my_preferences() with_operation(service: "people", operation: "get_my_preferences", is_mutation: false) do http_get("/my/preferences.json", operation: "GetMyPreferences").json end end |
#get_out_of_office(person_id:) ⇒ Hash
Get the out of office status for a person
84 85 86 87 88 |
# File 'lib/basecamp/generated/services/people_service.rb', line 84 def get_out_of_office(person_id:) with_operation(service: "people", operation: "get_out_of_office", is_mutation: false, resource_id: person_id) do http_get("/people/#{person_id}/out_of_office.json", operation: "GetOutOfOffice").json end end |
#list(page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List all people visible to the current user
65 66 67 68 69 70 |
# File 'lib/basecamp/generated/services/people_service.rb', line 65 def list(page: nil, max_items: nil) wrap_paginated(service: "people", operation: "list", is_mutation: false) do params = compact_query_params(page: page) paginate("/people.json", params: params, operation: "ListPeople", max_items: max_items) end end |
#list_assignable ⇒ Array<Hash>
List people who can be assigned todos
136 137 138 139 140 |
# File 'lib/basecamp/generated/services/people_service.rb', line 136 def list_assignable() with_operation(service: "people", operation: "list_assignable", is_mutation: false) do http_get("/reports/todos/assigned.json", operation: "ListAssignablePeople").json end end |
#list_for_project(project_id:, page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List all active people on a project
115 116 117 118 119 120 |
# File 'lib/basecamp/generated/services/people_service.rb', line 115 def list_for_project(project_id:, page: nil, max_items: nil) wrap_paginated(service: "people", operation: "list_for_project", is_mutation: false, project_id: project_id) do params = compact_query_params(page: page) paginate("/projects/#{project_id}/people.json", params: params, operation: "ListProjectPeople", max_items: max_items) end end |
#list_pingable(max_items: nil) ⇒ ListEnumerator<Hash>
List all account users who can be pinged
13 14 15 16 17 |
# File 'lib/basecamp/generated/services/people_service.rb', line 13 def list_pingable(max_items: nil) wrap_paginated(service: "people", operation: "list_pingable", is_mutation: false) do paginate("/circles/people.json", operation: "ListPingablePeople", max_items: max_items) end end |
#my_profile ⇒ Hash
Get the current authenticated user's profile
38 39 40 41 42 |
# File 'lib/basecamp/generated/services/people_service.rb', line 38 def my_profile() with_operation(service: "people", operation: "my_profile", is_mutation: false) do http_get("/my/profile.json", operation: "GetMyProfile").json end end |
#update_my_preferences(person:) ⇒ Hash
Update the current user's preferences.
30 31 32 33 34 |
# File 'lib/basecamp/generated/services/people_service.rb', line 30 def update_my_preferences(person:) with_operation(service: "people", operation: "update_my_preferences", is_mutation: true) do http_put("/my/preferences.json", body: compact_params(person: person)).json end end |
#update_my_profile(name: nil, email_address: nil, title: nil, bio: nil, location: nil, time_zone_name: nil, first_week_day: nil, time_format: nil) ⇒ void
This method returns an undefined value.
Update the current authenticated user's profile (returns 204 No Content)
54 55 56 57 58 59 |
# File 'lib/basecamp/generated/services/people_service.rb', line 54 def update_my_profile(name: nil, email_address: nil, title: nil, bio: nil, location: nil, time_zone_name: nil, first_week_day: nil, time_format: nil) with_operation(service: "people", operation: "update_my_profile", is_mutation: true) do http_put("/my/profile.json", body: compact_params(name: name, email_address: email_address, title: title, bio: bio, location: location, time_zone_name: time_zone_name, first_week_day: first_week_day, time_format: time_format)) nil end end |
#update_project_access(project_id:, grant: nil, revoke: nil, create: nil) ⇒ Hash
Update project access (grant/revoke/create people)
128 129 130 131 132 |
# File 'lib/basecamp/generated/services/people_service.rb', line 128 def update_project_access(project_id:, grant: nil, revoke: nil, create: nil) with_operation(service: "people", operation: "update_project_access", is_mutation: true, project_id: project_id) do http_put("/projects/#{project_id}/people/users.json", body: compact_params(grant: grant, revoke: revoke, create: create)).json end end |