camp3
Camp3 is a Ruby wrapper for the Basecamp 3 API.
Installation
Add this line to your application's Gemfile:
gem 'camp3'
And then execute:
$ bundle
Or install it yourself as:
$ gem install camp3
Usage
Getting a client and configuring it:
require 'camp3'
client = Camp3.client
client.configure do |config|
config.client_id = ENV['BASECAMP3_CLIENT_ID']
config.client_secret = ENV['BASECAMP3_CLIENT_SECRET']
config.account_number = ENV['BASECAMP3_ACCOUNT_NUMBER']
config.refresh_token = ENV['BASECAMP3_REFRESH_TOKEN']
config.access_token = ENV['BASECAMP3_ACCESS_TOKEN']
end
projects = client.projects
Alternatively, it is possible to invoke the top-level #configure
method to get a client:
require 'camp3'
client = Camp3.configure do |config|
config.client_id = ENV['BASECAMP3_CLIENT_ID']
config.client_secret = ENV['BASECAMP3_CLIENT_SECRET']
config.account_number = ENV['BASECAMP3_ACCOUNT_NUMBER']
config.refresh_token = ENV['BASECAMP3_REFRESH_TOKEN']
config.access_token = ENV['BASECAMP3_ACCESS_TOKEN']
end
projects = client.projects
Example getting list of TODOs:
require 'camp3'
client = Camp3.configure do |config|
config.client_id = ENV['BASECAMP3_CLIENT_ID']
config.client_secret = ENV['BASECAMP3_CLIENT_SECRET']
config.account_number = ENV['BASECAMP3_ACCOUNT_NUMBER']
config.refresh_token = ENV['BASECAMP3_REFRESH_TOKEN']
config.access_token = ENV['BASECAMP3_ACCESS_TOKEN']
end
projects = client.projects
projects.each do |p|
puts "Project: #{p.inspect}"
puts "Todo set: #{p.todoset.inspect}"
todoset = client.todoset(p)
client.todolists(todoset).each do |list|
puts "Todolist: #{list.title}"
client.todos(list).each do |todo|
puts todo.inspect
end
end
end
For more examples, check out the examples folder
Contributing
Check out the Contributing page.
Changelog
For inspecting the changes and tag releases, check the Changelog page
Appreciation
The gem code structure and documentation is based on the awesome NARKOZ/gitlab gem
License
Checkout the LICENSE for details