govkit 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +19 -2
- data/VERSION +1 -1
- data/generators/govkit/govkit_generator.rb +1 -1
- data/govkit.gemspec +2 -2
- metadata +3 -3
data/README.markdown
CHANGED
@@ -17,14 +17,31 @@ From gemcutter:
|
|
17
17
|
|
18
18
|
Add govkit to your environment.rb or Gemfile
|
19
19
|
|
20
|
-
Run <code>rails generate govkit</code> to copy a config file into <code>config/initializers/govkit.rb</code>. You will need to add your API keys to this config file.
|
20
|
+
Run <code>rails generate govkit</code> (Rails 3.x) or <code>script/generate govkit</code> (Rails 2.x) to copy a config file into <code>config/initializers/govkit.rb</code>. You will need to add your API keys to this config file.
|
21
21
|
|
22
|
-
# Examples
|
22
|
+
# Usage Examples
|
23
23
|
|
24
24
|
>> GovKit::OpenStates::State.find_by_abbreviation('CA')
|
25
25
|
>> GovKit::VoteSmart::Address.find(votesmart_candidate_id)
|
26
26
|
>> GovKit::OpenCongress::Bill.find(:number => 5479, :type => 'h', :congress => '111')
|
27
27
|
|
28
|
+
Objects returned from GovKit will have attributes for each field coming back from the API:
|
29
|
+
|
30
|
+
>> x = GovKit::OpenStates::State.find_by_abbreviation('CA')
|
31
|
+
=> #<GovKit::OpenStates::State:0x00000100f6a5a8 @attributes={"lower_chamber_title"=>"Assemblymember", "lower_chamber_name"=>"Assembly", "upper_chamber_title"=>"Senator", "terms"=>[#<GovKit::OpenStates::State::Term:0x00000100f2a8e0 @attributes={"....
|
32
|
+
>> x.name
|
33
|
+
=> "California"
|
34
|
+
|
35
|
+
GovKit will raise GovKit::ResourceNotFound if a requested item isn't available.
|
36
|
+
|
37
|
+
# Testing & Debugging
|
38
|
+
|
39
|
+
For debugging purposes, there's a raw_response reader provided for each object, which typically returns an HTTParty::Response object. To see the body of the HTTP response, you might look here:
|
40
|
+
|
41
|
+
(continuing the example from above)
|
42
|
+
>> x.raw_response.response.body
|
43
|
+
=> "{\n \"lower_chamber_title\": \"Assemblymember\", \n \"lower_chamber_name\": \"Assembly\", \n ....
|
44
|
+
|
28
45
|
# Bugs? Questions?
|
29
46
|
|
30
47
|
Please join the [Govkit Google Group](http://groups.google.com/group/govkit), especially if you'd like to talk about a new feature and get announcements.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/govkit.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{govkit}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Participatory Politics Foundation", "Srinivas Aki", "Carl Tashian"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-16}
|
13
13
|
s.description = %q{Govkit lets you quickly get encapsulated Ruby objects for common open government APIs. We're starting with Sunlight's Open States API and the Project Vote Smart API.}
|
14
14
|
s.email = %q{carl@ppolitics.org}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 2
|
9
|
+
version: 0.3.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Participatory Politics Foundation
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-09-
|
19
|
+
date: 2010-09-16 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|