Module: Fias::Import::DownloadService

Defined in:
lib/fias/import/download_service.rb

Constant Summary collapse

OPTIONS =
{
  body: %(<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetLastDownloadFileInfo
  xmlns="http://fias.nalog.ru/WebServices/Public/DownloadService.asmx/" />
</soap:Body>
</soap:Envelope>
),
  headers: {
    'SOAPAction' => 'http://fias.nalog.ru/WebServices/Public/DownloadService.asmx/GetLastDownloadFileInfo',
    'Content-Type' => 'text/xml; encoding=utf-8'
  }
}

Class Method Summary collapse

Class Method Details

.urlObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/fias/import/download_service.rb', line 4

def url
  response = HTTParty.post(
    'http://fias.nalog.ru/WebServices/Public/DownloadService.asmx',
    OPTIONS
  )

  matches =
    response.body.match(/<FiasCompleteDbfUrl>(.*)<\/FiasCompleteDbfUrl>/)

  matches[1] if matches
end