fed_spending 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.autotest ADDED
@@ -0,0 +1 @@
1
+ require 'autotest/bundler'
data/.gemtest ADDED
File without changes
data/.gitignore ADDED
@@ -0,0 +1,41 @@
1
+ !.gitignore
2
+ *.gem
3
+ *.rbc
4
+ *.sw[a-p]
5
+ *.tmproj
6
+ *.tmproject
7
+ *.un~
8
+ *~
9
+ .DS_Store
10
+ .Spotlight-V100
11
+ .Trashes
12
+ ._*
13
+ .bundle
14
+ .config
15
+ .directory
16
+ .elc
17
+ .redcar
18
+ .yardoc
19
+ /.emacs.desktop
20
+ /.emacs.desktop.lock
21
+ Desktop.ini
22
+ Gemfile.lock
23
+ Icon?
24
+ InstalledFiles
25
+ Session.vim
26
+ Thumbs.db
27
+ \#*\#
28
+ _yardoc
29
+ auto-save-list
30
+ coverage
31
+ doc/
32
+ lib/bundler/man
33
+ pkg
34
+ pkg/*
35
+ rdoc
36
+ spec/reports
37
+ test/tmp
38
+ test/version_tmp
39
+ tmp
40
+ tmtags
41
+ tramp
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format=nested
3
+ --backtrace
data/.yardopts ADDED
@@ -0,0 +1,3 @@
1
+ --markup markdown
2
+ -
3
+ LICENSE.md
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gem_template.gemspec
4
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,10 @@
1
+ Copyright (c) 2011, Code for America
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+ * Neither the name of Code for America nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9
+
10
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # The Fed Spending Ruby Gem
2
+
3
+ A thin wrapper for the FedSpending API sponsored by Code for America.
4
+
5
+ Please see [FedSpending.org](http://www.fedspending.org/apidoc.php) for a full list of options
6
+
7
+
8
+ Usage
9
+ -----
10
+ ```ruby
11
+
12
+ require 'fed_spending'
13
+ FedSpending.rcv({:detail => -1, :recipient_state => 'IA'})
14
+ # Returns a hash of the summary of modified recovery data on Federal contracts for the state of Iowa
15
+
16
+ FedSpending.faads({:detail => -1, :recipient_name => 'Smith', :fiscal_year => 2006})
17
+ # Returns a hash of FAADS Contracts from 2006 with the recipient name of Smith
18
+
19
+ FedSpending.fpds({:detail => -1, :state => 'AL'})
20
+ # Returns a hash of the modified FPDS data on Federal contracts from the state of Alabama
21
+
22
+ ```
23
+
24
+
25
+ Contributing
26
+ ------------
27
+ In the spirit of [free
28
+ software](http://www.fsf.org/licensing/essays/free-sw.html),
29
+ **everyone** is encouraged to help improve this project.
30
+
31
+ Here are some ways *you* can contribute:
32
+
33
+ * by using alpha, beta, and prerelease versions
34
+ * by reporting bugs
35
+ * by suggesting new features
36
+ * by writing or editing documentation
37
+ * by writing specifications
38
+ * by writing code (**no patch is too small**: fix typos, add comments,
39
+ clean up inconsistent whitespace)
40
+ * by refactoring code
41
+ * by resolving [issues](https://github.com/codeforamerica/fed_spending_ruby/issues)
42
+ * by reviewing patches
43
+
44
+ Submitting an Issue
45
+ -------------------
46
+ We use the [GitHub issue
47
+ tracker](https://github.com/codeforamerica/fed_spending_ruby/issues) to track bugs and
48
+ features. Before submitting a bug report or feature request, check to
49
+ make sure it hasn't already
50
+ been submitted. You can indicate support for an existing issuse by
51
+ voting it up. When submitting a
52
+ bug report, please include a [Gist](https://gist.github.com/) that
53
+ includes a stack trace and any
54
+ details that may be necessary to reproduce the bug, including your gem
55
+ version, Ruby version, and
56
+ operating system. Ideally, a bug report should include a pull request
57
+ with failing specs.
58
+
59
+ Submitting a Pull Request
60
+ -------------------------
61
+ 1. Fork the project.
62
+ 2. Create a topic branch.
63
+ 3. Implement your feature or bug fix.
64
+ 4. Add documentation for your feature or bug fix.
65
+ 5. Run <tt>bundle exec rake doc:yard</tt>. If your changes are not 100%
66
+ documented, go back to step 4.
67
+ 6. Add specs for your feature or bug fix.
68
+ 7. Run <tt>bundle exec rake spec</tt>. If your changes are not 100%
69
+ covered, go back to step 6.
70
+ 8. Commit and push your changes.
71
+ 9. Submit a pull request. Please do not include changes to the gemspec,
72
+ version, or history file. (If you want to create your own version for
73
+ some reason, please do so in a separate commit.)
74
+
75
+ Copyright
76
+ ---------
77
+ Copyright (c) 2011 Code for America
78
+ See
79
+ [LICENSE](https://github.com/codeforamerica/fed_spending_ruby/blob/master/LICENSE.md)
80
+ for details.
81
+
82
+ [![Code for America
83
+ Tracker](http://stats.codeforamerica.org/codeforamerica/fed_spending_ruby.png)](http://stats.codeforamerica.org/projects/fed_spending_ruby)
data/Rakefile ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task :default => :spec
10
+ task :test => :spec
11
+
12
+ require 'yard'
13
+ namespace :doc do
14
+ YARD::Rake::YardocTask.new do |task|
15
+ task.files = ['LICENSE.md', 'lib/**/*.rb']
16
+ task.options = ['--markup', 'markdown']
17
+ end
18
+ end
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/fed_spending/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = 'fed_spending'
6
+ gem.version = FedSpending::VERSION
7
+ gem.author = "blakeshall"
8
+ gem.email = 'blake@codeforamerica.org'
9
+ gem.homepage = ''
10
+ gem.summary = %q{A Ruby wrapper for the FedSpending API}
11
+ gem.description = %q{A Code for America sponsored Ruby wrapper for the FedSpending API. See FedSpending.org for more information.}
12
+
13
+ gem.files = `git ls-files`.split("\n")
14
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
16
+ gem.require_paths = ['lib']
17
+
18
+ gem.add_development_dependency 'ZenTest', '~> 4.5'
19
+ gem.add_development_dependency 'maruku', '~> 0.6'
20
+ gem.add_development_dependency 'rake', '~> 0.9'
21
+ gem.add_development_dependency 'rspec', '~> 2.6'
22
+ gem.add_development_dependency 'simplecov', '~> 0.4'
23
+ gem.add_development_dependency 'yard', '~> 0.7'
24
+ gem.add_development_dependency 'webmock', '~> 1.6'
25
+
26
+ gem.add_runtime_dependency 'faraday', '~> 0.6.1'
27
+ gem.add_runtime_dependency 'faraday_middleware', '~> 0.6.3'
28
+ gem.add_runtime_dependency 'hashie', '~> 1.0.0'
29
+ #gem.add_runtime_dependency 'multi_json', '~> 1.0.2'
30
+ gem.add_runtime_dependency 'multi_xml', '~> 0.2.2'
31
+ gem.add_runtime_dependency 'rash', '~> 0.3.0'
32
+ end
@@ -0,0 +1,19 @@
1
+ require 'fed_spending/client'
2
+
3
+ module FedSpending
4
+
5
+ def self.client(options={})
6
+ FedSpending::Client.new(options)
7
+ end
8
+
9
+ # Delegate to MicrosoftOpenData::Client.new
10
+ def self.method_missing(method, *args, &block)
11
+ return super unless client.respond_to?(method)
12
+ client.send(method, *args, &block)
13
+ end
14
+
15
+ def self.respond_to?(method, include_private=false)
16
+ client.respond_to?(method, include_private) || super(method, include_private)
17
+ end
18
+
19
+ end
@@ -0,0 +1,14 @@
1
+ require 'fed_spending/client'
2
+ require 'fed_spending/client/connection'
3
+ require 'fed_spending/client/request'
4
+ require 'fed_spending/client/api'
5
+
6
+
7
+ module FedSpending
8
+ class Client
9
+ include FedSpending::Client::Connection
10
+ include FedSpending::Client::Request
11
+ include FedSpending::Client::Api
12
+
13
+ end
14
+ end
@@ -0,0 +1,99 @@
1
+ module FedSpending
2
+ class Client
3
+ module Api
4
+
5
+ # Allows access to modified FPDS data on Federal contracts.
6
+ # @param params [Hash] The parameters for the lookup
7
+ # @param options [Hash] A customizable set of options.
8
+ # @return {Hash}
9
+ # @see http://www.fedspending.org/api_fpds.php
10
+ # @example
11
+ # fpds({:detail => -1, :state => 'AL'})
12
+
13
+ def fpds(params={}, options={})
14
+ if !params[:zip_code].nil?
15
+ params["ZIPCode"] = params[:zip_code]
16
+ params.delete(:zip_code)
17
+ end
18
+ if !params[:vendor_country_code].nil?
19
+ params["vendorCountryCode"] = params[:vendor_country_code]
20
+ params.delete(:vendor_country_code)
21
+ end
22
+ if !params[:state_code].nil?
23
+ params["stateCode"] = params[:state_code]
24
+ params.delete(:state_code)
25
+ end
26
+ if !params[:place_of_performance_zip_code].nil?
27
+ params["placeOfPerformanceZIPCode"] = params[:place_of_performance_zip_code]
28
+ params.delete(:place_of_performance_zip_code)
29
+ end
30
+ if !params[:place_of_performance_country_code].nil?
31
+ params["placeOfPerformanceCountryCode"] = params[:place_of_performance_country_code]
32
+ params.delete(:place_of_performance_country_code)
33
+ end
34
+ if !params[:description_of_contract_requirement].nil?
35
+ params["descriptionOfContractRequirement"] = params[:description_of_contract_requirement]
36
+ params.delete(:description_of_contract_requirement)
37
+ end
38
+ if !params[:piid].nil?
39
+ params["PIID"] = params[:piid]
40
+ params.delete(:piid)
41
+ end
42
+ if !params[:sort_by].nil?
43
+ params["sortby"] = params[:sort_by]
44
+ params.delete(:sort_by)
45
+ end
46
+ request = []
47
+ params.each do|key, value|
48
+ request << "#{key.to_s}=#{value.to_s}"
49
+ end
50
+ get("fpds/fpds.php?datype=X&#{request.join('&')}")
51
+ end
52
+
53
+ # Allows access to modified FAADS data on Federal contracts.
54
+ # @param params [Hash] The parameters for the lookup
55
+ # @param options [Hash] A customizable set of options.
56
+ # @return {Hash}
57
+ # @see http://www.fedspending.org/api_faads.php
58
+ # @example
59
+ # faads({:detail => -1, :recipient_name => 'Smith', :fiscal_year => 2006})
60
+
61
+ def faads(params={}, options={})
62
+ if !params[:sort_by].nil?
63
+ params["sortby"] = params[:sort_by]
64
+ params.delete(:sort_by)
65
+ end
66
+ request = []
67
+ params.each do|key, value|
68
+ request << "#{key.to_s}=#{value.to_s}"
69
+ end
70
+ get("faads/faads.php?datype=X&#{request.join('&')}")
71
+ end
72
+
73
+ # Allows access to modified recovery data on Federal contracts.
74
+ # @param params [Hash] The parameters for the lookup
75
+ # @param options [Hash] A customizable set of options.
76
+ # @return {Hash}
77
+ # @see http://www.fedspending.org/api_rcv.php
78
+ # @example
79
+ # rcv({:detail => -1, :recipient_state => 'IA'})
80
+
81
+ def rcv(params={}, options={})
82
+ if !params[:sort_by].nil?
83
+ params["sortp"] = params[:sort_by]
84
+ params.delete(:sort_by)
85
+ end
86
+ if !params[:recipient_state].nil?
87
+ params["recipient_st"] = params[:recipient_state]
88
+ params.delete(:recipient_state)
89
+ end
90
+ request = []
91
+ params.each do|key, value|
92
+ request << "#{key.to_s}=#{value.to_s}"
93
+ end
94
+ get("rcv/rcv.php?datype=X&#{request.join('&')}")
95
+ end
96
+
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,20 @@
1
+ require 'faraday_middleware'
2
+
3
+ module FedSpending
4
+ class Client
5
+ module Connection
6
+ private
7
+
8
+ def connection
9
+ Faraday.new(:url => 'http://www.fedspending.org/') do |connection|
10
+ connection.use Faraday::Request::UrlEncoded
11
+ connection.use Faraday::Response::RaiseError
12
+ connection.use Faraday::Response::Rashify
13
+ connection.use Faraday::Response::ParseXml
14
+ #connection.use Faraday::Response::ParseJson
15
+ connection.adapter(Faraday.default_adapter)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ module FedSpending
2
+ class Client
3
+ module Request
4
+ def get(path, options={})
5
+ request(:get, path, options)
6
+ end
7
+
8
+ private
9
+
10
+ def request(method, path, options)
11
+ response = connection.send(method) do |request|
12
+ request.url(path, options)
13
+ end
14
+ response.body
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ module FedSpending
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,50 @@
1
+ require 'helper'
2
+
3
+ describe FedSpending::Client::Api do
4
+
5
+ before do
6
+ @client = FedSpending::Client.new
7
+ end
8
+
9
+ describe ".fpds" do
10
+ before do
11
+ stub_get("fpds/fpds.php?datype=X&detail=-1&state=AL").
12
+ to_return(:status => 200, :body => fixture("fedspending_search_results.xml"))
13
+ end
14
+
15
+ it "Should return the correct item" do
16
+ test = @client.fpds({:detail => -1, :state => 'AL'})
17
+ a_get("fpds/fpds.php?datype=X&detail=-1&state=AL").should have_been_made
18
+ test.fedspendingSearchResults.data.record.totals.rank_among_states.should == "20"
19
+ end
20
+ end
21
+
22
+ describe ".faads" do
23
+ before do
24
+ stub_get("faads/faads.php?datype=X&detail=-1&recipient_name=Smith&fiscal_year=2006").
25
+ to_return(:status => 200, :body => fixture("faads.xml"))
26
+ end
27
+
28
+ it "Should return the correct item" do
29
+ test = @client.faads({:detail => -1, :recipient_name => 'Smith', :fiscal_year => 2006})
30
+ a_get("faads/faads.php?datype=X&detail=-1&recipient_name=Smith&fiscal_year=2006").should have_been_made
31
+ test.fedspendingSearchResults.data.record.totals.fed_total.should == "131582977"
32
+ end
33
+ end
34
+
35
+ describe ".rcv" do
36
+ before do
37
+ stub_get("rcv/rcv.php?datype=X&detail=-1&recipient_st=IA").
38
+ to_return(:status => 200, :body => fixture("rcv.xml"))
39
+ end
40
+
41
+ it "Should return the correct item" do
42
+ test = @client.rcv({:detail => -1, :recipient_state => 'IA'})
43
+ a_get("rcv/rcv.php?datype=X&detail=-1&recipient_st=IA").should have_been_made
44
+ test.fedspendingSearchResults.data.record.totals.total_net_amount_retained.should == "$1,645,373,746"
45
+ end
46
+ end
47
+
48
+
49
+
50
+ end
@@ -0,0 +1,10 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ describe FedSpending do
5
+ describe ".client" do
6
+ it "should be a FedSpending::Client" do
7
+ FedSpending.client.should be_a FedSpending::Client
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,69 @@
1
+ <?xml version="1.0"?>
2
+ <fedspendingSearchResults xml_format_version="0.7" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.fedspending.org//_summary.xsd">
3
+ <search_criteria>
4
+ <search_criterion field="Recipient Name" value="Smith"/>
5
+ <search_criterion field="Federal Fiscal Year" value="2006"/>
6
+ <search_criterion field="Sort By" value="Recipient Name"/>
7
+ <search_criterion field="Number of records" value="All records for each year"/>
8
+ <search_criterion field="Level of Detail" value="Summary"/>
9
+ <search_criterion field="Type of Report Output" value="XML"/>
10
+ </search_criteria>
11
+ <data compiled_from_government_data_last_released_on="2009-03-18" database="" description="U.S. Federal grants and other assistance" max_records="1000">
12
+ <record detail="summary" description="summary record for search" database="FAADS">
13
+ <totals>
14
+ <fiscal_year>2006</fiscal_year>
15
+ <fed_total>131582977</fed_total>
16
+ <number_of_recipients>653</number_of_recipients>
17
+ <number_of_transactions>1223</number_of_transactions>
18
+ </totals>
19
+ <top_known_congressional_districts description="Top congressional districts where recipients are located" ranked_by="total obligated amount in dollars" maximum_shown="5">
20
+ <congressional_district rank="1" total_obligatedAmount="18126237">Arkansas 3 (John Boozman)</congressional_district>
21
+ <congressional_district rank="2" total_obligatedAmount="10026463">Texas 14 (Ron Paul)</congressional_district>
22
+ <congressional_district rank="3" total_obligatedAmount="9344563">Mississippi 4 (Gene Taylor)</congressional_district>
23
+ <congressional_district rank="4" total_obligatedAmount="6339939">Arkansas 2 (Vic Snyder)</congressional_district>
24
+ <congressional_district rank="5" total_obligatedAmount="4991756">Nebraska 3 (Tom Osborne)</congressional_district>
25
+ </top_known_congressional_districts>
26
+ <top_cfda_programs ranked_by="total obligated amount in dollars" maximum_shown="5">
27
+ <cfda_program rank="1" total_obligatedAmount="20187100">59.008: Physical Disaster Loans</cfda_program>
28
+ <cfda_program rank="2" total_obligatedAmount="19210725">84.268: Federal Direct Student Loans</cfda_program>
29
+ <cfda_program rank="3" total_obligatedAmount="16710440">84.063: Federal Pell Grant Program</cfda_program>
30
+ <cfda_program rank="4" total_obligatedAmount="13254485">10.407: Farm Ownership Loans</cfda_program>
31
+ <cfda_program rank="5" total_obligatedAmount="9952963">93.600: Head Start</cfda_program>
32
+ </top_cfda_programs>
33
+ <top_agencies_providing_assistance ranked_by="total obligated amount in dollars" maximum_shown="5">
34
+ <agency rank="1" total_obligatedAmount="26648200">Small Business Administration</agency>
35
+ <agency rank="2" total_obligatedAmount="19968358">EDUCATION, Department of</agency>
36
+ <agency rank="3" total_obligatedAmount="19525273">DOED - Student Financial Assistance Programs</agency>
37
+ <agency rank="4" total_obligatedAmount="13697635">Dept. Ag. - Farm Service Agency</agency>
38
+ <agency rank="5" total_obligatedAmount="9952963">HHS - Secy. of Health and Human Services</agency>
39
+ </top_agencies_providing_assistance>
40
+ <top_recipients ranked_by="total obligated amount in dollars" maximum_shown="10">
41
+ <recipient rank="1" total_obligatedAmount="22020829">JOHNSON C SMITH UNIVERSITY</recipient>
42
+ <recipient rank="2" total_obligatedAmount="9952963">WM SMITH SR TRI COUNTY CHILD DEV COUNCIL</recipient>
43
+ <recipient rank="3" total_obligatedAmount="8883094">UNIVERSITY OF ARKANSAS FORT SMITH</recipient>
44
+ <recipient rank="4" total_obligatedAmount="8520151">TRUSTEES OF THE SMITH COLLEGE</recipient>
45
+ <recipient rank="5" total_obligatedAmount="6893909">SMITH-KETTLEWELL EYE RESEARCH FOUNDATION</recipient>
46
+ <recipient rank="6" total_obligatedAmount="5663699">PHILANDER SMITH COLLEGE</recipient>
47
+ <recipient rank="7" total_obligatedAmount="4743235">FORT SMITH</recipient>
48
+ <recipient rank="8" total_obligatedAmount="3916000">SMITH, DOLLY V</recipient>
49
+ <recipient rank="9" total_obligatedAmount="2509756">SMITH COLLEGE</recipient>
50
+ <recipient rank="10" total_obligatedAmount="1747861">SMITH BERETANIA APARTMENTS</recipient>
51
+ </top_recipients>
52
+ <assistance_types description="total Federal obligated dollars for each type of governmental assistance">
53
+ <direct_payments_both_specified_and_unrestricted>29235220</direct_payments_both_specified_and_unrestricted>
54
+ <grants_and_cooperative_agreements>57420521</grants_and_cooperative_agreements>
55
+ <insurance>0</insurance>
56
+ <loans_both_direct_and_guaranteed>44927236</loans_both_direct_and_guaranteed>
57
+ <other>0</other>
58
+ </assistance_types>
59
+ <recipient_types description="total Federal obligated dollars for each type of recipient">
60
+ <for_profits>3197953</for_profits>
61
+ <government>15475240</government>
62
+ <higher_education>43987696</higher_education>
63
+ <individuals>45374957</individuals>
64
+ <nonprofits>20128357</nonprofits>
65
+ <other>3418774</other>
66
+ </recipient_types>
67
+ </record>
68
+ </data>
69
+ </fedspendingSearchResults>
@@ -0,0 +1,74 @@
1
+ <?xml version="1.0"?>
2
+ <fedspendingSearchResults xml_format_version="0.7" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.fedspending.org//_summary.xsd">
3
+ <search_criteria>
4
+ <search_criterion field="Contractor State" value="Alabama"/>
5
+ <search_criterion field="Sort By" value="Parent Name"/>
6
+ <search_criterion field="Number of records" value="All records for each year"/>
7
+ <search_criterion field="Level of Detail" value="Summary"/>
8
+ <search_criterion field="Output" value="XML"/>
9
+ </search_criteria>
10
+ <data compiled_from_government_data_last_released_on="2009-05-28" database="" description="U.S. Federal contracts" max_records="1000">
11
+ <record detail="summary" description="summary record for search" database="FPDS">
12
+ <totals>
13
+ <total_ObligatedAmount>53742289960.22</total_ObligatedAmount>
14
+ <rank_among_states>20</rank_among_states>
15
+ <number_of_contractors>5536</number_of_contractors>
16
+ <number_of_transactions>256722</number_of_transactions>
17
+ </totals>
18
+ <extent_of_competition description="total obligated amount dollars by extent of competition in contracts">
19
+ <full_and_open_competition>19966979383.48</full_and_open_competition>
20
+ <full_and_open_competition_but_only_one_bid>10601941343.48</full_and_open_competition_but_only_one_bid>
21
+ <competition_after_exclusion_of_sources>12857546087.54</competition_after_exclusion_of_sources>
22
+ <follow_on_contract>241625000.28</follow_on_contract>
23
+ <not_available_for_competition>3860366283.17</not_available_for_competition>
24
+ <not_competed>5651740475.22</not_competed>
25
+ <unknown>562091387.05</unknown>
26
+ </extent_of_competition>
27
+ <top_known_congressional_districts description="Top congressional districts where work is performed" ranked_by="total obligated amount in dollars" maximum_shown="5">
28
+ <congressional_district rank="1" total_obligatedAmount="13312641030.32">Alabama 5 (Robert E. (Bud) Cramer Jr. / Parker Griffith / Mo Brooks)</congressional_district>
29
+ <congressional_district rank="2" total_obligatedAmount="890079121.52">Alabama 3 (Bob Riley / Mike Rogers)</congressional_district>
30
+ <congressional_district rank="3" total_obligatedAmount="804311083.77">Alabama 6 (Spencer Bachus)</congressional_district>
31
+ <congressional_district rank="4" total_obligatedAmount="676939044.45">Alabama 7 (Earl F. Hilliard / Artur Davis / Terri A. Sewell)</congressional_district>
32
+ <congressional_district rank="5" total_obligatedAmount="639960252.75">Alabama 1 (Sonny Callahan / Jo Bonner)</congressional_district>
33
+ </top_known_congressional_districts>
34
+ <top_products_or_services_sold ranked_by="total obligated amount in dollars" maximum_shown="5">
35
+ <product_or_service_category rank="1" total_obligatedAmount="7302258627.77">Other Defense -- Advanced Development (R&amp;D)</product_or_service_category>
36
+ <product_or_service_category rank="2" total_obligatedAmount="4218584280.22">Engineering and Technical Services</product_or_service_category>
37
+ <product_or_service_category rank="3" total_obligatedAmount="3403350158.25">Defense Missile and Space Systems -- Advanced Development (R&amp;D)</product_or_service_category>
38
+ <product_or_service_category rank="4" total_obligatedAmount="2160072562.22">Construction of Structures and Facilities -- Office Buildings</product_or_service_category>
39
+ <product_or_service_category rank="5" total_obligatedAmount="1986834049.19">Construction of Structures and Facilities -- Miscellaneous Buildings</product_or_service_category>
40
+ </top_products_or_services_sold>
41
+ <top_contracting_agencies ranked_by="total obligated amount in dollars" maximum_shown="5">
42
+ <agency rank="1" total_obligatedAmount="26900259463.69">ARMY, Department of the (except Corps of Engineers Civil Program Financing)</agency>
43
+ <agency rank="2" total_obligatedAmount="7609430750.41">Missile Defense Agency</agency>
44
+ <agency rank="3" total_obligatedAmount="3822142153.11">NAVY, Department of the</agency>
45
+ <agency rank="4" total_obligatedAmount="2686240587.14">STATE, Department of</agency>
46
+ <agency rank="5" total_obligatedAmount="2655716745.56">AIR FORCE, Department of the (Headquarters, USAF)</agency>
47
+ </top_contracting_agencies>
48
+ <top_contractor_parent_companies ranked_by="total obligated amount in dollars" maximum_shown="10">
49
+ <contractor_parent_company rank="1" total_obligatedAmount="7800674430.89">BOEING CO.</contractor_parent_company>
50
+ <contractor_parent_company rank="2" total_obligatedAmount="2811211906.30">CADDELL CONSTRUCTION CO INC</contractor_parent_company>
51
+ <contractor_parent_company rank="3" total_obligatedAmount="2404175424.41">BILL HARBERT INTERNATIONAL CONSTRUCTION</contractor_parent_company>
52
+ <contractor_parent_company rank="4" total_obligatedAmount="2099752796.44">BAE SYSTEMS</contractor_parent_company>
53
+ <contractor_parent_company rank="5" total_obligatedAmount="1521997684.37">COMPUTER SCIENCES CORP.</contractor_parent_company>
54
+ <contractor_parent_company rank="6" total_obligatedAmount="1227524728.49">CAS INC</contractor_parent_company>
55
+ <contractor_parent_company rank="7" total_obligatedAmount="1166174300.87">JVYS</contractor_parent_company>
56
+ <contractor_parent_company rank="8" total_obligatedAmount="1155635142.12">TELEDYNE TECHNOLOGIES, INC.</contractor_parent_company>
57
+ <contractor_parent_company rank="9" total_obligatedAmount="1004686434.56">NEW MOUNTAIN CAPITAL LLC</contractor_parent_company>
58
+ <contractor_parent_company rank="10" total_obligatedAmount="868976643.76">QUANTUM RESEARCH INTL</contractor_parent_company>
59
+ </top_contractor_parent_companies>
60
+ <fiscal_years description="total obligated amount in dollars by year">
61
+ <fiscal_year year="2000">3095382695.72</fiscal_year>
62
+ <fiscal_year year="2001">2993455625.26</fiscal_year>
63
+ <fiscal_year year="2002">4137376279.35</fiscal_year>
64
+ <fiscal_year year="2003">4110313413.23</fiscal_year>
65
+ <fiscal_year year="2004">7228024381.85</fiscal_year>
66
+ <fiscal_year year="2005">5287124586.64</fiscal_year>
67
+ <fiscal_year year="2006">5908807663.16</fiscal_year>
68
+ <fiscal_year year="2007">9066557726.43</fiscal_year>
69
+ <fiscal_year year="2008">9543096909.34</fiscal_year>
70
+ <fiscal_year year="2009">2372150679.24</fiscal_year>
71
+ </fiscal_years>
72
+ </record>
73
+ </data>
74
+ </fedspendingSearchResults>
@@ -0,0 +1,95 @@
1
+ <?xml version="1.0"?>
2
+ <fedspendingSearchResults xml_format_version="0.7" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.fedspending.org//_summary.xsd">
3
+ <search_criteria>
4
+ <search_criterion field="Recipient State" value="Iowa"/>
5
+ <search_criterion field="Sort By" value="Award or Payment Amount"/>
6
+ <search_criterion field="Number of records" value="All records for each year"/>
7
+ <search_criterion field="Cumulative or Quarterly Dataset" value="Cumulative"/>
8
+ <search_criterion field="Level of Detail" value="Summary"/>
9
+ <search_criterion field="Type of Report Output" value="XML"/>
10
+ </search_criteria>
11
+ <data compiled_from_government_data_last_released_on="2011-01-30" database="" description="U.S. Recovery funding data" max_records="1000">
12
+ <record detail="summary" description="summary record for search" database="Recovery">
13
+ <totals>
14
+ <total_net_amount_retained>$1,645,373,746</total_net_amount_retained>
15
+ <net_amount_calculation>
16
+ <received_as_prime_recipients>
17
+ <amount_awarded_from_federal_government>$2,066,346,669</amount_awarded_from_federal_government>
18
+ <amount_awarded_to_sub_recipients>$-989,908,912</amount_awarded_to_sub_recipients>
19
+ <payments_to_vendors>$-319,244,886</payments_to_vendors>
20
+ <net_amount_retained_by_prime_recipients>$757,192,870</net_amount_retained_by_prime_recipients>
21
+ </received_as_prime_recipients>
22
+ <received_as_sub_recipients>
23
+ <amount_awarded_from_prime_recipients>$1,017,785,372</amount_awarded_from_prime_recipients>
24
+ <payments_to_vendors>$-135,558,416</payments_to_vendors>
25
+ <net_amount_retained_by_sub_recipients>$882,226,957</net_amount_retained_by_sub_recipients>
26
+ </received_as_sub_recipients>
27
+ <received_as_vendors>
28
+ <amount_paid_by_prime_and_sub_recipients_to_vendors>$5,953,919</amount_paid_by_prime_and_sub_recipients_to_vendors>
29
+ </received_as_vendors>
30
+ <total_for_this_search>$1,645,373,746</total_for_this_search>
31
+ </net_amount_calculation>
32
+ <total_arra_funds_received_by_primes>1,420,572,755</total_arra_funds_received_by_primes>
33
+ <total_number_of_awards>1,313</total_number_of_awards>
34
+ <total_number_of_recipients>1,225</total_number_of_recipients>
35
+ <total_number_of_FTEs>5,052.22</total_number_of_FTEs>
36
+ </totals>
37
+ <received_as_prime_recipients>
38
+ <amount_awarded>$2,066,346,669</amount_awarded>
39
+ <net_amount_retained>$757,192,870</net_amount_retained>
40
+ <contracts_awarded>$168,599,685</contracts_awarded>
41
+ <grants_awarded>$1,819,544,662</grants_awarded>
42
+ <loans_awarded>$78,202,321</loans_awarded>
43
+ <number_of_awards>1,200</number_of_awards>
44
+ <number_of_recipients>414</number_of_recipients>
45
+ </received_as_prime_recipients>
46
+ <received_as_sub_recipients>
47
+ <amount_awarded>$1,017,785,372</amount_awarded>
48
+ <net_amount_retained>$882,226,957</net_amount_retained>
49
+ <contracts_awarded>$75,192,416</contracts_awarded>
50
+ <grants_awarded>$942,419,722</grants_awarded>
51
+ <loans_awarded>$173,234</loans_awarded>
52
+ <number_of_awards>299</number_of_awards>
53
+ <number_of_recipients>918</number_of_recipients>
54
+ </received_as_sub_recipients>
55
+ <received_as_vendors>
56
+ <amount_of_payments>$5,953,919</amount_of_payments>
57
+ <number_of_payments>9</number_of_payments>
58
+ <number_of_vendors>12</number_of_vendors>
59
+ </received_as_vendors>
60
+ <top_recipients ranked_by="total award amount in dollars" maximum_shown="5">
61
+ <recipient rank="1" award_amount="472339542">EXECUTIVE OFFICE OF THE STATE OF IOWA</recipient>
62
+ <recipient rank="2" award_amount="384378918.1">TRANSPORTATION, IOWA DEPT OF</recipient>
63
+ <recipient rank="3" award_amount="211779381">EDUCATION, IOWA DEPARTMENT OF</recipient>
64
+ <recipient rank="4" award_amount="112328927.17">UNIVERSITY OF IOWA, THE</recipient>
65
+ <recipient rank="5" award_amount="91655809">HUMAN RIGHTS, IOWA DEPARTMENT</recipient>
66
+ <recipient rank="6" award_amount="82990798">NATURAL RESOURCES, IOWA DEPARTMENT OF</recipient>
67
+ <recipient rank="7" award_amount="62574079">IOWA STATE UNIVERSITY</recipient>
68
+ <recipient rank="8" award_amount="53495993">IOWA OFFICE OF ENERGY INDEPENDENCE</recipient>
69
+ <recipient rank="9" award_amount="46542195.34">GROOMS &amp; CO. CONSTRUCTION, INC.</recipient>
70
+ <recipient rank="10" award_amount="37882090.38">DES MOINES INDEPENDENT SCHOOL DISTRICT</recipient>
71
+ </top_recipients>
72
+ <top_place_of_performance_congressional_districts description="Top congressional districts where work is performed" ranked_by="total net amount retained in dollars" maximum_shown="5">
73
+ <congressional_district rank="1" award_amount="496355778.15">Iowa 3 (Leonard L. Boswell)</congressional_district>
74
+ <congressional_district rank="2" award_amount="363122765.77">Iowa 2 (David Loebsack)</congressional_district>
75
+ <congressional_district rank="3" award_amount="317027572.33">Iowa 4 (Tom Latham)</congressional_district>
76
+ <congressional_district rank="4" award_amount="210133169.09">Iowa 5 (Steve King)</congressional_district>
77
+ <congressional_district rank="5" award_amount="209621393.77">Iowa 1 (Bruce L. Braley)</congressional_district>
78
+ </top_place_of_performance_congressional_districts>
79
+ <top_awarding_agencies ranked_by="total award amount in dollars" maximum_shown="5">
80
+ <agency rank="1" award_amount="1007659101.23">Office of Elementary and Secondary Education</agency>
81
+ <agency rank="2" award_amount="430564703.6">Federal Highway Administration</agency>
82
+ <agency rank="3" award_amount="275638255.41">ENERGY, Department of</agency>
83
+ <agency rank="4" award_amount="267383416">Office of Special Education and Rehabilitative Services</agency>
84
+ <agency rank="5" award_amount="160655103">ENVIRONMENTAL PROTECTION AGENCY</agency>
85
+ </top_awarding_agencies>
86
+ <top_cities ranked_by="total award amount in dollars" maximum_shown="5">
87
+ <city rank="1" award_amount="375194236.97">Des Moines, IA</city>
88
+ <city rank="2" award_amount="124374073.72">Iowa City, IA</city>
89
+ <city rank="3" award_amount="89548624.69">Ames, IA</city>
90
+ <city rank="4" award_amount="70702458">Ottumwa, IA</city>
91
+ <city rank="5" award_amount="56888626.02">Cedar Rapids, IA</city>
92
+ </top_cities>
93
+ </record>
94
+ </data>
95
+ </fedspendingSearchResults>
data/spec/helper.rb ADDED
@@ -0,0 +1,48 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ require 'fed_spending'
6
+ require 'rspec'
7
+
8
+ require 'webmock/rspec'
9
+
10
+ def a_delete(path)
11
+ a_request(:delete, 'http://www.fedspending.org/' + path)
12
+ end
13
+
14
+ def a_get(path)
15
+ a_request(:get, 'http://www.fedspending.org/' + path)
16
+ end
17
+
18
+ def a_post(path)
19
+ a_request(:post, 'http://www.fedspending.org/' + path)
20
+ end
21
+
22
+ def a_put(path)
23
+ a_request(:put, 'http://www.fedspending.org/' + path)
24
+ end
25
+
26
+ def stub_delete(path)
27
+ stub_request(:delete, 'http://www.fedspending.org/' + path)
28
+ end
29
+
30
+ def stub_get(path)
31
+ stub_request(:get, 'http://www.fedspending.org/' + path)
32
+ end
33
+
34
+ def stub_post(path)
35
+ stub_request(:post, 'http://www.fedspending.org/' + path)
36
+ end
37
+
38
+ def stub_put(path)
39
+ stub_request(:put, 'http://www.fedspending.org/' + path)
40
+ end
41
+
42
+ def fixture_path
43
+ File.expand_path('../fixtures', __FILE__)
44
+ end
45
+
46
+ def fixture(file)
47
+ File.new(fixture_path + '/' + file)
48
+ end
metadata ADDED
@@ -0,0 +1,205 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fed_spending
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - blakeshall
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-07-26 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: ZenTest
16
+ requirement: &2156526680 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '4.5'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *2156526680
25
+ - !ruby/object:Gem::Dependency
26
+ name: maruku
27
+ requirement: &2156526060 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '0.6'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2156526060
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ requirement: &2156525500 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '0.9'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2156525500
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &2156524900 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.6'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2156524900
58
+ - !ruby/object:Gem::Dependency
59
+ name: simplecov
60
+ requirement: &2156524380 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '0.4'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2156524380
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: &2156523520 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '0.7'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *2156523520
80
+ - !ruby/object:Gem::Dependency
81
+ name: webmock
82
+ requirement: &2156523000 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: '1.6'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *2156523000
91
+ - !ruby/object:Gem::Dependency
92
+ name: faraday
93
+ requirement: &2156522480 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ~>
97
+ - !ruby/object:Gem::Version
98
+ version: 0.6.1
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: *2156522480
102
+ - !ruby/object:Gem::Dependency
103
+ name: faraday_middleware
104
+ requirement: &2156522000 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 0.6.3
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: *2156522000
113
+ - !ruby/object:Gem::Dependency
114
+ name: hashie
115
+ requirement: &2156521460 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ~>
119
+ - !ruby/object:Gem::Version
120
+ version: 1.0.0
121
+ type: :runtime
122
+ prerelease: false
123
+ version_requirements: *2156521460
124
+ - !ruby/object:Gem::Dependency
125
+ name: multi_xml
126
+ requirement: &2156521000 !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: 0.2.2
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: *2156521000
135
+ - !ruby/object:Gem::Dependency
136
+ name: rash
137
+ requirement: &2156520500 !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ~>
141
+ - !ruby/object:Gem::Version
142
+ version: 0.3.0
143
+ type: :runtime
144
+ prerelease: false
145
+ version_requirements: *2156520500
146
+ description: A Code for America sponsored Ruby wrapper for the FedSpending API. See
147
+ FedSpending.org for more information.
148
+ email: blake@codeforamerica.org
149
+ executables: []
150
+ extensions: []
151
+ extra_rdoc_files: []
152
+ files:
153
+ - .autotest
154
+ - .gemtest
155
+ - .gitignore
156
+ - .rspec
157
+ - .yardopts
158
+ - Gemfile
159
+ - LICENSE.md
160
+ - README.md
161
+ - Rakefile
162
+ - fed_spending.gemspec
163
+ - lib/fed_spending.rb
164
+ - lib/fed_spending/client.rb
165
+ - lib/fed_spending/client/api.rb
166
+ - lib/fed_spending/client/connection.rb
167
+ - lib/fed_spending/client/request.rb
168
+ - lib/fed_spending/version.rb
169
+ - spec/fed_spending/api_spec.rb
170
+ - spec/fed_spending_spec.rb
171
+ - spec/fixtures/faads.xml
172
+ - spec/fixtures/fedspending_search_results.xml
173
+ - spec/fixtures/rcv.xml
174
+ - spec/helper.rb
175
+ homepage: ''
176
+ licenses: []
177
+ post_install_message:
178
+ rdoc_options: []
179
+ require_paths:
180
+ - lib
181
+ required_ruby_version: !ruby/object:Gem::Requirement
182
+ none: false
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ required_rubygems_version: !ruby/object:Gem::Requirement
188
+ none: false
189
+ requirements:
190
+ - - ! '>='
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
193
+ requirements: []
194
+ rubyforge_project:
195
+ rubygems_version: 1.8.6
196
+ signing_key:
197
+ specification_version: 3
198
+ summary: A Ruby wrapper for the FedSpending API
199
+ test_files:
200
+ - spec/fed_spending/api_spec.rb
201
+ - spec/fed_spending_spec.rb
202
+ - spec/fixtures/faads.xml
203
+ - spec/fixtures/fedspending_search_results.xml
204
+ - spec/fixtures/rcv.xml
205
+ - spec/helper.rb