lighthouse.rb/basecamp.rb not compatible

Glen Barnes's Avatar

Glen Barnes

23 Jan, 2009 12:20 AM

I posted this to Lighthouse tickets but here might be a better place for this question/issue.

I'm trying to integrate Basecamp and Lighthouse (to sync Milestones) but basecamp.rb seems to interfere with lighthouse.rb. Given this test file (and the attached basecamp.rb):

require 'rubygems'
require 'yaml'
require 'lighthouse'
require 'basecamp'

#Lighthouse setup
#Login details have been changed. Insert your own here
Lighthouse.account = 'someaccount'
Lighthouse.token = '7d102aadfa3222afd8e487e766ff55cdf3b'

lh_ms = Lighthouse::Milestone.find(12345, :params => {:project_id => 45678 })
puts lh_ms.inspect

It gives me this error:

/Library/Ruby/Gems/1.8/gems/activeresource-2.2.2/lib/active_resource/formats/xml_format.rb:15:in `to_xml': wrong     number of arguments (1 for 0) (ArgumentError)
from /Library/Ruby/Gems/1.8/gems/activeresource-2.2.2/lib/active_resource/formats/xml_format.rb:15:in `encode'
from /Library/Ruby/Gems/1.8/gems/activeresource-2.2.2/lib/active_resource/base.rb:896:in `encode'
from /Library/Ruby/Gems/1.8/gems/activeresource-2.2.2/lib/active_resource/base.rb:985:in `update'
from /Library/Ruby/Gems/1.8/gems/activeresource-2.2.2/lib/active_resource/base.rb:793:in `save_without_validation'
from /Library/Ruby/Gems/1.8/gems/activeresource-2.2.2/lib/active_resource/validations.rb:248:in `save'
from test.rb:12

I know this isn't really a Lighthouse issue but any help in working out what is going on would be appreciated.

  1. 1 Posted by Stefan Schüßler on 11 Feb, 2009 02:41 PM

    Stefan Schüßler's Avatar

    I've encountered a connection / authentication problem using both APIs because the Lighthouse API is overriding ActiveResource's authorization_header method.

    Commenting out lines 359-366 in lighthouse.rb solved the problem. (since I'm using token authentication)

    Maybe this is somehow related to your problem.



  2. 2 Posted by Rick on 11 Feb, 2009 05:57 PM

    Rick's Avatar

    Try swapping the order. The basecamp library overwrites Hash#to_xml and makes it incompatible. This may be tricky if both libraries make subtle differences to commonly used methods.

    I'll see if I can do something about the way the Lighthouse API overrides the authorization_header method. Though, I have no idea why this would affect Basecamp... its api client library was written before the ActiveResource library was even a twinkle in David's eye. However, I personally put in a lot of work into ActiveResource to make the Lighthouse API client lib.

  3. 3 Posted by Stefan Schüßler on 11 Feb, 2009 06:29 PM

    Stefan Schüßler's Avatar

    Maybe Basecamp's ruby wrapper was updated. The current version does use ActiveResource:

  4. 4 Posted by Rick on 11 Feb, 2009 06:47 PM

    Rick's Avatar

    stefan: oh that makes more sense... barnaclebarnes: try updating the basecamp api and removing the authorization_header code as stefan suggested.

  5. 5 Posted by Glen Barnes on 11 Feb, 2009 09:14 PM

    Glen Barnes's Avatar

    Updating basecamp.rb to the latest version and removing the reference to authorization_headerin lighthouse.rb seems to have work. Thanks for the pointers.

  6. brandi closed this discussion on 29 Jun, 2012 10:06 PM.

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

Keyboard shortcuts


? 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