adrianshort / uk_planning_scraper

A Ruby gem to get planning applications data from UK council websites.
GNU Lesser General Public License v3.0
27 stars 19 forks source link

Enforce scrape parameters #15

Closed adrianshort closed 5 years ago

adrianshort commented 5 years ago

Currently the scrape params are in a hash that doesn't get checked. The user has no way of knowing which of them have affected their scrape results.

We should check the params and raise an exception if an invalid parameter is present.

adrianshort commented 5 years ago

One way to do this might be to use method chaining instead of throwing a hash parameter at the scrape method.

eg. auth.validated_days(7).keywords('electric vehicle').scrape

Wrapping each parameter in its own method would be a good way of organising the code internally. And by definition the parameters would be enforced because using a non-existent parameter would throw a NoMethodError exception.