everypolitician / everypolitician-ruby

Ruby gem for easy access to EveryPolitician data
http://everypolitician.org/
MIT License
14 stars 5 forks source link

Everypolitician::Legislature#latest_term has unexpected behaviour #73

Open chrismytton opened 7 years ago

chrismytton commented 7 years ago

Problem

https://github.com/everypolitician/everypolitician-ruby/commit/5e6d24da92399ac884a3024cbefb1d2df608db89 https://github.com/everypolitician/everypolitician-ruby/pull/67 changed the way the Everypolitician::Legislature#latest_term works. Before that commit it was returning EveryPolitician::LegislativePeriod instances, but it's now returning EveryPolitician::Popolo::LegislativePeriod instances.

This is unexpected behaviour because EveryPolitician::LegislativePeriod represents a legislative period stanza in countries.json whereas EveryPolitician::Popolo::LegislativePeriod represents an legislative period "event" in the legislature's popolo.

Proposed solution

Revert this method to have the previous behaviour. The only way you should be able to access ep-popolo objects is by going through the #popolo method of an Everypolitician::Legislature instance.

Acceptance criteria

Calling Everypolitician::Legislature#latest_term should return an instance of EveryPolitician::LegislativePeriod.

chrismytton commented 7 years ago

Ah sorry, it was actually https://github.com/everypolitician/everypolitician-ruby/pull/67 that introduced the change.

chrismytton commented 7 years ago

So reading through #67 it seems that was the expected behaviour at the time of the change, but I know that @octopusinvitro bumped into the unexpected behaviour I described above last week, so worth having an issue here to at least discuss this :)