I am trying to use the Basecamp Classic API ( http://developer.37signals.com/basecamp/comments.shtml ). The current version of basecamp-wrapper gave me the opportunity, one of the things was that the json answers included the page output, but the xml did not. It was easy to fix, but the problem is that the URL structure is not standardized.
The API defines several such things that make me think that it simply separates the paths from the element and the collection path.
Get recent comments (for a commentable resource)
GET /#{resource}/
Update comment
PUT /comments/
I made several attempts, and in fact it failed. Attempting to process such comments is hacked at best and actually does not work, because element_path is different from path_path.
class Resource < ActiveResource::Base
self.site = "https://XXXX.basecamphq.com"
self.user = "XXXX"
self.password = "X"
self.format = :xml
class << self
def element_path(id, prefix_options={}, query_options={})
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
"#{collection_name}/#{URI.parser.escape id.to_s}.#{format.extension}#{query_string(query_options)}"
end
end
end
class Project < Resource
end
class Message < Resource
self.element_name = "post"
self.prefix = "/projects/:project_id/"
self.collection_name = "posts"
def comments
@comments ||= Comment.all(:params => {:resource => "posts" , :resource_id => id})
end
end
class Comment < Resource
self.prefix = "/:resource/:resource_id/"
end
puts m = Message.first(:params => {:project_id => PROJECT_ID})
puts m = Message.find(m.id)
puts m.update_attribute(:title, "name")
update_attribute, - URL-, PUT, .
? ?
.:)