File: pdok_nl.rb

package info (click to toggle)
ruby-geocoder 1.8.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 900 kB
  • sloc: ruby: 8,419; makefile: 3
file content (62 lines) | stat: -rw-r--r-- 889 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
require 'geocoder/results/base'

module Geocoder::Result
  class PdokNl < Base

    def response_attributes
      @data
    end

    def coordinates
      @data['centroide_ll'][6..-2].split(' ').map(&:to_f).reverse
    end

    def formatted_address
      @data['weergavenaam']
    end

    alias_method :address, :formatted_address

    def province
      @data['provincienaam']
    end

    alias_method :state, :province

    def city
      @data['woonplaatsnaam']
    end

    def district
      @data['gemeentenaam']
    end

    def street
      @data['straatnaam']
    end

    def street_number
      @data['huis_nlt']
    end

    def address_components
      @data
    end

    def state_code
      @data['provinciecode']
    end

    def postal_code
      @data['postcode']
    end

    def country
      "Netherlands"
    end

    def country_code
      "NL"
    end
  end
end