zaidakram / expedia

Expedia is a ruby wrapper for EAN (Expedia Affiliate Network)
http://zaidakram.github.io/expedia/
MIT License
48 stars 29 forks source link

Updated condition for request method type for get_list #12

Closed martijnbleeker closed 9 years ago

martijnbleeker commented 10 years ago

I ran into an issue when using the get_list method including a large hotelIdList. I noticed that the check for doing a post or get request was done based on possible response size instead of request size.

I updated the method to check for hotelIdList length > 200 instead of numberOfResults, because the GET/POST request is not determined on the numberOfResults parameter, but the hotelIdList parameter. The numberOfResults has no impact on it, besides the only acceptable values are 0 < val < 200, according to expedia API documentation.

Maximum number of hotels to return. Acceptable value range is 1 to 200. Default: 20

Source

Instead a POST request should be made if a 'long' hotelIdList is provided.

When using long lists, be aware that response times may increase noticably vs. smaller lists across multiple requests. Use POST instead of GET when sending long lists via REST.

Source

The boundaries for length of a long list are not specified in the documentation. So I set it on 200 for now. I noticed it is currently on 500, but lets keep some headroom for unforeseen expedia API changes.

I saw no specs for the Api class, so couldn't update any. I would recommend some specs, but have not enough experience to set this up.

Let me know if there's anything else I can do/answer any questions.

martijnbleeker commented 10 years ago

Hi @zaidakram,

I wondered if you can find the time to look at this at some point?

zaidakram commented 10 years ago

I'm really sorry I'm not able to get some time off to look into this issue. I'll definitely do it this weekend. Thank You for the follow up.