Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@

# Cached common rubocop config
.rubocop-https---dbdrive-github-io-triebwerk-rubocop-common-yml

.tool-versions
13 changes: 13 additions & 0 deletions lib/ioki/apis/operator_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,19 @@ class OperatorApi
base_path: nil,
path: [API_BASE_PATH, 'products', :id, 'lines', 'batch_deletion_requests', :id],
model_class: Ioki::Model::Operator::BatchDeletionRequest
),
Endpoints::Create.new(
:driver_batch_deletion_request,
base_path: [API_BASE_PATH, 'products', :id, 'drivers'],
path: 'batch_deletion_requests',
model_class: Ioki::Model::Operator::BatchDeletionRequest,
outgoing_model_class: Ioki::Model::Operator::DriverBatch
),
Endpoints::ShowSingular.new(
:driver_batch_deletion_request,
base_path: nil,
path: [API_BASE_PATH, 'products', :id, 'drivers', 'batch_deletion_requests', :id],
model_class: Ioki::Model::Operator::BatchDeletionRequest
)
].freeze
end
Expand Down
17 changes: 17 additions & 0 deletions lib/ioki/model/operator/driver_batch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module Ioki
module Model
module Operator
class DriverBatch < Base
def self.schema_path
'operator_api--v20210101--driver_batch_archive_schema'
end

attribute :driver_ids,
on: :create,
type: :array
end
end
end
end
27 changes: 27 additions & 0 deletions spec/ioki/operator_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3395,4 +3395,31 @@
expect(operator_client.vehicle_state('0815', options)).to be_a Ioki::Model::Operator::VehicleState
end
end

describe '#create_driver_batch_deletion_request(product_id)' do
let(:driver_batch) { Ioki::Model::Operator::DriverBatch.new }

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/drivers/batch_deletion_requests')
expect(params[:method]).to eq(:post)
[result_with_data, full_response]
end

expect(operator_client.create_driver_batch_deletion_request('0815', driver_batch, options))
.to be_a(Ioki::Model::Operator::BatchDeletionRequest)
end
end

describe '#driver_batch_deletion_request(product_id, batch_deletion_request_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/drivers/batch_deletion_requests/4711')
[result_with_data, full_response]
end

expect(operator_client.driver_batch_deletion_request('0815', '4711', options))
.to be_a(Ioki::Model::Operator::BatchDeletionRequest)
end
end
end
Loading