Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Library for working with the DonorsChoose.org dataset made available for the Hacking Education contest. If you are looking for an API wrapper for the DonorsChoose.org API, check out https://github.com/JumpstartLab/donors_choose

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README.textile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 donors_choose-data.gemspec
README.textile

donors_choose-data

NOTE: If you are looking for an API wrapper for DonorsChoose.org, please checkout https://github.com/JumpstartLab/donors_choose

This library sprung from the 2011 Hacking Education contest for DonorsChoose.org. (http://www.donorschoose.org/hacking-education)

The DonorsChoose::Data module match up the normalized data provided by DonorsChoose.org to classes that inherit from ActiveRecord::Base.

This gem assumes you have loaded the DonorsChoose.org datasets into a PostgreSQL database and normalized the data. See the contest documentation for more information.

Usage

  gem install donors_choose-data
  
project = DonorsChooseData::Data::Project.first
project.donations
school = DonorsChooseData::Data::School.last
school.teachers

Rails

If you’d like to use it in Rails, just add the following to your Gemfile:

gem 'donors_choose-data'

Stand alone

If you’d like to use it stand alone, do the following:

Create a database.yml, very similar to what you’d have in Rails:

adapter: postgresql
host: localhost
username: postgres
password: password
port: 5432
database: donors_choose_data
schema_search_path: public

Then, drop into irb, require the gem, and establish the db connection

terminal$ irb
irb(main):001:0> require 'rubygems'
irb(main):001:0> require 'donors_choose-data'
irb(main):001:0> DonorsChooseData::Data.connect(YAML.load(File.read('database.yml')))
irb(main):001:0> DonorsChooseData::Data::Project.first
Something went wrong with that request. Please try again.