|
@@ -2,7 +2,7 @@ require 'csv' |
|
|
|
|
|
|
|
|
module UKPlanningScraper |
|
|
module UKPlanningScraper |
|
|
class Authority |
|
|
class Authority |
|
|
attr_reader :name, :url |
|
|
|
|
|
|
|
|
attr_reader :name, :url, :system |
|
|
|
|
|
|
|
|
@@authorities = [] |
|
|
@@authorities = [] |
|
|
|
|
|
|
|
@@ -12,6 +12,19 @@ module UKPlanningScraper |
|
|
@tags = [] # Strings in arbitrary order |
|
|
@tags = [] # Strings in arbitrary order |
|
|
@applications = [] # Application objects |
|
|
@applications = [] # Application objects |
|
|
@scrape_params = {} |
|
|
@scrape_params = {} |
|
|
|
|
|
|
|
|
|
|
|
# Determine @system when Authority is created |
|
|
|
|
|
if @url.match(/search\.do\?action=advanced/i) |
|
|
|
|
|
@system = 'idox' |
|
|
|
|
|
elsif @url.match(/generalsearch\.aspx/i) |
|
|
|
|
|
@system = 'northgate' |
|
|
|
|
|
elsif @url.match(/ocellaweb/i) |
|
|
|
|
|
@system = 'ocellaweb' |
|
|
|
|
|
elsif @url.match(/\/apas\//) |
|
|
|
|
|
@system = 'agileplanning' |
|
|
|
|
|
else |
|
|
|
|
|
@system = 'unknownsystem' |
|
|
|
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def scrape(options = {}) |
|
|
def scrape(options = {}) |
|
@@ -67,20 +80,6 @@ module UKPlanningScraper |
|
|
@tags.include?(tag) |
|
|
@tags.include?(tag) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def system |
|
|
|
|
|
if @url.match(/search\.do\?action=advanced/i) |
|
|
|
|
|
'idox' |
|
|
|
|
|
elsif @url.match(/generalsearch/i) |
|
|
|
|
|
'northgate' |
|
|
|
|
|
elsif @url.match(/ocellaweb/i) |
|
|
|
|
|
'ocellaweb' |
|
|
|
|
|
elsif @url.match(/\/apas\//) |
|
|
|
|
|
'agileplanning' |
|
|
|
|
|
else |
|
|
|
|
|
'unknownsystem' |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def self.all |
|
|
def self.all |
|
|
@@authorities |
|
|
@@authorities |
|
|
end |
|
|
end |
|
|