danwoolley-numbertwopencil 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/numbertwopencil.rb +21 -0
- data/numbertwopencil.gemspec +2 -2
- metadata +2 -2
data/lib/numbertwopencil.rb
CHANGED
|
@@ -111,6 +111,27 @@ class NumberTwoPencil
|
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
+
# Example:
|
|
115
|
+
# data = foo.education_com_getBrandingData "city" => "Boca Raton", "state" => "FL"
|
|
116
|
+
# p data
|
|
117
|
+
def education_com_getBrandingData(params)
|
|
118
|
+
# Allowed params: city, state, schoolid, nces_id
|
|
119
|
+
# Returns an array of school data in hashes, or nil, or raises an error
|
|
120
|
+
|
|
121
|
+
url = "#{@@education_com_webservice_url}?sn=sf&f=gbd&resf=json&key=#{@apikey}"
|
|
122
|
+
params.each { |key, value| url << "&#{key}=#{value}" }
|
|
123
|
+
|
|
124
|
+
# The entire JSON data structure
|
|
125
|
+
data = fetch_result url
|
|
126
|
+
if data == nil or data.empty?
|
|
127
|
+
return nil
|
|
128
|
+
elsif Hash === data and data.has_key?("faultCode")
|
|
129
|
+
raise "#{data["faultType"].capitalize} #{data["faultCode"]}: #{data["faultString"].capitalize}"
|
|
130
|
+
else
|
|
131
|
+
return data
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
114
135
|
private
|
|
115
136
|
|
|
116
137
|
def fetch_result(url)
|
data/numbertwopencil.gemspec
CHANGED
|
@@ -18,8 +18,8 @@ end
|
|
|
18
18
|
|
|
19
19
|
Gem::Specification.new do |s|
|
|
20
20
|
s.name = "numbertwopencil"
|
|
21
|
-
s.version = "0.1.
|
|
22
|
-
s.date = "
|
|
21
|
+
s.version = "0.1.4"
|
|
22
|
+
s.date = "2009-01-15"
|
|
23
23
|
s.summary = "Ruby library for accessing school data using the education.com web services."
|
|
24
24
|
s.email = "danwoolley@gmail.com"
|
|
25
25
|
s.homepage = "http://github.com/danwoolley/numbertwopencil"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: danwoolley-numbertwopencil
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dan Woolley
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date:
|
|
12
|
+
date: 2009-01-15 00:00:00 -08:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|