Module: Camper::Client::PeopleAPI

Included in:
Camper::Client
Defined in:
lib/camper/api/people.rb

Overview

Defines methods related to people.

Instance Method Summary collapse

Instance Method Details

#peoplePaginatedResponse<Resource>

Get all people visible to the current user



15
16
17
# File 'lib/camper/api/people.rb', line 15

def people
  get('/people')
end

#people_in_project(project) ⇒ PaginatedResponse<Resource>

Get all active people on the project with the given ID

Examples:

client.people_in_project(10)
client.people_in_project("20")
client.people_in_project(my_project)

Parameters:

  • project (Resource|Integer|String)

    A project resource or a project id

Returns:

See Also:



31
32
33
34
35
# File 'lib/camper/api/people.rb', line 31

def people_in_project(project)
  id = project.respond_to?(:id) ? project.id : project

  get("/projects/#{id}/people")
end

#person(id) ⇒ Resource

Get the profile for the user with the given ID

Examples:

client.person(234790)

Parameters:

  • id (Integer|String)

    A user id

Returns:

See Also:



83
84
85
# File 'lib/camper/api/people.rb', line 83

def person(id)
  get("/people/#{id}")
end

#pingable_peoplePaginatedResponse<Resource>

Get all people on this Basecamp account who can be pinged



71
72
73
# File 'lib/camper/api/people.rb', line 71

def pingable_people
  get('/circles/people')
end

#profileResource

Get the current user’s personal info.



94
95
96
# File 'lib/camper/api/people.rb', line 94

def profile
  get('/my/profile')
end

#update_access_in_project(project, options = {}) ⇒ Resource

Allows granting new and existing people access to a project, and revoking access from existing people.

Examples:

client.update_access_in_project(10, { grant: [102, 127] })
client.update_access_in_project("8634", { revoke: [300, 12527] })
client.update_access_in_project(my_project, {
  create: [{
    name: "Victor Copper",
    email_address: "[email protected]"
  }]
})

Parameters:

  • project (Resource|Integer|String)

    A project resource or a project id

  • options (Hash) (defaults to: {})

    options to update access, either grant, revoke or create new people

Returns:

Raises:

See Also:



56
57
58
59
60
61
62
# File 'lib/camper/api/people.rb', line 56

def update_access_in_project(project, options = {})
  raise Camper::Error::InvalidParameter, 'options cannot be empty' if options.empty?

  id = project.respond_to?(:id) ? project.id : project

  put("/projects/#{id}/people/users", body: { **options })
end