visoft/ruby_odata

Insert additional_params in the next link

Closed this issue · 1 comments

Hi,

I use a service that requires me to add a param(an api_key) to each call that I make.
http://odata.service.com/v1/Catalog/Entities?pkey=private_api_key

For this, I initialized the additional_params with this api_key.
The call to execute works great and the parameter is inserted in the query string.

The result is paginated and the next link comes without the pkey parameter
<link rel="next" href="http://odata.service.com/v1/Catalog/Entities?$skiptoken='ARP451000003'" />

I'd like to have the possibility to re-insert parameters from the additional_params in the next link before it's being called.

Do you think that the odata_service should handle this?
I'd gladly talk for a solution and then work on it.

Oh, absolutely, the additional_params is meant to be carried along for all requests. The next method skips the QueryBuilder and thus loses the additional_params since it's called directly off the URI from the OData results. Looking at it quickly, you should just be able to make the @next_uri (line 440 of service.rb) the result of a QueryBuilder.query method call instead.