everypolitician / everypolitician-popolo

Ruby gem for interacting with EveryPolitician data for a legislature
MIT License
7 stars 4 forks source link

update README to reference everypolitician-ruby #33

Open davewhiteland opened 8 years ago

davewhiteland commented 8 years ago

The everypolitician-ruby gem is an easy way to get everypolitician-popolo data, so the README should explicitly say that.

See also everypolitician/everypolitician-ruby#15 which is doing the same, linking back the other way.

tmtmtmtm commented 8 years ago

@davewhiteland did you assign this to yourself because you're actually working on it, or just as a statement of intent for some future point?

chrismytton commented 7 years ago

Looks like this was done in https://github.com/everypolitician/everypolitician-popolo/commit/754bfbbc6782f17116c2e7e31e52a362192b2f08, however the example given doesn't actually work 😞

$ cat example.rb 
require 'everypolitician'

australia = Everypolitician::Index.new.country('Australia')
australia.code # => "AU"
senate = australia.legislature('Senate')
senate.persons.find_by(name: "Aden Ridgeway")

$ ruby example.rb 
example.rb:6:in `<main>': undefined method `persons' for #<Everypolitician::Legislature:0x007fa8e2018050> (NoMethodError)
Did you mean?  person_count

This is because there's no Legislature#persons method, you have to go through Legislature#popolo.

senate.popolo.persons.find_by(name: "Aden Ridgeway")

I wonder if perhaps there should be a Legislature#persons method in everypolitician-ruby?