Class: Tenk::Users

Inherits:
Resource show all
Defined in:
lib/users.rb

Overview

API methods for User resource which represents a single person (even if they are not actually able to log in to 10k)

Defined Under Namespace

Classes: Assignments, CreateRequest, GetRequest, ListRequest, TimeEntries, UpdateRequest, UserResource

Instance Method Summary collapse

Methods inherited from Resource

#initialize, #resource_root

Constructor Details

This class inherits a constructor from Tenk::Resource

Instance Method Details

#assignmentsUsers::Assignments

An Assignment subresource of Users

Returns:



56
57
58
# File 'lib/users.rb', line 56

def assignments
  @_assignments ||= Users::Assignments.new(@_client)
end

#create(opts = {}) ⇒ Hashie::Mash

Create a User

Parameters:

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

    the attributes of the User to ceeate

Returns:

  • (Hashie::Mash)

    the API response as a Hashie::Mash

See Also:



87
88
89
# File 'lib/users.rb', line 87

def create(opts = {})
  super(CreateRequest.new(opts))
end

#get(id, opts = {}) ⇒ Hashie::Mash

Get a User

Parameters:

  • id (Integer)

    the id of the User to retrieve

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

    the params for the get request

Returns:

  • (Hashie::Mash)

    the API response as a Hashie::Mash

See Also:



79
80
81
# File 'lib/users.rb', line 79

def get(id, opts = {})
  super(id, GetRequest.new(opts))
end

#list(opts = {}) ⇒ Hashie::Mash

List Users

Parameters:

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

    the filter options for the list of Users

Returns:

  • (Hashie::Mash)

    the API response as a Hashie::Mash

See Also:



70
71
72
# File 'lib/users.rb', line 70

def list(opts = {})
  super(ListRequest.new(opts))
end

#tagsTenk::Tags

A TimeEntry subresource of Users

Returns:



62
63
64
# File 'lib/users.rb', line 62

def tags
  @_tags ||= Tenk::Tags.new(@_client)
end

#time_entriesUsers::TimeEntries

A TimeEntry subresource of Users

Returns:



50
51
52
# File 'lib/users.rb', line 50

def time_entries
  @_time_entries ||= Users::TimeEntries.new(@_client)
end

#update(id, opts = {}) ⇒ Hashie::Mash

Update a User

Parameters:

  • id (Integer)

    the id of the User to update

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

    the attributes of the User to update

Returns:

  • (Hashie::Mash)

    the API response as a Hashie::Mash

See Also:



96
97
98
# File 'lib/users.rb', line 96

def update(id, opts = {})
  super(id, UpdateRequest.new(opts))
end