Skip to content

Commit

Permalink
Add client endpoints to driver, passenger and platform
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehner committed Oct 25, 2022
1 parent e9be535 commit e85ae80
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/ioki/apis/driver_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ class DriverApi
base_path: [API_BASE_PATH],
model_class: Ioki::Model::Driver::FirebaseToken
),
Endpoints::Driver::ConfirmFirebasePush.new
Endpoints::Driver::ConfirmFirebasePush.new,
Endpoints::ShowSingular.new(
:client,
base_path: [API_BASE_PATH],
model_class: Ioki::Model::Driver::Client
)
].freeze
end
end
5 changes: 5 additions & 0 deletions lib/ioki/apis/passenger_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ class PassengerApi
base_path: [API_BASE_PATH],
model_class: Ioki::Model::Passenger::Bootstrap
),
Endpoints::ShowSingular.new(
:client,
base_path: [API_BASE_PATH],
model_class: Ioki::Model::Passenger::Client
),
Endpoints::ShowSingular.new(
:user,
base_path: [API_BASE_PATH],
Expand Down
5 changes: 5 additions & 0 deletions lib/ioki/apis/platform_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ module Ioki
class PlatformApi
API_BASE_PATH = 'platform'
ENDPOINTS = [
Endpoints::ShowSingular.new(
:client,
base_path: [API_BASE_PATH],
model_class: Ioki::Model::Platform::Client
),
Endpoints.crud_endpoints(
:station,
base_path: [API_BASE_PATH, 'products', :id],
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions spec/ioki/examples/platform_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,10 @@
# No webhook defined on demo product
end
end

describe 'show endpoints' do
it 'return their corresponding models' do
expect(platform_client.client).to be_a(Ioki::Model::Platform::Client)
end
end
end

0 comments on commit e85ae80

Please sign in to comment.