ColdFusion CheddarGetter API Wrapper

will's Avatar

will

19 Jul, 2010 04:55 PM

I've put together a basic ColdFusion API wrapper for CheddarGetter. I hope this can be helpful to others in the CheddarGetter community.
You can get the files for free at: http://cfcheddargetter.riaforge.org/

  1. Support Staff 1 Posted by Marc Guyer on 19 Jul, 2010 07:38 PM

    Marc Guyer's Avatar

    That is great news, Will. We've had some inquiries about a CF wrapper in the past. Now we can tell them where to go. We'll probably blog about this in a bit. Anything you'd like us to include or mention?

  2. 2 Posted by will on 19 Jul, 2010 08:42 PM

    will's Avatar

    Hey Marc, It's very basic at this point, but I hope that it will give people a starting point to work from.

  3. Marc Guyer closed this discussion on 19 Jul, 2010 08:45 PM.

  4. Marc Guyer re-opened this discussion on 19 Jul, 2010 08:53 PM

  5. Support Staff 3 Posted by Marc Guyer on 19 Jul, 2010 08:53 PM

    Marc Guyer's Avatar

    I couldn't download it. Do you have to register to download?

  6. Support Staff 4 Posted by Marc Guyer on 19 Jul, 2010 09:25 PM

    Marc Guyer's Avatar

    No download button like on other projects. I see the attached in both Chrome and FF.

  7. 5 Posted by will on 19 Jul, 2010 10:48 PM

    will's Avatar

    Hi Mark, I'll check with them and get the download button fixed.

  8. 6 Posted by jeff on 20 Jul, 2010 05:16 AM

    jeff's Avatar

    Cool thanks Will!

  9. 7 Posted by will on 21 Jul, 2010 02:30 PM

    will's Avatar

    Hey I've had the link updated for the ColdFusion CheddarGetter files. You can check it out at http://cfcheddargetter.riaforge.org

  10. Support Staff 8 Posted by Marc Guyer on 21 Jul, 2010 02:59 PM

    Marc Guyer's Avatar

    Very cool, WIll. I just have one suggestion. I see that you have specified the arguments for all of the methods. While this is somewhat handy for "code is documentation" and potentially for error handling, it also limits the wrapper if the API changes to add some arguments for more functionality. We've run into this problem with one of the RubyGems. For example, in the current implementation, it doesn't appear to be possible to specify custom charges/credits or tracked item quantities with the CG_Create_a_New_Customer method.

  11. 9 Posted by Jordan Sitkin on 17 Aug, 2010 09:18 AM

    Jordan Sitkin's Avatar

    Thanks for creating this cfc Will! I hope you don't mind, but I have reworked it a bit.

    • I addressed the problem pointed out by Marc above by simply passing any arguments given to each of the functions on to the CG service as query parameters. This should make it future proof against new API arguments. It also makes the code a lot smaller :).

    • I wrapped it in a cfcomponent tag and defined an init method. This makes it more suitable for my projects as I can just drop it in and call it like so: CG = CreateObject("component", "CheddarGetter").init();
      CG.Get_a_Single_Customer(user_id="#id#");

    • Instead of using to return the values, I have used xmlParse. This gives everything back as a nice XMLdoc object that is easily traversed with XPath. For example, I can see how many specs a customer has racked up on their account with a few easy lines: CG = CreateObject("component", "Cheddar").init();
      xml = CG.Get_a_Single_Customer(user_id="#id#");
      allowedUsers = XmlSearch(xml, "//plans//item[@code='SPECS']/quantity")[1].XmlText;

    My version includes less helpful comments because I am lazy, and also no longer throws CF errors when arguments are missing. With my version, you are expected to check the returned xml object for errors - they can be found simply by checking for xml.error.

  12. Support Staff 10 Posted by Marc Guyer on 18 Aug, 2010 08:57 PM

    Marc Guyer's Avatar

    That's fantastic, Jordan! Do you have any plans to publish your version on GitHub or some similar open source code repository?

  13. 11 Posted by Jordan Sitkin on 18 Aug, 2010 11:01 PM

    Jordan Sitkin's Avatar

    On Wed, Aug 18, 2010 at 1:59 PM, Marc Guyer <
    [email blocked]<tender%[email blocked]>
    > wrote:

    If Will gives his blessing id be happy to

  14. 12 Posted by will on 19 Aug, 2010 03:30 PM

    will's Avatar

    That's awesome Jordan. It was my hope that someone would take what I created and run with it.

  15. 13 Posted by Jordan Sitkin on 19 Aug, 2010 08:23 PM

    Jordan Sitkin's Avatar

    I put it up as a GitHub repo, for all to enjoy.

    http://github.com/dustMason/Froide-au-Fromage

    We have decided to go with a someone else for our recurring billing set-up
    (cheddargetter's payment plans were not well-aligned with our business
    plans), so I won't be contributing to the code any longer. Feel free to fork
    away and run free, though!

  16. Marc Guyer closed this discussion on 13 Aug, 2012 03:07 PM.

Discussions are closed to public comments.
If you need help with Cheddar please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM