Skip to content

Commit ed33dfd

Browse files
Merge #588
588: Accept :reverse param on client.tasks endpoint r=brunoocasali a=ellnix # Pull Request ## Related issue Fixes #581 Co-authored-by: ellnix <[email protected]>
2 parents 54ae665 + df1141c commit ed33dfd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/meilisearch/task.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Task < HTTPRequest
88
ALLOWED_PARAMS = [
99
:limit, :from, :index_uids, :types, :statuses, :uids, :canceled_by,
1010
:before_enqueued_at, :after_enqueued_at, :before_started_at, :after_started_at,
11-
:before_finished_at, :after_finished_at
11+
:before_finished_at, :after_finished_at, :reverse
1212
].freeze
1313
ALLOWED_CANCELATION_PARAMS = (ALLOWED_PARAMS - [:limit, :from]).freeze
1414

spec/meilisearch/client/tasks_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525
expect(last_task.keys).to include(*succeeded_task_keys)
2626
end
2727

28+
it 'allows for returning tasks in reverse' do
29+
tasks = client.tasks
30+
rev_tasks = client.tasks(reverse: true)
31+
32+
expect(tasks['results']).not_to eq(rev_tasks['results'])
33+
end
34+
2835
it 'gets a task of the Meilisearch instance' do
2936
task = client.task(0)
3037

0 commit comments

Comments
 (0)