Class: Cadenya::Resources::Objectives::Tasks

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/resources/objectives/tasks.rb,
sig/cadenya/resources/objectives/tasks.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Tasks

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Tasks.

Parameters:



78
79
80
# File 'lib/cadenya/resources/objectives/tasks.rb', line 78

def initialize(client:)
  @client = client
end

Instance Method Details

#list(objective_id, workspace_id: nil, cursor: nil, limit: nil, sort_order: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Objectives::ObjectiveTask>

Some parameter documentations has been truncated, see Models::Objectives::TaskListParams for more details.

Lists all tasks for an objective

Parameters:

  • objective_id (String)

    Path param: The ID of the objective. Supports "external_id:" prefix for external

  • workspace_id (String)

    Path param

  • cursor (String)

    Query param: Pagination cursor from previous response

  • limit (Integer)

    Query param: Maximum number of results to return

  • sort_order (String)

    Query param: Sort order for results

  • request_options (Cadenya::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/cadenya/resources/objectives/tasks.rb', line 58

def list(objective_id, params = {})
  parsed, options = Cadenya::Objectives::TaskListParams.dump_request(params)
  query = Cadenya::Internal::Util.encode_query_params(parsed)
  workspace_id =
    parsed.delete(:workspace_id) do
      @client.workspace_id
    end
  @client.request(
    method: :get,
    path: ["v1/workspaces/%1$s/objectives/%2$s/tasks", workspace_id, objective_id],
    query: query.transform_keys(sort_order: "sortOrder"),
    page: Cadenya::Internal::CursorPagination,
    model: Cadenya::Objectives::ObjectiveTask,
    options: options
  )
end

#retrieve(objective_id, id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveTask

Retrieves a task by ID from an objective

Parameters:

  • objective_id (String)

    The ID of the objective. Supports "external_id:" prefix for external IDs.

  • id (String)

    Task ID

  • workspace_id (String)
  • request_options (Cadenya::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cadenya/resources/objectives/tasks.rb', line 22

def retrieve(objective_id, id, params = {})
  parsed, options = Cadenya::Objectives::TaskRetrieveParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      @client.workspace_id
    end
  @client.request(
    method: :get,
    path: ["v1/workspaces/%1$s/objectives/%2$s/tasks/%3$s", workspace_id, objective_id, id],
    model: Cadenya::Objectives::ObjectiveTask,
    options: options
  )
end