getonbrd / pipedrive-connect

Ruby library for the Pipedrive API.
MIT License
19 stars 30 forks source link

Pagination on fields #32

Closed jfloff closed 1 year ago

jfloff commented 1 year ago

Hello,

I've been using this gem for a while, thank you for your amazing work.

I just noticed what it seems that might be a bug. After adding a number of custom fields to my Deals, I noticed that they were not showing up on the automated mapping that is done for those fields. After digging around, I noticed that when calling Pipedrive::Deals.fields the new custom fields were not showing up at all. When I enabled debugging, I noticed that the raw call had this at the end:

"additional_data":{"pagination":{"start":0,"limit":100,"more_items_in_collection":true,"next_start":100}}

After digging a bit on the code, I found that the existing request method is not handling pagination, and that is why my new fields are not showing up for me on the automatic mapping done.

(FYI, a very quick temporary fix would be to just increase the pagination limit from the standard 100 to the max 500, which although would solve cases like mine, would still hit the wall for more than 500 fields.)

j4rs commented 1 year ago

Hey João,

Thanks for using the gem ❤️ and good catch 🦅 , I will check it out adding a parameter or configuration setting to increase the limit to the maximum allowed by the API.

Another solution could be to return a page object to allow something like .next or .previous on any collection that could be paginated.

Going to think and come up with a solution in the coming days.

j4rs commented 1 year ago

Hey João,

Hopefully, you received the notification that this was fixed. Please confirm whether it works for you now.

Thanks.

jfloff commented 1 year ago

Hello,

Sorry for the late reply! At the time, my sales team was also doing a cleanup on their deal fields, so we went under the 100 fields. I don't think that will last long 😅 so I will check this in a near future.

Thank you for your swift reply!

jfloff commented 1 year ago

Let me circle back to this: I hit the wall again and after the upgrade everything worked flawlessly.

Once again, thank you! 😄