Camper is a Ruby wrapper for the Basecamp 3 API.
You can check out the gem documentation at https://www.rubydoc.org/gems/camper
Add this line to your application's Gemfile:
gem 'camper'
And then execute:
$ bundle
Or install it yourself as:
$ gem install camper
The up-to-date list of Basecamp API endpoints can be found at here.
Currently, Camper supports the following endpoints:
- Comments: Implementation at comments.rb (Complete)
- Message Types: Implementation at messages.rb (Complete)
- Message Boards: Implementation at message_boards.rb (Complete)
- Messages: Implementation at messages.rb (Complete)
- People: Implementation at people.rb (Complete)
- Projects: Implementation at projects.rb (Complete)
- Recordings: Implementation at recordings.rb (Complete)
- To-do list: Implementation at todolists.rb (Complete)
- To-dos: Implementation at todos.rb (Complete)
Getting a client
and configuring it:
require 'camper'
client = Camper.client
client.configure do |config|
config.client_id = 'client_id'
config.client_secret = 'client_secret'
config.account_number = 'account_number'
config.refresh_token = 'refresh_token'
config.access_token = 'access_token'
end
Alternatively, it is possible to invoke the top-level #configure
method to get a client
:
require 'camper'
client = Camper.configure do |config|
config.client_id = 'client_id'
config.client_secret = 'client_secret'
config.account_number = 'account_number'
config.refresh_token = 'refresh_token'
config.access_token = 'access_token'
end
Also, the client
can read directly the following environment variables:
BASECAMP_CLIENT_ID
BASECAMP_CLIENT_SECRET
BASECAMP_ACCOUNT_NUMBER
BASECAMP_REFRESH_TOKEN
BASECAMP_ACCESS_TOKEN
then the code would look like:
require 'camper'
client = Camper.client
Example getting list of TODOs:
require 'camper'
client = Camper.configure do |config|
config.client_id = ENV['BASECAMP_CLIENT_ID']
config.client_secret = ENV['BASECAMP_CLIENT_SECRET']
config.account_number = ENV['BASECAMP_ACCOUNT_NUMBER']
config.refresh_token = ENV['BASECAMP_REFRESH_TOKEN']
config.access_token = ENV['BASECAMP_ACCESS_TOKEN']
end
# gets a paginated response
projects = client.projects
# iterate all projects
projects.auto_paginate do |p|
puts "Project: #{p.inspect}"
puts "Todo set: #{p.todoset.inspect}"
todoset = client.todoset(p)
# iterate over the first 5 todo lists
client.todolists(todoset).auto_paginate(5) do |list|
puts "Todolist: #{list.title}"
client.todos(list).auto_paginate do |todo|
puts todo.inspect
end
end
end
For more examples, check out the examples folder
Check out the Contributing page.
For inspecting the changes and tag releases, check the Changelog page
The gem code structure and documentation is based on the awesome NARKOZ/gitlab gem
Checkout the LICENSE for details