donors_choose 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in donors_choose.gemspec
4
- gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Steve Klabnik
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # DonorsChoose
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'donors_choose'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install donors_choose
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile CHANGED
@@ -1,16 +1,2 @@
1
- # Bundler tasks
2
- require 'bundler'
3
- Bundler::GemHelper.install_tasks
4
-
5
- # Test tasks
6
- require 'rake'
7
- require 'rake/testtask'
8
-
9
- desc "Run basic tests"
10
- Rake::TestTask.new("test_units") { |t|
11
- t.pattern = 'test/*/*/*_test.rb'
12
- t.verbose = true
13
- t.warning = true
14
- }
15
-
16
- task :default => [:test_units]
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -1,24 +1,17 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "donors_choose/version"
2
+ require File.expand_path('../lib/donors_choose/version', __FILE__)
4
3
 
5
- Gem::Specification.new do |s|
6
- s.name = "donors_choose"
7
- s.version = DonorsChoose::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["steve@steveklabnik.com"]
10
- s.email = [""]
11
- s.homepage = ""
12
- s.summary = %q{Libaries to assist with mining and utilizing donorschoose.org}
13
- s.description = %q{}
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Steve Klabnik"]
6
+ gem.email = ["steve@steveklabnik.com"]
7
+ gem.description = %q{A gem for the DonorsChoose.org API.}
8
+ gem.summary = %q{A gem for the DonorsChoose.org API.}
9
+ gem.homepage = ""
14
10
 
15
- s.rubyforge_project = "donors_choose"
16
-
17
- s.add_dependency 'activerecord', '> 3.0'
18
- s.add_dependency 'pg'
19
-
20
- s.files = `git ls-files`.split("\n")
21
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
- s.require_paths = ["lib"]
24
- end
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "donors_choose"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = DonorsChoose::VERSION
17
+ end
@@ -1,5 +1,7 @@
1
+ require "donors_choose/version"
2
+
1
3
  module DonorsChoose
2
-
4
+ # Your code goes here...
3
5
  end
4
6
 
5
- require File.expand_path(File.dirname(__FILE__) + "/donors_choose/data")
7
+ puts "This gem is in progress!"
@@ -1,3 +1,3 @@
1
1
  module DonorsChoose
2
- VERSION = "0.0.2"
3
- end
2
+ VERSION = "0.0.3"
3
+ end
metadata CHANGED
@@ -1,130 +1,53 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: donors_choose
3
- version: !ruby/object:Gem::Version
4
- hash: 27
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 2
10
- version: 0.0.2
11
6
  platform: ruby
12
- authors:
13
- - steve@steveklabnik.com
7
+ authors:
8
+ - Steve Klabnik
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-02-13 00:00:00 -06:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: activerecord
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">"
28
- - !ruby/object:Gem::Version
29
- hash: 7
30
- segments:
31
- - 3
32
- - 0
33
- version: "3.0"
34
- type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: pg
38
- prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 0
47
- version: "0"
48
- type: :runtime
49
- version_requirements: *id002
50
- description: ""
51
- email:
52
- - ""
12
+ date: 2012-02-14 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: A gem for the DonorsChoose.org API.
15
+ email:
16
+ - steve@steveklabnik.com
53
17
  executables: []
54
-
55
18
  extensions: []
56
-
57
19
  extra_rdoc_files: []
58
-
59
- files:
20
+ files:
21
+ - .gitignore
60
22
  - Gemfile
61
- - README.textile
23
+ - LICENSE
24
+ - README.md
62
25
  - Rakefile
63
26
  - donors_choose.gemspec
64
27
  - lib/donors_choose.rb
65
- - lib/donors_choose/data.rb
66
- - lib/donors_choose/data/account.rb
67
- - lib/donors_choose/data/city.rb
68
- - lib/donors_choose/data/donation.rb
69
- - lib/donors_choose/data/essay.rb
70
- - lib/donors_choose/data/giftcard.rb
71
- - lib/donors_choose/data/project.rb
72
- - lib/donors_choose/data/resource.rb
73
- - lib/donors_choose/data/school.rb
74
- - lib/donors_choose/data/teacher.rb
75
28
  - lib/donors_choose/version.rb
76
- - test/donors_choose/data/account_test.rb
77
- - test/donors_choose/data/city_test.rb
78
- - test/donors_choose/data/donation_test.rb
79
- - test/donors_choose/data/essay_test.rb
80
- - test/donors_choose/data/giftcard_test.rb
81
- - test/donors_choose/data/project_test.rb
82
- - test/donors_choose/data/resource_test.rb
83
- - test/donors_choose/data/school_test.rb
84
- - test/donors_choose/data/teacher_test.rb
85
- - test/test_helper.rb
86
- has_rdoc: true
87
- homepage: ""
29
+ homepage: ''
88
30
  licenses: []
89
-
90
31
  post_install_message:
91
32
  rdoc_options: []
92
-
93
- require_paths:
33
+ require_paths:
94
34
  - lib
95
- required_ruby_version: !ruby/object:Gem::Requirement
35
+ required_ruby_version: !ruby/object:Gem::Requirement
96
36
  none: false
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- hash: 3
101
- segments:
102
- - 0
103
- version: "0"
104
- required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
42
  none: false
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- hash: 3
110
- segments:
111
- - 0
112
- version: "0"
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
113
47
  requirements: []
114
-
115
- rubyforge_project: donors_choose
116
- rubygems_version: 1.5.2
48
+ rubyforge_project:
49
+ rubygems_version: 1.8.16
117
50
  signing_key:
118
51
  specification_version: 3
119
- summary: Libaries to assist with mining and utilizing donorschoose.org
120
- test_files:
121
- - test/donors_choose/data/account_test.rb
122
- - test/donors_choose/data/city_test.rb
123
- - test/donors_choose/data/donation_test.rb
124
- - test/donors_choose/data/essay_test.rb
125
- - test/donors_choose/data/giftcard_test.rb
126
- - test/donors_choose/data/project_test.rb
127
- - test/donors_choose/data/resource_test.rb
128
- - test/donors_choose/data/school_test.rb
129
- - test/donors_choose/data/teacher_test.rb
130
- - test/test_helper.rb
52
+ summary: A gem for the DonorsChoose.org API.
53
+ test_files: []
@@ -1,55 +0,0 @@
1
- h1. donors_choose
2
-
3
- This library sprung from the 2011 Hacking Education contest for DonorsChoose.org. (http://www.donorschoose.org/hacking-education)
4
-
5
- The DonorsChoose::Data module match up the normalized data provided by DonorsChoose.org to classes that inherit from ActiveRecord::Base.
6
-
7
- *This gem assumes you have loaded the DonorsChoose.org datasets into a PostgreSQL database and normalized the data. See the "contest documentation":http://developer.donorschoose.org/the-data/data-schema for more information.*
8
-
9
- h2. Usage
10
-
11
- <pre>
12
- gem install donors_choose
13
- </pre>
14
-
15
- <pre>
16
- project = DonorsChoose::Data::Project.first
17
- project.donations
18
- school = DonorsChoose::Data::School.last
19
- school.teachers
20
- </pre>
21
-
22
-
23
- h3. Rails
24
-
25
- If you'd like to use it in Rails, just add the following to your Gemfile:
26
-
27
- <pre>
28
- gem 'donors_choose'
29
- </pre>
30
-
31
- h3. Stand alone
32
-
33
- If you'd like to use it stand alone, do the following:
34
-
35
- Create a database.yml, very similar to what you'd have in Rails:
36
-
37
- bq. adapter: postgresql
38
- host: localhost
39
- username: postgres
40
- password: password
41
- port: 5432
42
- database: donors_choose_data
43
- schema_search_path: public
44
-
45
- Then, drop into irb, require the gem, and establish the db connection
46
-
47
- <pre>
48
- terminal$ irb
49
- irb(main):001:0> require 'rubygems'
50
- irb(main):001:0> require 'donors_choose'
51
- irb(main):001:0> DonorsChoose::Data.connect(YAML.load(File.read('database.yml')))
52
- irb(main):001:0> DonorsChoose::Data::Project.first
53
- </pre>
54
-
55
-
@@ -1,18 +0,0 @@
1
- require 'active_record'
2
- require 'pg'
3
-
4
- module DonorsChoose
5
- module Data
6
-
7
- # Use this if you're going standalone (aka sans Rails)
8
- def self.connect(postgres_config = {})
9
- # Connect with db
10
- ActiveRecord::Base.establish_connection(postgres_config)
11
- end
12
-
13
- Dir.glob("#{File.dirname __FILE__}/data/*.rb").each do |f|
14
- require f
15
- end
16
- end
17
- end
18
-
@@ -1,10 +0,0 @@
1
- module DonorsChoose
2
- module Data
3
- class Account < ActiveRecord::Base
4
- set_table_name :normalized_account
5
- set_primary_key :_acctid
6
-
7
- belongs_to :city, :foreign_key => :cityid
8
- end
9
- end
10
- end
@@ -1,9 +0,0 @@
1
- module DonorsChoose
2
- module Data
3
- class City < ActiveRecord::Base
4
- set_table_name :normalized_city
5
-
6
- has_many :accounts, :foreign_key => :cityid
7
- end
8
- end
9
- end
@@ -1,10 +0,0 @@
1
- module DonorsChoose
2
- module Data
3
- class Donation < ActiveRecord::Base
4
- set_table_name :normalized_donation
5
- set_primary_key :_donationid
6
-
7
- belongs_to :project, :foreign_key => :_projectid
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- module DonorsChoose
2
- module Data
3
- class Essay < ActiveRecord::Base
4
- set_table_name :normalized_essay
5
- set_primary_key :_projectid
6
-
7
- belongs_to :project, :foreign_key => :_projectid
8
- end
9
- end
10
- end
@@ -1,8 +0,0 @@
1
- module DonorsChoose
2
- module Data
3
- class Giftcard < ActiveRecord::Base
4
- set_table_name :normalized_giftcard
5
- set_primary_key :_giftcardid
6
- end
7
- end
8
- end
@@ -1,16 +0,0 @@
1
- module DonorsChoose
2
- module Data
3
- class Project < ActiveRecord::Base
4
- set_table_name :normalized_project
5
- set_primary_key :_projectid
6
-
7
- belongs_to :school, :foreign_key => :_schoolid
8
- belongs_to :teacher, :foreign_key => :_teacher_acctid
9
-
10
- has_one :essay, :foreign_key => :_projectid
11
-
12
- has_many :donations, :foreign_key => :_projectid
13
- has_many :resources, :foreign_key => :_projectid
14
- end
15
- end
16
- end
@@ -1,10 +0,0 @@
1
- module DonorsChoose
2
- module Data
3
- class Resource < ActiveRecord::Base
4
- set_table_name :normalized_resource
5
- set_primary_key :_resourceid
6
-
7
- belongs_to :project, :foreign_key => :_projectid
8
- end
9
- end
10
- end
@@ -1,11 +0,0 @@
1
- module DonorsChoose
2
- module Data
3
- class School < ActiveRecord::Base
4
- set_table_name :normalized_school
5
- set_primary_key :_schoolid
6
-
7
- has_many :projects, :foreign_key => :_schoolid
8
- has_many :teachers, :through => :projects
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- module DonorsChoose
2
- module Data
3
- class Teacher < ActiveRecord::Base
4
- set_table_name :normalized_teacher
5
- set_primary_key :_teacher_acctid
6
-
7
- has_many :projects, :foreign_key => :_teacher_acctid
8
- has_many :schools, :through => :projects
9
- end
10
- end
11
- end
@@ -1,17 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
-
3
- class AccountTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @account = DonorsChoose::Data::Account.order(:_acctid).first
7
- end
8
-
9
- def test_account_setup
10
- assert_equal "00008481214e948f070337066f875fb2", @account._acctid
11
- end
12
-
13
- def test_city_setup
14
- assert_equal 4474, @account.city.id
15
- end
16
-
17
- end
@@ -1,17 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
-
3
- class CityTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @city = DonorsChoose::Data::City.first
7
- end
8
-
9
- def test_city_setup
10
- assert_equal 1, @city.id
11
- end
12
-
13
- def test_accounts_setup
14
- assert_equal "c4127fe826abef12174ca4d0e7288f88", @city.accounts.first._acctid
15
- end
16
-
17
- end
@@ -1,16 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
-
3
- class DonationTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @donation = DonorsChoose::Data::Donation.order(:_donationid).first
7
- end
8
-
9
- def test_donation_setup
10
- assert_equal "0000023f507999464aa2b78875b7e5d6", @donation._donationid
11
- end
12
-
13
- def test_project_setup
14
- assert_equal "69bf3a609bb4673818e0eebd004ea504", @donation.project._projectid
15
- end
16
- end
@@ -1,17 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
-
3
- class EssayTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @essay = DonorsChoose::Data::Essay.order(:_projectid).first
7
- end
8
-
9
- def test_essay_setup
10
- assert_equal "0000023f507999464aa2b78875b7e5d6", @essay._projectid
11
- end
12
-
13
- def test_project_setup
14
- assert_equal "0000023f507999464aa2b78875b7e5d6", @essay.project._projectid
15
- end
16
-
17
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
-
3
- class GiftcardTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @giftcard = DonorsChoose::Data::Giftcard.order(:_giftcardid).first
7
- end
8
-
9
- def test_giftcard_setup
10
- assert_equal "000238b44c187c254752736e53ee46f2", @giftcard._giftcardid
11
- end
12
-
13
- end
@@ -1,33 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
-
3
- class ProjectTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @project = DonorsChoose::Data::Project.order(:_projectid).first
7
- end
8
-
9
- def test_project_setup
10
- assert_equal "0000023f507999464aa2b78875b7e5d6", @project._projectid
11
- end
12
-
13
- def test_donation_setup
14
- assert_equal "ee519de971e6ec8961f5efa06c6ed191", @project.donations.first._donationid
15
- end
16
-
17
- def test_essay_setup
18
- assert_equal "0000023f507999464aa2b78875b7e5d6", @project.essay._projectid
19
- end
20
-
21
- def test_teacher_setup
22
- assert_equal "5ac258059d9c4fc4db5c1a92b7204db0", @project.teacher._teacher_acctid
23
- end
24
-
25
- def test_resources_setup
26
- assert_equal "179328a86f77fd5516d122f371c41d32", @project.resources.first._resourceid
27
- end
28
-
29
- def test_school_setup
30
- assert_equal "c8eafeea02033a1cacd629b410668d55", @project.school._schoolid
31
- end
32
-
33
- end
@@ -1,17 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
-
3
- class ResourceTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @resource = DonorsChoose::Data::Resource.order(:_resourceid).first
7
- end
8
-
9
- def test_resource_setup
10
- assert_equal "00000170fe6288e0bc4d136e7d9b5ff2", @resource._resourceid
11
- end
12
-
13
- def test_project_setup
14
- assert_equal "401699836249c08c7a686b33e243b826", @resource.project._projectid
15
- end
16
-
17
- end
@@ -1,16 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
-
3
- class SchoolTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @school = DonorsChoose::Data::School.order(:_schoolid).first
7
- end
8
-
9
- def test_school_setup
10
- assert_equal "00064eac8b3d1f6dea8a07559922ed58", @school._schoolid
11
- end
12
-
13
- def test_project_setup
14
- assert_equal "2934f1c8ae5069a41fe601dcf57601be", @school.projects.first._projectid
15
- end
16
- end
@@ -1,21 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
-
3
- class TeacherTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @teacher = DonorsChoose::Data::Teacher.order(:_teacher_acctid).first
7
- end
8
-
9
- def test_teacher_setup
10
- assert_equal "0000fc70ad0a307d08f88a484dd99cb4", @teacher._teacher_acctid
11
- end
12
-
13
- def test_projects_setup
14
- assert_equal "dde9ff3a749c46a5d6d6be4f37b0dba6", @teacher.projects.first._projectid
15
- end
16
-
17
- def test_schools_setup
18
- assert_equal "3a379fd45cb12c92c3c4283e97421111", @teacher.schools.first._schoolid
19
- end
20
-
21
- end
@@ -1,15 +0,0 @@
1
- require 'test/unit'
2
-
3
- require 'rubygems'
4
-
5
- require File.expand_path(File.dirname(__FILE__) + "/../lib/donors_choose/data")
6
-
7
- postgres_config = { :adapter => "postgresql",
8
- :host => "localhost",
9
- :username => "postgres",
10
- :password => "password",
11
- :port => 5432,
12
- :database => "donors_choose_data",
13
- :schema_search_path => "public" }
14
-
15
- DonorsChoose::Data.connect postgres_config