Przeglądaj źródła

Add case officer search for Northgate

tags/v0.5.0
Adrian Short 4 lat temu
rodzic
commit
f2e42cec22
Podpisane przez niezaufanego użytkownika: adrian ID klucza GPG: 4B54F9AE91AB06BB
4 zmienionych plików z 20 dodań i 1 usunięć
  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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 = {


Ładowanie…
Anuluj
Zapisz