blob: 6ec53b750ff036479c32a3240a56ad73054599a4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
require 'uri'
require 'open-uri'
namespace :postcodes do
desc "Fetch postcode database from Bring"
task :fetch, [:data_path] do |t, args|
args.with_defaults(:data_path => 'data')
uri = URI.parse('http://www.bring.no/hele-bring/forside/_attachment/159761')
filename = File.join(args.data_path, 'Postnummerregister_ansi.txt')
puts "Downloading postcodes to: #{filename}..."
IO.write(filename, uri.read)
end
end
|