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 ⇒ Enumerator<Hash>
List all people visible to the current user.
-
#list_assignable ⇒ Hash
List people who can be assigned todos.
-
#list_for_project(project_id:) ⇒ Enumerator<Hash>
List all active people on a project.
-
#list_pingable ⇒ Enumerator<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.
99 100 101 102 103 104 |
# File 'lib/basecamp/generated/services/people_service.rb', line 99 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.
90 91 92 93 94 |
# File 'lib/basecamp/generated/services/people_service.rb', line 90 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
71 72 73 74 75 |
# File 'lib/basecamp/generated/services/people_service.rb', line 71 def get(person_id:) with_operation(service: "people", operation: "get", is_mutation: false, resource_id: person_id) do http_get("/people/#{person_id}").json end end |
#get_my_preferences ⇒ Hash
Get the current user's preferences
20 21 22 23 24 |
# File 'lib/basecamp/generated/services/people_service.rb', line 20 def get_my_preferences() with_operation(service: "people", operation: "get_my_preferences", is_mutation: false) do http_get("/my/preferences.json").json end end |
#get_out_of_office(person_id:) ⇒ Hash
Get the out of office status for a person
80 81 82 83 84 |
# File 'lib/basecamp/generated/services/people_service.rb', line 80 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").json end end |
#list ⇒ Enumerator<Hash>
List all people visible to the current user
62 63 64 65 66 |
# File 'lib/basecamp/generated/services/people_service.rb', line 62 def list() wrap_paginated(service: "people", operation: "list", is_mutation: false) do paginate("/people.json") end end |
#list_assignable ⇒ Hash
List people who can be assigned todos
129 130 131 132 133 |
# File 'lib/basecamp/generated/services/people_service.rb', line 129 def list_assignable() with_operation(service: "people", operation: "list_assignable", is_mutation: false) do http_get("/reports/todos/assigned.json").json end end |
#list_for_project(project_id:) ⇒ Enumerator<Hash>
List all active people on a project
109 110 111 112 113 |
# File 'lib/basecamp/generated/services/people_service.rb', line 109 def list_for_project(project_id:) wrap_paginated(service: "people", operation: "list_for_project", is_mutation: false, project_id: project_id) do paginate("/projects/#{project_id}/people.json") end end |
#list_pingable ⇒ Enumerator<Hash>
List all account users who can be pinged
12 13 14 15 16 |
# File 'lib/basecamp/generated/services/people_service.rb', line 12 def list_pingable() wrap_paginated(service: "people", operation: "list_pingable", is_mutation: false) do paginate("/circles/people.json") end end |
#my_profile ⇒ Hash
Get the current authenticated user's profile
37 38 39 40 41 |
# File 'lib/basecamp/generated/services/people_service.rb', line 37 def my_profile() with_operation(service: "people", operation: "my_profile", is_mutation: false) do http_get("/my/profile.json").json end end |
#update_my_preferences(person:) ⇒ Hash
Update the current user's preferences
29 30 31 32 33 |
# File 'lib/basecamp/generated/services/people_service.rb', line 29 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)
53 54 55 56 57 58 |
# File 'lib/basecamp/generated/services/people_service.rb', line 53 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)
121 122 123 124 125 |
# File 'lib/basecamp/generated/services/people_service.rb', line 121 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 |