@@ -84,6 +84,16 @@ module UKPlanningScraper | |||||
self | self | ||||
end | end | ||||
def include_property | |||||
unless system == 'idox' | |||||
raise NoMethodError.new("include_property is only implemented for \ | |||||
Idox. This authority (#{@name}) is #{system.capitalize}.") | |||||
end | |||||
@scrape_params[:include_property] = true | |||||
self | |||||
end | |||||
private | private | ||||
# Handle the simple params with this | # Handle the simple params with this | ||||
@@ -129,6 +129,8 @@ module UKPlanningScraper | |||||
puts "#{i + 1} of #{apps.size}" | puts "#{i + 1} of #{apps.size}" | ||||
parse_info_url(app) if app.info_url | parse_info_url(app) if app.info_url | ||||
next unless params[:include_property] | |||||
parse_property_url(app) if app.property_url | parse_property_url(app) if app.property_url | ||||
parse_property_detail_urls(app) if app.property_detail_urls | parse_property_detail_urls(app) if app.property_detail_urls | ||||
end # scrape summary tab for apps | end # scrape summary tab for apps | ||||
@@ -0,0 +1,25 @@ | |||||
require 'spec_helper' | |||||
describe UKPlanningScraper::Authority do | |||||
describe '#include_property' do | |||||
let(:scraper) { UKPlanningScraper::Authority.named(authority_name) } | |||||
context 'for 2 days with property details' do | |||||
let(:authority_name) { 'Cardiff' } | |||||
it 'returns apps' do | |||||
apps = VCR.use_cassette("#{self.class.description}") { | |||||
scraper.include_property | |||||
.decided_from(Date.new(2019, 4, 8)) | |||||
.decided_to(Date.new(2019, 4, 9)) | |||||
.scrape(delay: 0) | |||||
} | |||||
pp apps | |||||
end | |||||
end | |||||
end | |||||
end |