7digital / SevenDigital.Api.Wrapper

A fluent c# wrapper for the 7digital API
MIT License
16 stars 29 forks source link

Provide base route 2 #187

Closed AnthonySteele closed 10 years ago

AnthonySteele commented 10 years ago

Simpler take on https://github.com/7digital/SevenDigital.Api.Wrapper/pull/186

A toolkit to address https://github.com/7digital/SevenDigital.Api.Wrapper/issues/36 - "Enable using different API urls for each endpoint"

Removed it from the endpoint DTO, - is not going to be useful as the DTO will usually come in a library & the caller will be wanting to modify the base uri after the fact using Api.WithBaseUri(....

This makes RouteParamsSubstitutor simpler as well - it just delegates the base uri to whichever BaseUriProvider is in use. The default BaseUriProvider does the logic of selecting secure or regular api uri

gregsochanik commented 10 years ago

Can't see any reason why we shouldn't merge this straight away.

Apologies, as I could prob find this out myself :-), but it is just adding the .UsingBaseUri(IBaseUriProvider) method along with a couple of out of the box implementations of IBaseUrlProvider?

if so - looks great.

AnthonySteele commented 10 years ago

Yes, that's it.

And the baseUrlProvider is called in RouteParamsSubstitutor line 32 onwards

The "default" implementation does what was done before - select either the secure or regular url from IApiUri

The test that shows you how to override the default is here

AnthonySteele commented 10 years ago

:sunglasses: :satisfied: