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
10 changes: 5 additions & 5 deletions lib/ioki/apis/operator_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -710,15 +710,15 @@ class OperatorApi
outgoing_model_class: Ioki::Model::Operator::GeocodingReverseSearch
),
Endpoints::Index.new(
:no_shows,
:service_violations,
base_path: [API_BASE_PATH, 'products', :id],
model_class: Ioki::Model::Operator::NoShow
model_class: Ioki::Model::Operator::ServiceViolation
),
Comment thread
anm-ioki marked this conversation as resolved.
Endpoints.custom_endpoints(
'no_show',
'service_violation',
actions: { 'acknowledge' => :patch },
path: [API_BASE_PATH, 'products', :id, 'no_shows', :id],
model_class: Ioki::Model::Operator::NoShow
path: [API_BASE_PATH, 'products', :id, 'service_violations', :id],
model_class: Ioki::Model::Operator::ServiceViolation
),
Endpoints.crud_endpoints(
:service_violation_block,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Ioki
module Model
module Operator
class NoShow < Base
class ServiceViolation < Base
attribute :type,
on: :read,
type: :string
Expand Down Expand Up @@ -39,6 +39,10 @@ class NoShow < Base
attribute :ride_id,
on: :read,
type: :string

attribute :service_violation_type,
on: :read,
type: :string
end
end
end
Expand Down
16 changes: 8 additions & 8 deletions spec/ioki/operator_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3155,28 +3155,28 @@
end
end

describe '#no_show_acknowledge(product_id, no_show_id)' do
describe '#service_violation_acknowledge(product_id, service_violation_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/no_shows/4711/acknowledge')
expect(params[:url].to_s).to eq('operator/products/0815/service_violations/4711/acknowledge')
expect(params[:method]).to eq(:patch)
result_with_data
end

expect(operator_client.no_show_acknowledge('0815', '4711'))
.to be_a(Ioki::Model::Operator::NoShow)
expect(operator_client.service_violation_acknowledge('0815', '4711'))
.to be_a(Ioki::Model::Operator::ServiceViolation)
end
end

describe '#no_shows(product_id)' do
describe '#service_violations(product_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/no_shows')
expect(params[:url].to_s).to eq('operator/products/0815/service_violations')
result_with_index_data
end

expect(operator_client.no_shows('0815', options))
.to all(be_a(Ioki::Model::Operator::NoShow))
expect(operator_client.service_violations('0815', options))
.to all(be_a(Ioki::Model::Operator::ServiceViolation))
end
end

Expand Down