Example of Basecamp API ruby wrapper usage
-
11-09-2019 - |
Question
I've set up a new Rails 2.3.2 app and added the Basecamp API ruby wrapper to my /lib directory from here:
http://developer.37signals.com/basecamp/basecamp.rb
In my application_controller.rb I have created the following method to enable calls to Basecamp:
def basecamp_connect
Basecamp.establish_connection!('xxxxxx', 'xxxxxx', 'xxxxxx', false)
@basecamp = Basecamp.new
end
Can somebody provide an example of how I access the API from a controller to retrieve a list of To Do lists across all active Basecamp projects?
Solution
It's based on ActiveResource, so luckily your code will look a lot like AR model code.
This should find all todo items for your basecamp:
Basecamp::TodoList.find(:all)
You can also get all TodoLists from a given project, and specify if they're completed or not, using a method they've added to the TodoList class. To find all lists for a given project, for example, just use:
Basecamp::Todolist.all(project_id)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow