Click here to Skip to main content
15,887,812 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
Assume that there are 3 APIs. Each API does exactly the same task(to give you weather details) but has different endpoints as follows:

API 1: Can only be used for India. Has methods named requestWeather(), requestWeatherDataForWeek()

API 2: Can only be used for the USA. Has methods named sendRequest(), weatherDataForWeek()

API 3: Can only be used for the UK. Has methods named getWeather(), getWeatherDataForWeek().

Select the country using the drop-down.

a. Select the API according to the country. API selection is programmatic, which will be decided according to the country selected by the user.

b. Write your code such that, any API can be used without disturbing the business logic.

c. There must be a limit on the number of requests that can be sent. Throw an error if no. of requests exceed the limit.

d. It does not require HTTP calls or APIs. Just create a wrapper for API with the specified method and return some dummy values.

What I have tried:

I have tried doing it using HTTP calls or APIs. How to create a wrapper??
Posted
Updated 16-Oct-18 7:35am

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900