Another bug

11 views
Skip to first unread message

Tim Booher

unread,
Jun 25, 2011, 11:08:35 AM6/25/11
to govkit
Opened Rails console

Is this the result of a recent modification?

GovKit::OpenCongress::Bill.most_blogged_bills_this_week
TypeError: can't convert String into Integer
from /Users/Tim/.rvm/gems/ruby-1.9.2-p180@cba/bundler/gems/
govkit-4ad467e307d8/lib/gov_kit/open_congress/bill.rb:128:in `[]'
from /Users/Tim/.rvm/gems/ruby-1.9.2-p180@cba/bundler/gems/
govkit-4ad467e307d8/lib/gov_kit/open_congress/bill.rb:128:in
`parse_results'
from /Users/Tim/.rvm/gems/ruby-1.9.2-p180@cba/bundler/gems/
govkit-4ad467e307d8/lib/gov_kit/open_congress/bill.rb:31:in
`most_blogged_bills_this_week'
from (irb):6
from /Users/Tim/.rvm/gems/ruby-1.9.2-p180@cba/gems/railties-3.0.7/lib/
rails/commands/console.rb:44:in `start'
from /Users/Tim/.rvm/gems/ruby-1.9.2-p180@cba/gems/railties-3.0.7/lib/
rails/commands/console.rb:8:in `start'
from /Users/Tim/.rvm/gems/ruby-1.9.2-p180@cba/gems/railties-3.0.7/lib/
rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

Nathaniel Barnes

unread,
Jun 25, 2011, 6:01:20 PM6/25/11
to govkit
Long story short it looks like the JSON returned from the OpenCongress
API has changed recently. It used to return a hash with a key called
"people" (in the example of a person), which was an array to sort
through. Now it is returning an array by default. Without the
extraneous hash key. None of the specs would catch it since they're
mocks. It's a simple fix (just change the object's "parse_results"
method, however I'd say that we should probably make sure this was an
intentional change first.

Tim Booher

unread,
Jun 25, 2011, 10:05:24 PM6/25/11
to gov...@googlegroups.com
Have you changed this in the recent code?

At this point, I am parsing govtrack directly since it seem much more
reliable, but I am interested to continuing to look at some of the
extra data govkit provides.

best,

Tim

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Tim Booher
www.theboohers.org | t...@theboohers.org
703.649.4264 (home) | 571.256.2161 (work)
(703) 822-7863 (mobile)

Nathaniel Barnes

unread,
Jun 25, 2011, 10:52:34 PM6/25/11
to govkit
I have a preliminary fix on my personal repository, but I'm waiting to
hear if this was an intentional change before I open any pull
requests. I don't actually work for PPF, I'm just a random OSS dev who
also uses govkit :)
> Tim Booherwww.theboohers.org| t...@theboohers.org

David Moore

unread,
Jun 26, 2011, 10:44:15 AM6/26/11
to govkit

Hi Nate,

Caught your note in #opencongress on IRC yesterday, sorry we missed
you -- in any case, Carl Tashian here is the right person to check
with on API issues -- he'll be back online tomorrow, Monday, and will
see these. Glad to have your involvement, have a good Sunday.

-David

Nathaniel Barnes

unread,
Jun 26, 2011, 11:13:11 PM6/26/11
to govkit
Thanks David,

No big deal, I was fairly busy with family this weekend, so I couldn't
stick around on IRC. I'll go ahead and open up a pull request with the
necessary fix to get the Bill and Person classes working again. Though
I do some potential for some refactoring, so I may do some of that
later to.

If Carl says that this was a mistake or something, then we can just
close the pull request, no big deal.

Carl Tashian

unread,
Jun 27, 2011, 1:15:27 PM6/27/11
to gov...@googlegroups.com
hey guys -- this is all fixed now. Thanks Nate for spotting this one.

best,
Carl
Reply all
Reply to author
Forward
0 new messages