public
Description: An example of how the Donor Tools API can be used
Homepage: www.donortools.com
Clone URL: git://github.com/artofmission/Donor-Tools-Consumer.git
artofmission (author)
Thu Jun 25 17:40:42 -0700 2009
commit  e415f4a5eaeb47dd079c770edfb167969915bbdc
tree    ff15ef4a7972c310c3f2af702e06210bc54c1aeb
parent  c121fb76f4d5fc0a20f3cb751bdcfa8b0589edc8
name age message
file .gitignore Thu Jun 25 15:35:09 -0700 2009 Added config file. [artofmission]
file README.rdoc Thu Jun 25 17:40:42 -0700 2009 Updated readme [artofmission]
file Rakefile Mon Jun 22 15:28:36 -0700 2009 Uploaded example app. [artofmission]
directory app/ Thu Jun 25 15:35:09 -0700 2009 Added config file. [artofmission]
directory config/ Thu Jun 25 15:35:09 -0700 2009 Added config file. [artofmission]
directory db/ Mon Jun 22 15:28:36 -0700 2009 Uploaded example app. [artofmission]
directory doc/ Mon Jun 22 15:28:36 -0700 2009 Uploaded example app. [artofmission]
directory log/ Mon Jun 22 15:28:36 -0700 2009 Uploaded example app. [artofmission]
directory public/ Mon Jun 22 15:28:36 -0700 2009 Uploaded example app. [artofmission]
directory script/ Mon Jun 22 15:28:36 -0700 2009 Uploaded example app. [artofmission]
directory test/ Mon Jun 22 15:28:36 -0700 2009 Uploaded example app. [artofmission]
directory vendor/ Mon Jun 22 15:28:36 -0700 2009 Uploaded example app. [artofmission]
README.rdoc

Donor Tools API Consumer

Welcome to the Donor Tools Consumer example application.

Before you get started, please have a look at our API documentation on our support forum: support.donortools.com/forums/47417/entries

Note to Rails developers: Donor Tools won’t work out of the box with ActiveResource. This is because we use a customized version of the WillPaginate plugin that provides pagination collection information. You can download our fork of the gem from Github: github.com/artofmission/will_paginate/tree/master.

License

The Donor Tools API is a beta product and is subject to the API License Agreement: www.donortools.com/about/api_license

Authentication

Donor Tools’ API uses HTTP Basic authentication. You’ll need to sign up for a Donor Tools account (if you don’t have one already.)

User Account

You’ll need to sign up for a Donor Tools account in order to use the API. If you don’t already have a Donor Tools account, you can get one by going to www.donortools.com/signup.

Donor Tools’ auditing feature logs each and every action for your account. Thus, if you provide your own username and password for the API (not recommended), all actions through the API will appear as being committed by you. We recommend creating a separate API user to provide finer grained reporting detail. This technique also helps protect your personal authentication parameters, as you can provide a different username and password.

Example Usage

This example app uses ActiveResource to communicate with the Donor Tools API. Here’s an example of the donation.rb file:

  class Donation < ActiveResource::Base
    self.site = "http://youraccount.donortools.com"
    self.user = "your_donor_tools_username"
    self.password = "your_password"
  end

To get a list of donations, you’d open up ./script/console, and type:

  Donation.find(:all)

Finding a specific donation

  Donation.find(12345)

Updating a donation

  d = Donation.find(12345)
  d.splits.first.cents = 5001
  d.save

Creating a donation

  persona = Persona.find(104996)
  fund = Fund.find(11058)
  source = Source.find(986)
  donation = Donation.new(
    :persona_id => persona.id,
    :new_split_attributes => [{:cents => 5002, :fund_id => fund.id}],
    :donation_type_id => 1,
    :source_id => source.id
  )
  donation.save