microsoft_open_data 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ require 'autotest/bundler'
File without changes
@@ -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
@@ -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 microsoft_open_data.gemspec
4
+ gemspec
@@ -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.
@@ -0,0 +1,85 @@
1
+ Microsoft Open Data Ruby Wrapper
2
+ ================================
3
+
4
+ A Ruby wrapper for the [Microsoft Open Data API](http://ogdisdk.cloudapp.net/Developers).
5
+
6
+
7
+ Usage
8
+ -----
9
+
10
+ ```ruby
11
+
12
+ require 'microsoft_open_data'
13
+
14
+ # Returns hash of all data containers
15
+ MicrosoftOpenData.catalog
16
+
17
+ # Returns hash all services in the District of Columbia container
18
+ MicrosoftOpenData.catalog('dc')
19
+
20
+ # Returns hash all Crime Incidentds from the DC dataset
21
+ MicrosoftOpenData.query('dc', 'CrimeIncidents')
22
+
23
+ ```
24
+
25
+
26
+ Contributing
27
+ ------------
28
+ In the spirit of [free
29
+ software](http://www.fsf.org/licensing/essays/free-sw.html),
30
+ **everyone** is encouraged to help improve this project.
31
+
32
+ Here are some ways *you* can contribute:
33
+
34
+ * by using alpha, beta, and prerelease versions
35
+ * by reporting bugs
36
+ * by suggesting new features
37
+ * by writing or editing documentation
38
+ * by writing specifications
39
+ * by writing code (**no patch is too small**: fix typos, add comments,
40
+ clean up inconsistent whitespace)
41
+ * by refactoring code
42
+ * by resolving [issues](https://github.com/codeforamerica/microsoft_open_data_ruby/issues)
43
+ * by reviewing patches
44
+
45
+ Submitting an Issue
46
+ -------------------
47
+ We use the [GitHub issue
48
+ tracker](https://github.com/codeforamerica/fed_spending_ruby/issues) to track bugs and
49
+ features. Before submitting a bug report or feature request, check to
50
+ make sure it hasn't already
51
+ been submitted. You can indicate support for an existing issuse by
52
+ voting it up. When submitting a
53
+ bug report, please include a [Gist](https://gist.github.com/) that
54
+ includes a stack trace and any
55
+ details that may be necessary to reproduce the bug, including your gem
56
+ version, Ruby version, and
57
+ operating system. Ideally, a bug report should include a pull request
58
+ with failing specs.
59
+
60
+ Submitting a Pull Request
61
+ -------------------------
62
+ 1. Fork the project.
63
+ 2. Create a topic branch.
64
+ 3. Implement your feature or bug fix.
65
+ 4. Add documentation for your feature or bug fix.
66
+ 5. Run <tt>bundle exec rake doc:yard</tt>. If your changes are not 100%
67
+ documented, go back to step 4.
68
+ 6. Add specs for your feature or bug fix.
69
+ 7. Run <tt>bundle exec rake spec</tt>. If your changes are not 100%
70
+ covered, go back to step 6.
71
+ 8. Commit and push your changes.
72
+ 9. Submit a pull request. Please do not include changes to the gemspec,
73
+ version, or history file. (If you want to create your own version for
74
+ some reason, please do so in a separate commit.)
75
+
76
+ Copyright
77
+ ---------
78
+ Copyright (c) 2011 Code for America
79
+ See
80
+ [LICENSE](https://github.com/codeforamerica/microsoft_open_data_ruby/blob/master/LICENSE.md)
81
+ for details.
82
+
83
+ [![Code for America
84
+ Tracker](http://stats.codeforamerica.org/codeforamerica/microsoft_open_data_ruby.png)](http://stats.codeforamerica.org/projects/microsoft_open_data_ruby)
85
+
@@ -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,19 @@
1
+ require 'microsoft_open_data/client'
2
+
3
+ module MicrosoftOpenData
4
+
5
+ def self.client(options={})
6
+ MicrosoftOpenData::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,12 @@
1
+ require 'microsoft_open_data/client'
2
+ require 'microsoft_open_data/client/connection'
3
+ require 'microsoft_open_data/client/request'
4
+ require 'microsoft_open_data/client/api'
5
+
6
+ module MicrosoftOpenData
7
+ class Client
8
+ include MicrosoftOpenData::Client::Connection
9
+ include MicrosoftOpenData::Client::Request
10
+ include MicrosoftOpenData::Client::Api
11
+ end
12
+ end
@@ -0,0 +1,36 @@
1
+ module MicrosoftOpenData
2
+ class Client
3
+ module Api
4
+
5
+ # Returns the lists of containers or list of datasets within a specified container
6
+ # @param container [String] Optional container name
7
+ # @param options [Hash] A customizable set of options.
8
+ # @return {Hash}
9
+ # @see http://ogdisdk.cloudapp.net/Developers
10
+ # @example
11
+ # catalog('dc')
12
+
13
+ def catalog(container=nil, options={})
14
+ if container.nil?
15
+ get("", options)
16
+ else
17
+ get("#{container}", options)
18
+ end
19
+ end
20
+
21
+ # Returns all the data from a specific dataset
22
+ # @param container [String] Container name
23
+ # @param dataset [String] Dataset name
24
+ # @param options [Hash] A customizable set of options.
25
+ # @return {Hash}
26
+ # @see http://ogdisdk.cloudapp.net/Developers
27
+ # @example
28
+ # query('dc', 'CrimeIncidents')
29
+
30
+ def query(container, dataset, options={})
31
+ get("#{container}/#{dataset}", options)
32
+ end
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,19 @@
1
+ require 'faraday_middleware'
2
+
3
+ module MicrosoftOpenData
4
+ class Client
5
+ module Connection
6
+ private
7
+
8
+ def connection
9
+ Faraday.new(:url => 'http://ogdi.cloudapp.net/v1/') 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.adapter(Faraday.default_adapter)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ module MicrosoftOpenData
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 MicrosoftOpenData
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/microsoft_open_data/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = 'microsoft_open_data'
6
+ gem.version = MicrosoftOpenData::VERSION
7
+ gem.author = "blakeshall"
8
+ gem.email = 'blake@codeforamerica.org'
9
+ gem.homepage = ''
10
+ gem.summary = %q{Ruby wrapper for Microsoft Open Government Initiative}
11
+ gem.description = %q{Simple wrapper to access data from the Microsoft Open Government Initiative}
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,29 @@
1
+ <service xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app" xml:base="http://ogdi.cloudapp.net/v1/">
2
+ <workspace>
3
+ <atom:title>Default</atom:title>
4
+ <collection href="bls">
5
+ <atom:title>Bureau of Labor Statistics</atom:title>
6
+ <accept>application/atomsvc+xml</accept>
7
+ </collection>
8
+ <collection href="dc">
9
+ <atom:title>District of Columbia</atom:title>
10
+ <accept>application/atomsvc+xml</accept>
11
+ </collection>
12
+ <collection href="gsa">
13
+ <atom:title>General Services Administration</atom:title>
14
+ <accept>application/atomsvc+xml</accept>
15
+ </collection>
16
+ <collection href="naf">
17
+ <atom:title>New America Foundation</atom:title>
18
+ <accept>application/atomsvc+xml</accept>
19
+ </collection>
20
+ <collection href="ukcots">
21
+ <atom:title>UK Cabinet Office Technical Standards</atom:title>
22
+ <accept>application/atomsvc+xml</accept>
23
+ </collection>
24
+ <collection href="usgs">
25
+ <atom:title>U.S. Geological Survey</atom:title>
26
+ <accept>application/atomsvc+xml</accept>
27
+ </collection>
28
+ </workspace>
29
+ </service>
@@ -0,0 +1,188 @@
1
+ <service xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app" xml:base="http://ogdi.cloudapp.net/v1/dc">
2
+ <workspace>
3
+ <atom:title>Default</atom:title>
4
+ <collection href="AmbulatorySurgicalCenters">
5
+ <atom:title>AmbulatorySurgicalCenters</atom:title>
6
+ </collection>
7
+ <collection href="BankLocations">
8
+ <atom:title>BankLocations</atom:title>
9
+ </collection>
10
+ <collection href="BuildingPermits">
11
+ <atom:title>BuildingPermits</atom:title>
12
+ </collection>
13
+ <collection href="CensusTracts1990">
14
+ <atom:title>CensusTracts1990</atom:title>
15
+ </collection>
16
+ <collection href="CensusTracts2000">
17
+ <atom:title>CensusTracts2000</atom:title>
18
+ </collection>
19
+ <collection href="CharterSchools">
20
+ <atom:title>CharterSchools</atom:title>
21
+ </collection>
22
+ <collection href="ChildCareCenters">
23
+ <atom:title>ChildCareCenters</atom:title>
24
+ </collection>
25
+ <collection href="CommunityGardens">
26
+ <atom:title>CommunityGardens</atom:title>
27
+ </collection>
28
+ <collection href="CompletedConstructionProjects2003">
29
+ <atom:title>CompletedConstructionProjects2003</atom:title>
30
+ </collection>
31
+ <collection href="CompletedConstructionProjects2004">
32
+ <atom:title>CompletedConstructionProjects2004</atom:title>
33
+ </collection>
34
+ <collection href="CompletedConstructionProjects2005">
35
+ <atom:title>CompletedConstructionProjects2005</atom:title>
36
+ </collection>
37
+ <collection href="CompletedConstructionProjects2006">
38
+ <atom:title>CompletedConstructionProjects2006</atom:title>
39
+ </collection>
40
+ <collection href="CompletedConstructionProjects2007">
41
+ <atom:title>CompletedConstructionProjects2007</atom:title>
42
+ </collection>
43
+ <collection href="CompletedConstructionProjects2008">
44
+ <atom:title>CompletedConstructionProjects2008</atom:title>
45
+ </collection>
46
+ <collection href="CompletedConstructionProjects2009">
47
+ <atom:title>CompletedConstructionProjects2009</atom:title>
48
+ </collection>
49
+ <collection href="CrimeIncidents">
50
+ <atom:title>CrimeIncidents</atom:title>
51
+ </collection>
52
+ <collection href="CurrentConstructionProjects">
53
+ <atom:title>CurrentConstructionProjects</atom:title>
54
+ </collection>
55
+ <collection href="DcGovernmentLocations">
56
+ <atom:title>DcGovernmentLocations</atom:title>
57
+ </collection>
58
+ <collection href="DialysisClinics">
59
+ <atom:title>DialysisClinics</atom:title>
60
+ </collection>
61
+ <collection href="ElementarySchoolAttendanceZones">
62
+ <atom:title>ElementarySchoolAttendanceZones</atom:title>
63
+ </collection>
64
+ <collection href="FireStations">
65
+ <atom:title>FireStations</atom:title>
66
+ </collection>
67
+ <collection href="GasStations">
68
+ <atom:title>GasStations</atom:title>
69
+ </collection>
70
+ <collection href="HalfwayHouses">
71
+ <atom:title>HalfwayHouses</atom:title>
72
+ </collection>
73
+ <collection href="HistoricAreas">
74
+ <atom:title>HistoricAreas</atom:title>
75
+ </collection>
76
+ <collection href="HistoricDistricts">
77
+ <atom:title>HistoricDistricts</atom:title>
78
+ </collection>
79
+ <collection href="HistoricStreetLines">
80
+ <atom:title>HistoricStreetLines</atom:title>
81
+ </collection>
82
+ <collection href="HistoricStructures">
83
+ <atom:title>HistoricStructures</atom:title>
84
+ </collection>
85
+ <collection href="HUBZones">
86
+ <atom:title>HUBZones</atom:title>
87
+ </collection>
88
+ <collection href="Hospitals">
89
+ <atom:title>Hospitals</atom:title>
90
+ </collection>
91
+ <collection href="Hotels">
92
+ <atom:title>Hotels</atom:title>
93
+ </collection>
94
+ <collection href="ITSAAwardedEngagements">
95
+ <atom:title>ITSAAwardedEngagements</atom:title>
96
+ </collection>
97
+ <collection href="IndependentSchools">
98
+ <atom:title>IndependentSchools</atom:title>
99
+ </collection>
100
+ <collection href="JuvenileArrestsCharges">
101
+ <atom:title>JuvenileArrestsCharges</atom:title>
102
+ </collection>
103
+ <collection href="LandmarkAreas">
104
+ <atom:title>LandmarkAreas</atom:title>
105
+ </collection>
106
+ <collection href="MetroBusStops">
107
+ <atom:title>MetroBusStops</atom:title>
108
+ </collection>
109
+ <collection href="MetroParkAndRideLots">
110
+ <atom:title>MetroParkAndRideLots</atom:title>
111
+ </collection>
112
+ <collection href="MetroStations">
113
+ <atom:title>MetroStations</atom:title>
114
+ </collection>
115
+ <collection href="MiddleSchoolAttendanceZones">
116
+ <atom:title>MiddleSchoolAttendanceZones</atom:title>
117
+ </collection>
118
+ <collection href="NeighborhoodClusters">
119
+ <atom:title>NeighborhoodClusters</atom:title>
120
+ </collection>
121
+ <collection href="Parks">
122
+ <atom:title>Parks</atom:title>
123
+ </collection>
124
+ <collection href="PlacesOfWorship">
125
+ <atom:title>PlacesOfWorship</atom:title>
126
+ </collection>
127
+ <collection href="PoliceDistricts">
128
+ <atom:title>PoliceDistricts</atom:title>
129
+ </collection>
130
+ <collection href="PoliceServiceAreas">
131
+ <atom:title>PoliceServiceAreas</atom:title>
132
+ </collection>
133
+ <collection href="PoliceStations">
134
+ <atom:title>PoliceStations</atom:title>
135
+ </collection>
136
+ <collection href="PostOffices">
137
+ <atom:title>PostOffices</atom:title>
138
+ </collection>
139
+ <collection href="PrimaryCareCenters">
140
+ <atom:title>PrimaryCareCenters</atom:title>
141
+ </collection>
142
+ <collection href="PublicLibraries">
143
+ <atom:title>PublicLibraries</atom:title>
144
+ </collection>
145
+ <collection href="PublicSchools">
146
+ <atom:title>PublicSchools</atom:title>
147
+ </collection>
148
+ <collection href="PublicSpacePermits">
149
+ <atom:title>PublicSpacePermits</atom:title>
150
+ </collection>
151
+ <collection href="PurchaseOrders">
152
+ <atom:title>PurchaseOrders</atom:title>
153
+ </collection>
154
+ <collection href="RecreationFacilities">
155
+ <atom:title>RecreationFacilities</atom:title>
156
+ </collection>
157
+ <collection href="RecreationParks">
158
+ <atom:title>RecreationParks</atom:title>
159
+ </collection>
160
+ <collection href="RedLightCameras">
161
+ <atom:title>RedLightCameras</atom:title>
162
+ </collection>
163
+ <collection href="RegisteredProperties">
164
+ <atom:title>RegisteredProperties</atom:title>
165
+ </collection>
166
+ <collection href="SHSchoolAttendanceZones">
167
+ <atom:title>SHSchoolAttendanceZones</atom:title>
168
+ </collection>
169
+ <collection href="ServiceRequests">
170
+ <atom:title>ServiceRequests</atom:title>
171
+ </collection>
172
+ <collection href="ShopingCenters">
173
+ <atom:title>ShopingCenters</atom:title>
174
+ </collection>
175
+ <collection href="TrafficCameras">
176
+ <atom:title>TrafficCameras</atom:title>
177
+ </collection>
178
+ <collection href="UniversityLocations">
179
+ <atom:title>UniversityLocations</atom:title>
180
+ </collection>
181
+ <collection href="ZipCodes">
182
+ <atom:title>ZipCodes</atom:title>
183
+ </collection>
184
+ <collection href="ZoningDistricts">
185
+ <atom:title>ZoningDistricts</atom:title>
186
+ </collection>
187
+ </workspace>
188
+ </service>