Skip to content

Commit

Permalink
Merge pull request #201 from ioki-mobility/operator-api/add-recalcula…
Browse files Browse the repository at this point in the history
…te-endpoint

Operator Api | Add custom endpoint for recalculate
  • Loading branch information
tom-ioki authored May 4, 2023
2 parents 0bc94c5 + c848445 commit 9f02a40
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ioki/apis/operator_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class OperatorApi
),
Endpoints.custom_endpoints(
'task_lists',
actions: { 'reassign' => :patch },
actions: { 'reassign' => :patch, 'recalculate' => :patch },
path: [API_BASE_PATH, 'products', :id, 'task_lists', :id],
model_class: Ioki::Model::Operator::TaskList
),
Expand Down
13 changes: 13 additions & 0 deletions spec/ioki/operator_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,19 @@
end
end

describe '#task_lists_recalculate(product_id, task_list_id)' do
it 'calls request on the client with expected params' do
expect(operator_client).to receive(:request) do |params|
expect(params[:url].to_s).to eq('operator/products/0815/task_lists/4711/recalculate')
expect(params[:method]).to eq(:patch)
result_with_data
end

expect(operator_client.task_lists_recalculate('0815', '4711', options))
.to be_a(Ioki::Model::Operator::TaskList)
end
end

describe '#task_lists_current_journey(product_id, task_list_id)' do
it 'calls request on the client with expected params' do
expect(operator_client).to receive(:request) do |params|
Expand Down

0 comments on commit 9f02a40

Please sign in to comment.