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



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.

Parameters:

  • person_id (Integer)

    person id ID

  • out_of_office (Hash)

    out of office

Returns:

  • (Hash)

    response data



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

Parameters:

  • person_id (Integer)

    person id ID

Returns:

  • (Hash)

    response data



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_preferencesHash

Get the current user's preferences

Returns:

  • (Hash)

    response data



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

Parameters:

  • person_id (Integer)

    person id ID

Returns:

  • (Hash)

    response data



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

#listEnumerator<Hash>

List all people visible to the current user

Returns:

  • (Enumerator<Hash>)

    paginated results



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_assignableHash

List people who can be assigned todos

Returns:

  • (Hash)

    response data



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

Parameters:

  • project_id (Integer)

    project id ID

Returns:

  • (Enumerator<Hash>)

    paginated results



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

List all account users who can be pinged

Returns:

  • (Enumerator<Hash>)

    paginated results



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_profileHash

Get the current authenticated user's profile

Returns:

  • (Hash)

    response data



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

Parameters:

  • person (Hash)

    person

Returns:

  • (Hash)

    response data



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)

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



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)

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



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