cferdinandi / petfinderAPI4everybody

A JavaScript plugin that makes it easier to use the Petfinder API.
MIT License
14 stars 7 forks source link

Console Throwing An Error With Specific Shelter ID #39

Closed ghost closed 6 years ago

ghost commented 7 years ago

Hello,

I am developing a site for our local animal shelter. The site can be found at

http://www.horseheadscommunityanimalshelter.com/pets.php

The console is throwing the error "Uncaught TypeError: localAPI.pets.reverse is not a function(…)"

This is only happening with the shelter I am trying to incorporate which is ID# NY1346 a new shelter established about a month ago.

If I use another ID from a nearby shelter the API works fine. For example ID# NY441

An example of it working can be viewer here.

http://www.horseheadscommunityanimalshelter.com/test.php

I have logged into the petfinder account for the shelter and verified that the sharing settings for api users is turned on so I am confused as to why it isn't working.

Any help would be greatly appreciated.

cferdinandi commented 7 years ago

Hey, looks like you've found a bug in my code related to Petfinder's terrible data structure.

When only one cat or dog is present, they send data back in a slightly different format that my code is not accounting for. In your first example, there's only one pet listed, so it's breaking the script. I'll try to get this fixed sometime this week.

ghost commented 7 years ago

Fantastic. You are very helpful. I could probably rip the code it apart myself and fix it, however I would take me much longer to learn your code, and I would rather not step on another developers feet. I would like to say your application is impressive. Very good job sir. :-)

ghost commented 7 years ago

I'm not sure if that is entirely the problem though. I have uploaded 3 cats and 5 dogs to petfinder and the console is still throwing errors. However the errors thrown now are different.

ghost commented 7 years ago

So, if you want to take a look at the site now you can see the API in full swing with a beatiful UI layed over top of it... http://www.horseheadscommunityanimalshelter.com/pets.php

cferdinandi commented 7 years ago

WOW... that is truly gorgeous! Really nice work.

I'm going to leave this issue open as there is still an error when there's only one pet and I just frankly haven't had time to look into it. But what you built with this is beautiful!