Class: Basecamp::Services::PeopleService

Inherits:
BaseService show all
Defined in:
lib/basecamp/generated/services/people_service.rb

Overview

Service for People operations

Instance Method Summary collapse

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.

Parameters:

  • person_id (Integer)

    person id ID



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.

Parameters:

  • person_id (Integer)

    person id ID

  • out_of_office (Hash)

    out of office

Returns:

  • (Hash)

    response data



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

Parameters:

  • person_id (Integer)

    person id ID

Returns:

  • (Hash)

    response data



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_preferencesHash

Get the current user's preferences

Returns:

  • (Hash)

    response data



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

Parameters:

  • person_id (Integer)

    person id ID

Returns:

  • (Hash)

    response data



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

Parameters:

  • page (Integer, nil) (defaults to: nil)

    Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.

  • max_items (Integer, nil) (defaults to: nil)

    cap on items yielded across pages; nil or non-positive means no cap

Returns:

  • (ListEnumerator<Hash>)

    lazily paginated results (#meta carries pagination metadata)



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_assignableArray<Hash>

List people who can be assigned todos

Returns:

  • (Array<Hash>)

    response data



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

Parameters:

  • project_id (Integer)

    project id ID

  • page (Integer, nil) (defaults to: nil)

    Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.

  • max_items (Integer, nil) (defaults to: nil)

    cap on items yielded across pages; nil or non-positive means no cap

Returns:

  • (ListEnumerator<Hash>)

    lazily paginated results (#meta carries pagination metadata)



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

Parameters:

  • max_items (Integer, nil) (defaults to: nil)

    cap on items yielded across pages; nil or non-positive means no cap

Returns:

  • (ListEnumerator<Hash>)

    lazily paginated results (#meta carries pagination metadata)



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_profileHash

Get the current authenticated user's profile

Returns:

  • (Hash)

    response data



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.

Parameters:

  • person (Hash)

    person

Returns:

  • (Hash)

    response data



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)

Parameters:

  • name (String, nil) (defaults to: nil)

    name

  • email_address (String, nil) (defaults to: nil)

    email address

  • title (String, nil) (defaults to: nil)

    title

  • bio (String, nil) (defaults to: nil)

    bio

  • location (String, nil) (defaults to: nil)

    location

  • time_zone_name (String, nil) (defaults to: nil)

    time zone name

  • first_week_day (String, nil) (defaults to: nil)

    first week day

  • time_format (String, nil) (defaults to: nil)

    time format



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)

Parameters:

  • project_id (Integer)

    project id ID

  • grant (Array, nil) (defaults to: nil)

    grant

  • revoke (Array, nil) (defaults to: nil)

    revoke

  • create (Array, nil) (defaults to: nil)

    create

Returns:

  • (Hash)

    response data



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