everypolitician / everypolitician-popolo

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

Only define dynamic methods if a real one is missing #99

Closed struan closed 8 years ago

struan commented 8 years ago

This updates the dynamic method generation code to loop over each key in the JSON and check for a method getter and if one is missing autogenerate a getter method. Previously we were checking for a setter method which now always fails as the real methods are getter only.

The code that uses any found setter has been removed.

This also adds an .id method to Entity.

Part of #54

struan commented 8 years ago

comments on closed PR :/

So, I think once the various PRs for adding additional methods are merged then in theory we don't need the dynamic code. The only reason I could see us needed it is if we were concerned about breaking code that other people had where they'd augmented the EP JSON but I image we do not in which case, I suspect that just removing the code and adding something in the Changelog is the way to go.

struan commented 8 years ago

However, being super nice the thing to do might be: