Class: Tenk::Users::Assignments

Inherits:
UserResource show all
Defined in:
lib/users/assignments.rb

Overview

The API methods for Assignments, which record that a particular person is assigned to a user or phase

Defined Under Namespace

Classes: CreateRequest, GetRequest, ListRequest, UpdateRequest

Instance Method Summary collapse

Methods inherited from UserResource

#initialize, #resource_root

Constructor Details

This class inherits a constructor from Tenk::Users::UserResource

Instance Method Details

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

Create a new Assignment for this user

Parameters:

  • user_id (Integer)

    the id of the user

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

    the post parameters to add to the create request

Returns:

  • (Hashie::Mash)

    the API response as a Hashie::Mash

See Also:



60
61
62
# File 'lib/users/assignments.rb', line 60

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

#delete(user_id, assignment_id) ⇒ bool

Delete an Assignment for this user

Parameters:

  • user_id (Integer)

    the id of the user

  • assignment_id (Integer)

    the id of the assignment

Returns:

  • (bool)

    true if successful



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

def delete(user_id, assignment_id)
  super(user_id, assignment_id)
end

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

Get a single Assignment for this user

Parameters:

  • user_id (Integer)

    the id of the user

  • assignment_id (Integer)

    the id of the assignment

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

    the query parameters to add to the get request

Returns:

  • (Hashie::Mash)

    the response as a Hashie::Mash

See Also:



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

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

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

List Assignments for a single user

Parameters:

  • user_id (Integer)

    the id of the user

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

    the query parameters to add to list request

Returns:

  • (Hashie::Mash)

    the API response as a Hashie::Mash

See Also:



41
42
43
# File 'lib/users/assignments.rb', line 41

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

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

Update an Assignment for this user

Parameters:

  • user_id (Integer)

    the id of the user

  • assignment_id (Integer)

    the id of the assignment

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

    the post parameters to add to the create request

Returns:

  • (Hashie::Mash)

    the API response as a Hashie::Mash

See Also:



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

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