lighthouse.rb/basecamp.rb not compatible

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
lh_ms.save

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. 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.

    Cheers

    Stefan

  2. 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. Maybe Basecamp's ruby wrapper was updated. The current version does use ActiveResource: http://developer.37signals.com/basecamp/basecamp.rb

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

  5. 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

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