浏览代码

Add case officer search for Northgate

tags/v0.5.0
Adrian Short 4 年前
父节点
当前提交
f2e42cec22
由未授信的用户签名: adrian GPG 密钥 ID: 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 = {


正在加载...
取消
保存