Переглянути джерело

Add case officer search for Northgate

tags/v0.5.0
Adrian Short 4 роки тому
джерело
коміт
f2e42cec22
Підписаний недовіреним користувачем: adrian Ідентифікатор GPG ключа: 4B54F9AE91AB06BB
4 змінених файлів з 20 додано та 1 видалено
  1. +1
    -0
      README.md
  2. +1
    -1
      lib/uk_planning_scraper/authority.rb
  3. +11
    -0
      lib/uk_planning_scraper/authority_scrape_params.rb
  4. +7
    -0
      lib/uk_planning_scraper/northgate.rb

+ 1
- 0
README.md Переглянути файл

@@ -106,6 +106,7 @@ keywords("hip gable")
applicant_name("Mr and Mrs Smith") # Currently Idox only
application_type("Householder") # Currently Idox only
development_type("") # Currently Idox only
case_officer_code("100000") # Northgate only

scrape # runs the scraper
```


+ 1
- 1
lib/uk_planning_scraper/authority.rb Переглянути файл

@@ -70,7 +70,7 @@ module UKPlanningScraper
def system
if @url.match(/search\.do\?action=advanced/i)
'idox'
elsif @url.match(/generalsearch\.aspx/i)
elsif @url.match(/\.aspx/i)
'northgate'
elsif @url.match(/ocellaweb/i)
'ocellaweb'


+ 11
- 0
lib/uk_planning_scraper/authority_scrape_params.rb Переглянути файл

@@ -62,6 +62,17 @@ module UKPlanningScraper
self
end

def case_officer_code(s)
unless system == 'northgate'
raise NoMethodError.new("case_officer_code is only implemented for Northgate. \
This authority (#{@name}) is #{system.capitalize}.")
end
check_class(s, String)
@scrape_params[:case_officer_code] = s.strip
self
end

def application_type(s)
unless system == 'idox'
raise NoMethodError.new("application_type is only implemented for \


+ 7
- 0
lib/uk_planning_scraper/northgate.rb Переглянути файл

@@ -24,6 +24,7 @@ module UKPlanningScraper
'csbtnSearch' => 'Search' # required
}

# Keywords
form_vars['txtProposal'] = params[:keywords]

# Date received from and to
@@ -50,6 +51,12 @@ module UKPlanningScraper
form_vars['dateEnd'] = params[:decided_to].to_s if params[:decided_to] # YYYY-MM-DD
end

# Case officer code
if params[:case_officer_code]
form_vars['cboCaseOfficerCode'] = params[:case_officer_code]
@url.sub!('GeneralSearch.aspx', 'CaseOfficerWorkloadSearch.aspx')
end

logger.info "Form variables: #{form_vars.to_s}"

headers = {


Завантаження…
Відмінити
Зберегти