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

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

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:



82
83
84
# File 'lib/cadenya/resources/objectives/tasks.rb', line 82

def initialize(client:)
  @client = client
end

Instance Method Details

#list(objective_id, workspace_id:, 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:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/cadenya/resources/objectives/tasks.rb', line 62

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
      raise ArgumentError.new("missing required path argument #{_1}")
    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(id, workspace_id:, objective_id:, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveTask

Retrieves a task by ID from an objective

Parameters:

  • id (String)

    Task ID

  • workspace_id (String)
  • objective_id (String)

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

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

Returns:

See Also:



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

def retrieve(id, params)
  parsed, options = Cadenya::Objectives::TaskRetrieveParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  objective_id =
    parsed.delete(:objective_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    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