FreshBooks.rb Patch

Posted by acts_as_flinn Mon, 02 Jul 2007 06:27:00 GMT

Updated – My patch was accepted, so you don’t need it ;-)

I’m really happy that FreshBooks released a new API because it brings a number of new features that I need to integrate with. I’m also happy that Ben Vinegar updated his ruby wrapper for the API, FreshBooks.rb.

So I gave it a go but had issues with the API Path and also noticed the item delete referred to invoice delete rather than Item::delete

This fixes the two issues and should get your awesome ruby applications talking to FreshBooks, enjoy.


Index: freshbooks.rb
===================================================================
--- freshbooks.rb       (revision 42)
+++ freshbooks.rb       (working copy)
@@ -31,7 +31,7 @@
 include REXML

 module FreshBooks
-  API_PATH = "/api" 
+  API_PATH = "/api/xml-in" 

   @@auth_key, @@account_url, @@api_url, @@auth_token = ''
   @@response = nil
@@ -328,7 +328,7 @@
     end

     def delete
-      Invoice::delete(self.item_id)
+      Item::delete(self.item_id)
     end

     def self.get(item_id)

ss_blog_claim=746d258dc975cb7923cc57154dbf1d71