iceland 0.1.12 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.editorconfig +2 -0
- data/.github/workflows/main.yml +21 -0
- data/.rubocop.yml +10 -2
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/README.md +7 -144
- data/bin/console +1 -0
- data/iceland.gemspec +16 -16
- data/lib/iceland.rb +4 -6
- metadata +30 -50
- data/.codeclimate.yml +0 -16
- data/Rakefile +0 -6
- data/lib/iceland/kennitala.rb +0 -247
- data/lib/iceland/kennitala_string.rb +0 -9
- data/lib/iceland/postal_codes.rb +0 -41
- data/lib/iceland/version.rb +0 -3
- data/lib/postcodes.yml +0 -441
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ea97211b447cc3be1d2158043687c34c885c4c01c3e83a92985ee368b217f499
|
4
|
+
data.tar.gz: ce4867dd56f805db0301dfc9072fb3129d3711a2916b6e94f920181221b7c3a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a7ac739d312168b0549b5a8450bb3343bdc945c5c5fa01edfc6e7579520767868b046ffd640834cc3cf5da9ffe9f4880dc48f1bfc798fd2e34236372cbd0f1a
|
7
|
+
data.tar.gz: 9a78d200a7787530f766682341d8c187cb458104aeacac8ed498362f9b1adf563f1b24714baa999a4683fe66c2e5817aaaca49b21cd89f1ae4c10724ab319d45
|
data/.editorconfig
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: ['push']
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
name: Ruby ${{ matrix.ruby }}
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby-version: ['3.1', '3.0', '2.7']
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v3
|
15
|
+
- name: Set up Ruby
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby }}
|
19
|
+
bundler-cache: true
|
20
|
+
- name: Run rubocop
|
21
|
+
run: bundle exec rubocop
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.6.0
|
3
|
+
NewCops: enable
|
4
|
+
Metrics/BlockLength:
|
5
|
+
Exclude:
|
6
|
+
- 'spec/*'
|
7
|
+
Metrics/ClassLength:
|
8
|
+
Enabled: false
|
9
|
+
Style/OptionalBooleanParameter:
|
10
|
+
Enabled: false
|
1
11
|
Metrics/AbcSize:
|
2
12
|
Max: 20
|
3
|
-
Metrics/ClassLength:
|
4
|
-
Max: 150
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.2
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
[![Build Status](https://travis-ci.org/stefanvignir/iceland_gem.svg)](https://travis-ci.org/stefanvignir/iceland_gem)
|
2
|
-
[![Test Coverage](https://codeclimate.com/github/stefanvignir/iceland_gem/badges/coverage.svg)](https://codeclimate.com/github/stefanvignir/iceland_gem/coverage)
|
3
|
-
[![Code Climate](https://codeclimate.com/github/stefanvignir/iceland_gem/badges/gpa.svg)](https://codeclimate.com/github/stefanvignir/iceland_gem)
|
4
|
-
|
5
1
|
# The Iceland Gem
|
6
2
|
|
7
|
-
The Iceland Gem
|
3
|
+
The Iceland Gem is a metapackage for the `Kennitala` and `Postnumer` gems.
|
4
|
+
|
5
|
+
It is recommended that you use those gems instead. This gems remains online for
|
6
|
+
backwards-compatibility reasons.
|
8
7
|
|
9
8
|
## Installation
|
10
9
|
|
@@ -22,147 +21,11 @@ Or install it yourself as:
|
|
22
21
|
|
23
22
|
$ gem install iceland
|
24
23
|
|
25
|
-
##
|
26
|
-
|
27
|
-
### Postal Codes
|
28
|
-
|
29
|
-
Icelandic postal codes are 3-digit numeric identifiers, with the first digit indicating a region and the rest identifying a specific locale within the region.
|
30
|
-
|
31
|
-
Names of locales are provided in dative form by default as per Icelandic postal convention, but nomative forms can be returned by setting the `force_nominative` parameter to `true` when using the `Iceland.all_postal_codes` and `Iceland.locale_by_postal_code` methods.
|
32
|
-
|
33
|
-
(Note that we use the term "locale" as per Universal Postal Union convention to name the town, city or other location the postal code is assigned to.)
|
34
|
-
|
35
|
-
#### Examples
|
36
|
-
|
37
|
-
```ruby
|
38
|
-
# Get all postal codes, skipping codes assigned to P.O. boxes.
|
39
|
-
# This is useful when generating forms.
|
40
|
-
Iceland.all_postal_codes
|
41
|
-
# => [{:postal_code=>101, :locale=>"Reykjavík"}, {:postal_code=>103, [...]
|
42
|
-
|
43
|
-
# Get the same postal codes in nomative form
|
44
|
-
Iceland.all_postal_codes false, true
|
45
|
-
# => [{:postal_code=>101, :locale=>"Reykjavík"}, {:postal_code=>103, [...]
|
46
|
-
|
47
|
-
# Get all postal codes, including P.O. boxes
|
48
|
-
Iceland.all_postal_codes true
|
49
|
-
# => [{:postal_code=>101, :locale=>"Reykjavík"}, {:postal_code=>103, [...]
|
50
|
-
|
51
|
-
# Get the name of locale based on its postal code.
|
52
|
-
# This is useful when you only save the postal code, but not the locale in a database.
|
53
|
-
Iceland.locale_by_postal_code 311
|
54
|
-
# => "Borgarnesi (dreifbýli)"
|
55
|
-
|
56
|
-
# Get the name of the locale in nominative form
|
57
|
-
Iceland.locale_by_postal_code 311, true
|
58
|
-
# => "Borgarnes (dreifbýli)"
|
59
|
-
```
|
60
|
-
|
61
|
-
### The Kennitala Class
|
62
|
-
|
63
|
-
The Iceland Gem provides a class to handle "kennitala" identifier codes. The class can be used to sanitize the identifiers and read information like the date of birth (or date of registration in the case of companies and organization), age and the type of entity.
|
64
|
-
|
65
|
-
The class does not access external APIs or databases such National Registry or the Company Registry, so names and status (sex/gender, death, bankruptcy, credit rating etc.) cannot be accessed using the class. However, it can be used to sanitize and validate such data before being sent to external APIs, as such services are provided by private companies, which often charge a specific amount for each query.
|
66
|
-
|
67
|
-
#### Uses of kennitala
|
68
|
-
|
69
|
-
Unlike the US Social Security number and equivalents, the kennitala is only used for identification of persons and companies (as well as other registered organizations) — and is often used internally by educational institutions, companies and other organization as a primary identifier for persons (e.g. school, employee, customer and frequent flyer ID). It is not to be used for authentication (i.e. a password) and is not considered a secret per se. While a kennitala can be kept unencrypted in a database, publishing a kennitala or a list of them is generally not considered good practice and might cause liability.
|
70
|
-
|
71
|
-
A kennitala is assigned to every newborn person and foreign nationals residing in Iceland as well as organizations and companies operating there. It is statically assigned and can not be changed.
|
72
|
-
|
73
|
-
Article II, paragraph 10 of the 77/2000 Act on Data Protection (http://www.althingi.is/lagas/nuna/2000077.html) provides the legal framework regarding the use and processing of the kennitala in Iceland:
|
74
|
-
|
75
|
-
> The use of a kennitala is allowed if it has a an objective cause and is necessary to ensure reliable identification of persons. The Data Protection Authority may ban or order the use of kennitala.
|
24
|
+
## Change log
|
76
25
|
|
77
|
-
|
26
|
+
* v2.0.0 - This gem has been changed into a metapackage for the `Kennitala` and `Postnumer` gems.
|
78
27
|
|
79
|
-
|
80
|
-
|
81
|
-
The number 40 is added to the registration day of companies and organizations. Hence, a kennitala for a company registered at January 1 1990 starts with `410190` as opposed to `010190` for a person born that day.
|
82
|
-
|
83
|
-
The century identifier has 3 legal values. `8` for the 19th century, `9` for the 20th century and `0` for the 21st century.
|
84
|
-
|
85
|
-
#### Examples
|
86
|
-
|
87
|
-
##### Working with Kennitala objects
|
88
|
-
|
89
|
-
```ruby
|
90
|
-
# Initialize a Kennitala object.
|
91
|
-
# The string provided may include spaces, hyphens and alphabetical characters,
|
92
|
-
# which will then be erased from the resulting string.
|
93
|
-
k = Kennitala.new(' 010130-2989')
|
94
|
-
# => #<Kennitala:0x007fe35d041bc0 @value="0101302989">
|
95
|
-
|
96
|
-
# Invalid strings are rejected with an argument error
|
97
|
-
f = Kennitala.new('010130-2979')
|
98
|
-
# ArgumentError: Kennitala is invalid
|
99
|
-
|
100
|
-
# If no kennitala string is specified, a random one will be generated
|
101
|
-
r = Kennitala.new
|
102
|
-
# => #<Kennitala:0x007fc589339f18 @value="2009155509">
|
103
|
-
|
104
|
-
# Retrieve the kennitala as a string.
|
105
|
-
# This is a sanitized string, without any non-numeric characters.
|
106
|
-
# Pretty useful when storing it in a database.
|
107
|
-
k.to_s
|
108
|
-
# => "0101302989"
|
109
|
-
|
110
|
-
# Pretty print the kennitala
|
111
|
-
# Adds a space between the 6th and the 7th digits for readability
|
112
|
-
k.pp
|
113
|
-
# => "010130 2989"
|
114
|
-
|
115
|
-
# You can also pass a string to .pp to use as a spacer
|
116
|
-
k.pp('–')
|
117
|
-
# => "010130-2989"
|
118
|
-
|
119
|
-
# You can also pass a cat to the .pp method
|
120
|
-
k.pp('🐈')
|
121
|
-
# => "010130🐈2989"
|
122
|
-
|
123
|
-
# Get the entity type (results in 'person' or 'company')
|
124
|
-
k.entity_type
|
125
|
-
# => "person"
|
126
|
-
|
127
|
-
# It's also possible to use .is_company and .is_person to achieve the same thing
|
128
|
-
k.is_company?
|
129
|
-
# => false
|
130
|
-
|
131
|
-
k.is_person?
|
132
|
-
# => true
|
133
|
-
|
134
|
-
# Cast the kennitala to a Date object
|
135
|
-
k.to_date
|
136
|
-
# => #<Date: 1930-01-01 ((2425978j,0s,0n),+0s,2299161j)>
|
137
|
-
|
138
|
-
# Get the current age of the entity. Useful for age restrictions.
|
139
|
-
k.age
|
140
|
-
# => 86
|
141
|
-
```
|
142
|
-
|
143
|
-
##### Casting strings
|
144
|
-
|
145
|
-
```ruby
|
146
|
-
# Casting a string to a Kennitala object
|
147
|
-
'010130 2989'.to_kt
|
148
|
-
# => #<Kennitala:0x007fc5893286a0 @value="0101302989">
|
149
|
-
|
150
|
-
# Get the current age based on a String
|
151
|
-
'0101302989'.to_kt.age
|
152
|
-
# => 86
|
153
|
-
```
|
154
|
-
|
155
|
-
## Todo
|
156
|
-
|
157
|
-
* Administrative Divisions
|
158
|
-
* Bank accounts
|
159
|
-
* Car plate numbers
|
160
|
-
|
161
|
-
## About the data
|
162
|
-
|
163
|
-
The Postal code data is based on data files provided by Iceland Post. The files are available at http://www.postur.is/um-postinn/posthus/postnumer/gagnaskrar/ and are provided for free for any use by individuals and organizations.
|
164
|
-
|
165
|
-
Strings are expected to be UTF-8.
|
28
|
+
## Usage
|
166
29
|
|
167
30
|
## Development
|
168
31
|
|
data/bin/console
CHANGED
data/iceland.gemspec
CHANGED
@@ -1,21 +1,20 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'iceland
|
5
|
+
require 'iceland'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = 'iceland'
|
8
9
|
spec.version = Iceland::VERSION
|
9
|
-
spec.authors = ['
|
10
|
-
spec.email = ['
|
10
|
+
spec.authors = ['Alda Vigdís']
|
11
|
+
spec.email = ['aldavigdis@aldavigdis.is']
|
12
|
+
|
13
|
+
spec.summary = 'A meta package of the Postnumer and Kennitala gems.'
|
11
14
|
|
12
|
-
spec.summary = 'Handles the Icelandic "kennitala" identification '\
|
13
|
-
'scheme and postal codes'
|
14
|
-
spec.description = 'Adds the Kennitala class. Figures out dates and ages, '\
|
15
|
-
'and sanitizes "kennitala" objects and looks up '\
|
16
|
-
'Icelandic postal codes.'
|
17
15
|
spec.homepage = 'https://github.com/stefanvignir/iceland_gem'
|
18
16
|
spec.license = 'MIT'
|
17
|
+
spec.required_ruby_version = '>= 2.6.0'
|
19
18
|
|
20
19
|
spec.files = `git ls-files -z`
|
21
20
|
.split("\x0")
|
@@ -24,10 +23,11 @@ Gem::Specification.new do |spec|
|
|
24
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
24
|
spec.require_paths = ['lib']
|
26
25
|
|
27
|
-
spec.add_development_dependency 'bundler', '~>
|
28
|
-
spec.add_development_dependency 'rake', '~>
|
29
|
-
spec.add_development_dependency '
|
30
|
-
|
31
|
-
spec.
|
32
|
-
spec.
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.3.7'
|
27
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
28
|
+
spec.add_development_dependency 'rubocop', '~> 1.44'
|
29
|
+
|
30
|
+
spec.add_runtime_dependency 'kennitala', '~> 0.1'
|
31
|
+
spec.add_runtime_dependency 'postnumer', '~> 0.2'
|
32
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
33
33
|
end
|
data/lib/iceland.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iceland
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- Alda Vigdís
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,116 +16,98 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.3.7
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.3.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.0'
|
40
|
+
version: '13.0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rubocop
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
47
|
+
version: '1.44'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
54
|
+
version: '1.44'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: kennitala
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - "~>"
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
76
|
-
type: :
|
61
|
+
version: '0.1'
|
62
|
+
type: :runtime
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
66
|
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
68
|
+
version: '0.1'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
70
|
+
name: postnumer
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
73
|
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
90
|
-
type: :
|
75
|
+
version: '0.2'
|
76
|
+
type: :runtime
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
97
|
-
description:
|
98
|
-
objects and looks up Icelandic postal codes.
|
82
|
+
version: '0.2'
|
83
|
+
description:
|
99
84
|
email:
|
100
|
-
-
|
85
|
+
- aldavigdis@aldavigdis.is
|
101
86
|
executables: []
|
102
87
|
extensions: []
|
103
88
|
extra_rdoc_files: []
|
104
89
|
files:
|
105
|
-
- ".
|
90
|
+
- ".editorconfig"
|
91
|
+
- ".github/workflows/main.yml"
|
106
92
|
- ".gitignore"
|
107
93
|
- ".overcommit.yml"
|
108
94
|
- ".rspec"
|
109
95
|
- ".rubocop.yml"
|
96
|
+
- ".ruby-version"
|
110
97
|
- ".travis.yml"
|
111
98
|
- Gemfile
|
112
99
|
- LICENSE.txt
|
113
100
|
- README.md
|
114
|
-
- Rakefile
|
115
101
|
- bin/console
|
116
102
|
- bin/setup
|
117
103
|
- iceland.gemspec
|
118
104
|
- lib/iceland.rb
|
119
|
-
- lib/iceland/kennitala.rb
|
120
|
-
- lib/iceland/kennitala_string.rb
|
121
|
-
- lib/iceland/postal_codes.rb
|
122
|
-
- lib/iceland/version.rb
|
123
|
-
- lib/postcodes.yml
|
124
105
|
homepage: https://github.com/stefanvignir/iceland_gem
|
125
106
|
licenses:
|
126
107
|
- MIT
|
127
|
-
metadata:
|
128
|
-
|
108
|
+
metadata:
|
109
|
+
rubygems_mfa_required: 'true'
|
110
|
+
post_install_message:
|
129
111
|
rdoc_options: []
|
130
112
|
require_paths:
|
131
113
|
- lib
|
@@ -133,17 +115,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
115
|
requirements:
|
134
116
|
- - ">="
|
135
117
|
- !ruby/object:Gem::Version
|
136
|
-
version:
|
118
|
+
version: 2.6.0
|
137
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
120
|
requirements:
|
139
121
|
- - ">="
|
140
122
|
- !ruby/object:Gem::Version
|
141
123
|
version: '0'
|
142
124
|
requirements: []
|
143
|
-
|
144
|
-
|
145
|
-
signing_key:
|
125
|
+
rubygems_version: 3.3.7
|
126
|
+
signing_key:
|
146
127
|
specification_version: 4
|
147
|
-
summary:
|
128
|
+
summary: A meta package of the Postnumer and Kennitala gems.
|
148
129
|
test_files: []
|
149
|
-
has_rdoc:
|
data/.codeclimate.yml
DELETED
data/Rakefile
DELETED
data/lib/iceland/kennitala.rb
DELETED
@@ -1,247 +0,0 @@
|
|
1
|
-
# The Kennitala Class
|
2
|
-
class Kennitala
|
3
|
-
# Description of method
|
4
|
-
#
|
5
|
-
# @param [String, Boolean] kt_string = false describe kt_string = false
|
6
|
-
# @param [Boolean] is_company = false describe is_company = false
|
7
|
-
# @return [Kennitala] description of returned object
|
8
|
-
def initialize(kt_string = false, is_company = false)
|
9
|
-
kt_string = fake_kt_string(is_company) if kt_string == false
|
10
|
-
unless kt_string.class == String
|
11
|
-
raise ArgumentError, 'Kennitala needs to be provided as a String or '\
|
12
|
-
'Boolean (false)'
|
13
|
-
end
|
14
|
-
sanitised_kt = sanitize(kt_string)
|
15
|
-
raise ArgumentError, 'Kennitala is invalid' if sanitised_kt.nil?
|
16
|
-
@value = sanitised_kt
|
17
|
-
end
|
18
|
-
|
19
|
-
# Get the type of entity - If it is a person or an organization
|
20
|
-
#
|
21
|
-
# @return [String] Either 'person' or 'company'
|
22
|
-
def entity_type
|
23
|
-
date_integer = @value[0, 2].to_i
|
24
|
-
return 'person' if date_integer < 32
|
25
|
-
return 'company' if (date_integer > 40) && (date_integer < 72)
|
26
|
-
end
|
27
|
-
|
28
|
-
# Check if the entity is a company
|
29
|
-
#
|
30
|
-
# @return [Boolean]
|
31
|
-
def company?
|
32
|
-
date_integer = @value[0, 2].to_i
|
33
|
-
return true if (date_integer > 40) && (date_integer < 72)
|
34
|
-
false
|
35
|
-
end
|
36
|
-
|
37
|
-
# Check if the entity is a person
|
38
|
-
#
|
39
|
-
# @return [Boolean]
|
40
|
-
def person?
|
41
|
-
date_integer = @value[0, 2].to_i
|
42
|
-
return true if date_integer < 32
|
43
|
-
false
|
44
|
-
end
|
45
|
-
|
46
|
-
# Get the year of birth or registration
|
47
|
-
#
|
48
|
-
# @return [Fixnum]
|
49
|
-
def year
|
50
|
-
century = (10 + @value[9].to_i) * 100
|
51
|
-
year = @value[4, 2].to_i
|
52
|
-
return century + year if (1800..1900).cover?(century)
|
53
|
-
return 2000 + year if century == 1000
|
54
|
-
end
|
55
|
-
|
56
|
-
# Get the day of the month of birth or registration
|
57
|
-
#
|
58
|
-
# @return [Fixnum]
|
59
|
-
def day
|
60
|
-
date_integer = @value[0, 2].to_i
|
61
|
-
return @value[0, 2].to_i if date_integer < 32
|
62
|
-
return @value[0, 2].to_i - 40 if (date_integer > 40) && (date_integer < 71)
|
63
|
-
end
|
64
|
-
|
65
|
-
# Get a numeric representation of the month of birth or registration
|
66
|
-
#
|
67
|
-
# @return [Fixnum]
|
68
|
-
def month
|
69
|
-
@value[2, 2].to_i
|
70
|
-
end
|
71
|
-
|
72
|
-
# Get the age of entity in years. Useful when dealing with age restrictions.
|
73
|
-
#
|
74
|
-
# @return [Fixnum]
|
75
|
-
def age
|
76
|
-
year_diff = Date.today.year - to_date.year
|
77
|
-
month_diff = Date.today.month - to_date.month
|
78
|
-
day_diff = Date.today.month - to_date.month
|
79
|
-
|
80
|
-
return year_diff -= 1 if month_diff < 0 || (month_diff == 0 && day_diff < 0)
|
81
|
-
year_diff
|
82
|
-
end
|
83
|
-
|
84
|
-
# Cast the kennitala to a Date object
|
85
|
-
#
|
86
|
-
# @return [Date]
|
87
|
-
def to_date
|
88
|
-
Date.new(year, month, day)
|
89
|
-
end
|
90
|
-
|
91
|
-
# Cast the kennitala to a String object
|
92
|
-
#
|
93
|
-
# @return [Date]
|
94
|
-
def to_s
|
95
|
-
@value.to_s
|
96
|
-
end
|
97
|
-
|
98
|
-
# Pretty print a kennitala
|
99
|
-
#
|
100
|
-
# Puts a spacer between the 6th and the 7th digit
|
101
|
-
#
|
102
|
-
# @param [String] spacer A single space by default
|
103
|
-
# @return [String]
|
104
|
-
def pp(spacer = ' ')
|
105
|
-
raise ArgumentError 'Spacer must be a string' unless spacer.class == String
|
106
|
-
@value[0, 6] + spacer + @value[6, 9]
|
107
|
-
end
|
108
|
-
|
109
|
-
private
|
110
|
-
|
111
|
-
# Generate fake a birth number and check digit based on the first 6 digits
|
112
|
-
#
|
113
|
-
# @param [String] The first six digits is a kennitala
|
114
|
-
# @return [Hash, nil]
|
115
|
-
def fake_randoms(date_hash)
|
116
|
-
first_six = date_hash[:day] + date_hash[:month] + date_hash[:year]
|
117
|
-
loop do
|
118
|
-
birth_number = Random.rand(1..99).to_s.rjust(2, '0')
|
119
|
-
first_eight = "#{first_six}#{birth_number}"
|
120
|
-
check_digit = calculate_check_digit(first_eight)
|
121
|
-
if check_checksum(first_eight)
|
122
|
-
return { check_digit: check_digit, birth_number: birth_number }
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
# Generate a fake year and century Hash
|
128
|
-
#
|
129
|
-
# @return [Hash]
|
130
|
-
def fake_year
|
131
|
-
century = [9, 9, 9, 8, 0, 0].sample
|
132
|
-
current_year = Date.today.strftime('%y').to_i
|
133
|
-
if century == 0
|
134
|
-
return { year: Random.rand(0..current_year), century: century }
|
135
|
-
else
|
136
|
-
return { year: Random.rand(0..99), century: century }
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
# Generate a fake hash that includes randomly generated date elements
|
141
|
-
#
|
142
|
-
# @todo Take leap years into account and thus allow for 29 February
|
143
|
-
#
|
144
|
-
# @param [Boolean] is_company true if the day string is for a company
|
145
|
-
# @return [Hash]
|
146
|
-
def fake_date_hash(is_company = false)
|
147
|
-
year_hash = fake_year
|
148
|
-
|
149
|
-
month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
|
150
|
-
month = Random.rand(1..12)
|
151
|
-
|
152
|
-
day = Random.rand(1..month_days[month - 1])
|
153
|
-
day = (day.to_i + 40).to_s.rjust(2, '0') if is_company == true
|
154
|
-
|
155
|
-
{ century: year_hash[:century].to_s,
|
156
|
-
year: year_hash[:year].to_s.rjust(2, '0'),
|
157
|
-
month: month.to_s.rjust(2, '0'), day: day.to_s.rjust(2, '0') }
|
158
|
-
end
|
159
|
-
|
160
|
-
# Generate a fake, random kennitala string
|
161
|
-
#
|
162
|
-
# @param [Boolean] is_company If the kennitala is for a company, not a person
|
163
|
-
# @return [String] A 10-digit string representing a kennitala
|
164
|
-
def fake_kt_string(is_company = false)
|
165
|
-
date_hash = fake_date_hash(is_company)
|
166
|
-
randoms_hash = fake_randoms(date_hash)
|
167
|
-
|
168
|
-
first_six = date_hash[:day] + date_hash[:month] + date_hash[:year]
|
169
|
-
randoms = randoms_hash[:birth_number].to_s + randoms_hash[:check_digit].to_s
|
170
|
-
|
171
|
-
first_six + randoms + date_hash[:century]
|
172
|
-
end
|
173
|
-
|
174
|
-
# Get year from a kennitala string
|
175
|
-
#
|
176
|
-
# @param [String] kt_string Sanitized kennitala string
|
177
|
-
# @return [Fixnum] description of returned object
|
178
|
-
def get_year_from_string(kt_string)
|
179
|
-
century_code = kt_string[9, 1].to_i
|
180
|
-
case century_code
|
181
|
-
when 0
|
182
|
-
return "20#{kt_string[4, 2]}".to_i
|
183
|
-
when 8..9
|
184
|
-
return "1#{century_code}#{kt_string[4, 2]}".to_i
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
# Sanitize the kennitala
|
189
|
-
#
|
190
|
-
# @param [String] kt_string Unsanitised string representing a kennitala
|
191
|
-
# @return [String, nil] Sanitized kennitala, nil if invalid
|
192
|
-
def sanitize(kt_string)
|
193
|
-
sanitized_kt = kt_string.gsub(/[^0-9]/, '')
|
194
|
-
checks = check_checksum(sanitized_kt)
|
195
|
-
|
196
|
-
year = get_year_from_string(sanitized_kt)
|
197
|
-
day = sanitized_kt[0, 2].to_i
|
198
|
-
day -= 40 if day > 40
|
199
|
-
month = sanitized_kt[2, 2].to_i
|
200
|
-
date = Date.new(year, month, day)
|
201
|
-
|
202
|
-
return sanitized_kt if checks == true && date.class == Date
|
203
|
-
|
204
|
-
rescue ArgumentError, 'invalid date'
|
205
|
-
nil
|
206
|
-
end
|
207
|
-
|
208
|
-
# Calculate the checksum
|
209
|
-
#
|
210
|
-
# @param [String] kt_string Sanitized kennitala
|
211
|
-
# @return [Fixnum] The checksum
|
212
|
-
def checksum(kt_string)
|
213
|
-
checksum = 0
|
214
|
-
multipliers = [3, 2, 7, 6, 5, 4, 3, 2]
|
215
|
-
multipliers.each_with_index do |multiplier, index|
|
216
|
-
checksum += multiplier * kt_string[index].to_i
|
217
|
-
end
|
218
|
-
checksum
|
219
|
-
end
|
220
|
-
|
221
|
-
# Calculate the check digit for a kennitala
|
222
|
-
#
|
223
|
-
# @param [String] kt_string Sanitized kennitala
|
224
|
-
# @return [Fixnum]
|
225
|
-
def calculate_check_digit(kt_string)
|
226
|
-
remainder = checksum(kt_string).modulo(11)
|
227
|
-
|
228
|
-
# A kennitala with a remainder of 10 is always considered to be invalid
|
229
|
-
return nil if remainder == 10
|
230
|
-
|
231
|
-
# The check digit should be 11 minus the remainder,
|
232
|
-
# unless the remainder is 0, then the theck digit becomes 0.
|
233
|
-
return 0 if remainder == 0
|
234
|
-
11 - remainder
|
235
|
-
end
|
236
|
-
|
237
|
-
# Check validity of the check digit
|
238
|
-
#
|
239
|
-
# @param [String] kt_string Sanitized kennitala
|
240
|
-
# @return [Boolean, nil] true on success, false if the check digit is invalid
|
241
|
-
def check_checksum(kt_string)
|
242
|
-
expected_check_digit = calculate_check_digit(kt_string)
|
243
|
-
actual_check_digit = kt_string[8].to_i
|
244
|
-
return true if expected_check_digit == actual_check_digit
|
245
|
-
false
|
246
|
-
end
|
247
|
-
end
|
data/lib/iceland/postal_codes.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# Postal Codes
|
2
|
-
module Iceland
|
3
|
-
POSTAL_CODES = YAML.load_file(File.expand_path('../../postcodes.yml',
|
4
|
-
__FILE__))
|
5
|
-
|
6
|
-
# Get an array of hashes with postal_code and locale attributes
|
7
|
-
#
|
8
|
-
# @param [Boolean] include_po_boxes Include postal codes for P.O. boxes
|
9
|
-
# @param [Boolean] force_nominative Use the nomative version of locale name
|
10
|
-
# @return [Array]
|
11
|
-
def all_postal_codes(include_po_boxes = false, force_nominative = false)
|
12
|
-
pairs = []
|
13
|
-
POSTAL_CODES.each do |postal_code, p|
|
14
|
-
# Skip P.O. boxes
|
15
|
-
next if (include_po_boxes == false) && (p['is_po_box'] == true)
|
16
|
-
# Retun the dative form of the locale by default
|
17
|
-
pairs << if p['dative'].nil? || force_nominative == true
|
18
|
-
{ postal_code: postal_code, locale: p['locale'] }
|
19
|
-
else
|
20
|
-
{ postal_code: postal_code, locale: p['dative'] }
|
21
|
-
end
|
22
|
-
end
|
23
|
-
pairs
|
24
|
-
end
|
25
|
-
|
26
|
-
# Find the name of locale (city/town/village) by postal code
|
27
|
-
#
|
28
|
-
# @param [Integer, String] postal_code The postal code
|
29
|
-
# @param [Boolean] force_nominative Display locale name in nomative form
|
30
|
-
# @return [String]
|
31
|
-
def locale_by_postal_code(postal_code, force_nominative = false)
|
32
|
-
postal_code = postal_code.to_i
|
33
|
-
postal_code_hash = POSTAL_CODES[postal_code]
|
34
|
-
unless postal_code_hash.nil?
|
35
|
-
if postal_code_hash['dative'].nil? || force_nominative == true
|
36
|
-
return postal_code_hash['locale']
|
37
|
-
end
|
38
|
-
postal_code_hash['dative']
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
data/lib/iceland/version.rb
DELETED
data/lib/postcodes.yml
DELETED
@@ -1,441 +0,0 @@
|
|
1
|
-
101:
|
2
|
-
locale: 'Reykjavík'
|
3
|
-
103:
|
4
|
-
locale: 'Reykjavík'
|
5
|
-
104:
|
6
|
-
locale: 'Reykjavík'
|
7
|
-
105:
|
8
|
-
locale: 'Reykjavík'
|
9
|
-
107:
|
10
|
-
locale: 'Reykjavík'
|
11
|
-
108:
|
12
|
-
locale: 'Reykjavík'
|
13
|
-
109:
|
14
|
-
locale: 'Reykjavík'
|
15
|
-
110:
|
16
|
-
locale: 'Reykjavík'
|
17
|
-
111:
|
18
|
-
locale: 'Reykjavík'
|
19
|
-
112:
|
20
|
-
locale: 'Reykjavík'
|
21
|
-
113:
|
22
|
-
locale: 'Reykjavík'
|
23
|
-
116:
|
24
|
-
locale: 'Reykjavík'
|
25
|
-
121:
|
26
|
-
locale: 'Reykjavík'
|
27
|
-
is_po_box: true
|
28
|
-
123:
|
29
|
-
locale: 'Reykjavík'
|
30
|
-
is_po_box: true
|
31
|
-
124:
|
32
|
-
locale: 'Reykjavík'
|
33
|
-
is_po_box: true
|
34
|
-
125:
|
35
|
-
locale: 'Reykjavík'
|
36
|
-
is_po_box: true
|
37
|
-
127:
|
38
|
-
locale: 'Reykjavík'
|
39
|
-
is_po_box: true
|
40
|
-
128:
|
41
|
-
locale: 'Reykjavík'
|
42
|
-
is_po_box: true
|
43
|
-
129:
|
44
|
-
locale: 'Reykjavík'
|
45
|
-
is_po_box: true
|
46
|
-
130:
|
47
|
-
locale: 'Reykjavík'
|
48
|
-
is_po_box: true
|
49
|
-
132:
|
50
|
-
locale: 'Reykjavík'
|
51
|
-
is_po_box: true
|
52
|
-
150:
|
53
|
-
locale: 'Reykjavík'
|
54
|
-
corporate_services: true
|
55
|
-
155:
|
56
|
-
locale: 'Reykjavík'
|
57
|
-
corporate_services: true
|
58
|
-
170:
|
59
|
-
locale: 'Seltjarnarnes'
|
60
|
-
dative: 'Seltjarnarnesi'
|
61
|
-
190:
|
62
|
-
locale: 'Vogar'
|
63
|
-
dative: 'Vogum'
|
64
|
-
200:
|
65
|
-
locale: 'Kópavogur'
|
66
|
-
dative: 'Kópavogi'
|
67
|
-
201:
|
68
|
-
locale: 'Kópavogur'
|
69
|
-
dative: 'Kópavogi'
|
70
|
-
202:
|
71
|
-
locale: 'Kópavogur'
|
72
|
-
dative: 'Kópavogi'
|
73
|
-
203:
|
74
|
-
locale: 'Kópavogur'
|
75
|
-
dative: 'Kópavogi'
|
76
|
-
210:
|
77
|
-
locale: 'Garðabær'
|
78
|
-
dative: 'Garðabæ'
|
79
|
-
212:
|
80
|
-
locale: 'Garðabær'
|
81
|
-
dative: 'Garðabæ'
|
82
|
-
is_po_box: true
|
83
|
-
220:
|
84
|
-
locale: 'Hafnarfjörður'
|
85
|
-
dative: 'Hafnarfirði'
|
86
|
-
221:
|
87
|
-
locale: 'Hafnarfjörður'
|
88
|
-
dative: 'Hafnarfirði'
|
89
|
-
222:
|
90
|
-
locale: 'Hafnarfjörður'
|
91
|
-
dative: 'Hafnarfirði'
|
92
|
-
is_po_box: true
|
93
|
-
225:
|
94
|
-
locale: 'Álftanes'
|
95
|
-
daive: 'Álftanesi'
|
96
|
-
230:
|
97
|
-
locale: 'Reykjanesbær'
|
98
|
-
dative: 'Reykjanesbæ'
|
99
|
-
232:
|
100
|
-
locale: 'Reykjanesbær'
|
101
|
-
dative: 'Reykjanesbæ'
|
102
|
-
is_po_box: true
|
103
|
-
233:
|
104
|
-
locale: 'Reykjanesbær'
|
105
|
-
dative: 'Reykjanesbæ'
|
106
|
-
235:
|
107
|
-
locale: 'Reykjanesbær'
|
108
|
-
dative: 'Reykjanesbæ'
|
109
|
-
240:
|
110
|
-
locale: 'Grindavík'
|
111
|
-
245:
|
112
|
-
locale: 'Sandgerði'
|
113
|
-
250:
|
114
|
-
locale: 'Garður'
|
115
|
-
dative: 'Garði'
|
116
|
-
260:
|
117
|
-
locale: 'Reykjanesbær'
|
118
|
-
dative: 'Reykjanesbæ'
|
119
|
-
270:
|
120
|
-
locale: 'Mosfellsbær'
|
121
|
-
dative: 'Mosfellsbæ'
|
122
|
-
271:
|
123
|
-
locale: 'Mosfellsbær'
|
124
|
-
dative: 'Mosfellsbæ'
|
125
|
-
276:
|
126
|
-
locale: 'Mosfellsbær'
|
127
|
-
dative: 'Mosfellsbæ'
|
128
|
-
300:
|
129
|
-
locale: 'Akranes'
|
130
|
-
dative: 'Akranesi'
|
131
|
-
301:
|
132
|
-
locale: 'Akranes (dreifbýli)'
|
133
|
-
dative: 'Akranesi (dreifbýli)'
|
134
|
-
is_rural: true
|
135
|
-
302:
|
136
|
-
locale: 'Akranes'
|
137
|
-
locale: 'Akranesi'
|
138
|
-
is_po_box: true
|
139
|
-
310:
|
140
|
-
locale: 'Borgarnes'
|
141
|
-
dative: 'Borgarnesi'
|
142
|
-
311:
|
143
|
-
locale: 'Borgarnes (dreifbýli)'
|
144
|
-
dative: 'Borgarnesi (dreifbýli)'
|
145
|
-
is_rural: true
|
146
|
-
320:
|
147
|
-
locale: 'Reykholt í Borgarfirði'
|
148
|
-
dative: 'Reykholti í Borgarfirði'
|
149
|
-
is_rural: true
|
150
|
-
340:
|
151
|
-
locale: 'Stykkishólmur'
|
152
|
-
dative: 'Stykkishólmi'
|
153
|
-
345:
|
154
|
-
locale: 'Flatey á Breiðafirði'
|
155
|
-
350:
|
156
|
-
locale: 'Grundarfjörður'
|
157
|
-
dative: 'Grundarfirði'
|
158
|
-
355:
|
159
|
-
locale: 'Ólafsvík'
|
160
|
-
356:
|
161
|
-
locale: 'Snæfellsbær'
|
162
|
-
dative: 'Snæfellsbæ'
|
163
|
-
is_rural: true
|
164
|
-
360:
|
165
|
-
locale: 'Hellissandur'
|
166
|
-
dative: 'Hellissandi'
|
167
|
-
370:
|
168
|
-
locale: 'Búðardalur'
|
169
|
-
dative: 'Búðardal'
|
170
|
-
371:
|
171
|
-
locale: 'Búðardalur (dreifbýli)'
|
172
|
-
dative: 'Búðardal (dreifbýli)'
|
173
|
-
is_rural: true
|
174
|
-
380:
|
175
|
-
locale: 'Reykhólahreppur'
|
176
|
-
dative: 'Reykhólahreppi'
|
177
|
-
is_rural: true
|
178
|
-
400:
|
179
|
-
locale: 'Ísafjörður'
|
180
|
-
dative: 'Ísafirði'
|
181
|
-
401:
|
182
|
-
locale: 'Ísafjörður (dreifbýli)'
|
183
|
-
dative: 'Ísafirði (dreifbýli)'
|
184
|
-
is_rural: true
|
185
|
-
410:
|
186
|
-
locale: 'Hnífsdalur'
|
187
|
-
dative: 'Hnífsdal'
|
188
|
-
is_rural: true
|
189
|
-
415:
|
190
|
-
locale: 'Bolungarvík'
|
191
|
-
420:
|
192
|
-
locale: 'Súðavík'
|
193
|
-
425:
|
194
|
-
locale: 'Flateyri'
|
195
|
-
430:
|
196
|
-
locale: 'Suðureyri'
|
197
|
-
450:
|
198
|
-
locale: 'Patreksfjörður'
|
199
|
-
dative: 'Patreksfirði'
|
200
|
-
451:
|
201
|
-
locale: 'Patreksfjörður (dreifbýli)'
|
202
|
-
dative: 'Patreksfirði (dreifbýli)'
|
203
|
-
is_rural: true
|
204
|
-
460:
|
205
|
-
locale: 'Tálknafjörður'
|
206
|
-
dative: 'Tálknafirði'
|
207
|
-
465:
|
208
|
-
locale: 'Bíldudalur'
|
209
|
-
dative: 'Bíldudal'
|
210
|
-
470:
|
211
|
-
locale: 'Þingeyri'
|
212
|
-
471:
|
213
|
-
locale: 'Þingeyri (dreifbýli)'
|
214
|
-
is_rural: true
|
215
|
-
500:
|
216
|
-
locale: 'Staður'
|
217
|
-
dative: 'Stað'
|
218
|
-
is_rural: true
|
219
|
-
510:
|
220
|
-
locale: 'Hólmavík'
|
221
|
-
512:
|
222
|
-
locale: 'Hólmavík (dreifbýli)'
|
223
|
-
is_rural: true
|
224
|
-
520:
|
225
|
-
locale: 'Drangsnes'
|
226
|
-
dative: 'Drangsnesi'
|
227
|
-
524:
|
228
|
-
locale: 'Árneshreppur'
|
229
|
-
dative: 'Árneshreppi'
|
230
|
-
is_rural: true
|
231
|
-
530:
|
232
|
-
locale: 'Hvammstangi'
|
233
|
-
dative: 'Hvammstanga'
|
234
|
-
531:
|
235
|
-
locale: 'Hvammstangi (dreifbýli)'
|
236
|
-
dative: 'Hvammstanga (dreifbýli)'
|
237
|
-
is_rural: true
|
238
|
-
540:
|
239
|
-
locale: 'Blönduós'
|
240
|
-
dative: 'Blönduósi'
|
241
|
-
541:
|
242
|
-
locale: 'Blönduós (dreifbýli)'
|
243
|
-
dative: 'Blönduósi (dreifbýli)'
|
244
|
-
is_rural: true
|
245
|
-
545:
|
246
|
-
locale: 'Skagaströnd'
|
247
|
-
550:
|
248
|
-
locale: 'Sauðárkrókur'
|
249
|
-
dative: 'Sauðárkróki'
|
250
|
-
551:
|
251
|
-
locale: 'Sauðárkrókur (dreifbýli)'
|
252
|
-
dative: 'Sauðárkróki (dreifbýli)'
|
253
|
-
is_rural: true
|
254
|
-
560:
|
255
|
-
locale: 'Varmahlíð'
|
256
|
-
565:
|
257
|
-
locale: 'Hofsós'
|
258
|
-
dative: 'Hofsósi'
|
259
|
-
is_rural: true
|
260
|
-
566:
|
261
|
-
locale: 'Hofsós (dreifbýli)'
|
262
|
-
dative: 'Hofsósi (dreifbýli)'
|
263
|
-
is_rural: true
|
264
|
-
570:
|
265
|
-
locale: 'Fljót'
|
266
|
-
dative: 'Fljótum'
|
267
|
-
is_rural: true
|
268
|
-
580:
|
269
|
-
locale: 'Siglufjörður'
|
270
|
-
dative: 'Siglufirði'
|
271
|
-
600:
|
272
|
-
locale: 'Akureyri'
|
273
|
-
601:
|
274
|
-
locale: 'Akureyri (dreifbýli)'
|
275
|
-
is_rural: true
|
276
|
-
602:
|
277
|
-
locale: 'Akureyri'
|
278
|
-
is_po_box: true
|
279
|
-
603:
|
280
|
-
locale: 'Akureyri'
|
281
|
-
610:
|
282
|
-
locale: 'Grenivík'
|
283
|
-
611:
|
284
|
-
locale: 'Grímsey'
|
285
|
-
620:
|
286
|
-
locale: 'Dalvík'
|
287
|
-
621:
|
288
|
-
locale: 'Dalvík (dreifbýli)'
|
289
|
-
is_rural: true
|
290
|
-
625:
|
291
|
-
locale: 'Ólafsfjörður'
|
292
|
-
dative: 'Ólafsfirði'
|
293
|
-
630:
|
294
|
-
locale: 'Hrísey'
|
295
|
-
640:
|
296
|
-
locale: 'Húsavík'
|
297
|
-
641:
|
298
|
-
locale: 'Húsavík (dreifbýli)'
|
299
|
-
is_rural: true
|
300
|
-
645:
|
301
|
-
locale: 'Fosshóll'
|
302
|
-
dative: 'Fosshóli'
|
303
|
-
is_rural: true
|
304
|
-
650:
|
305
|
-
locale: 'Laugar'
|
306
|
-
dative: 'Laugum'
|
307
|
-
660:
|
308
|
-
locale: 'Mývatn'
|
309
|
-
dative: 'Mývatni'
|
310
|
-
670:
|
311
|
-
locale: 'Kópasker'
|
312
|
-
dative: 'Kópaskeri'
|
313
|
-
671:
|
314
|
-
locale: 'Kópasker (dreifbýli)'
|
315
|
-
dative: 'Kópaskeri (dreifbýli)'
|
316
|
-
is_rural: true
|
317
|
-
675:
|
318
|
-
locale: 'Raufarhöfn'
|
319
|
-
680:
|
320
|
-
locale: 'Þórshöfn'
|
321
|
-
681:
|
322
|
-
locale: 'Þórshöfn (dreifbýli)'
|
323
|
-
is_rural: true
|
324
|
-
685:
|
325
|
-
locale: 'Bakkafjörður'
|
326
|
-
dative: 'Bakkafirði'
|
327
|
-
is_rural: true
|
328
|
-
690:
|
329
|
-
locale: 'Vopnafjörður'
|
330
|
-
dative: 'Vopnafirði'
|
331
|
-
700:
|
332
|
-
locale: 'Egilsstaðir'
|
333
|
-
dative: 'Egilsstöðum'
|
334
|
-
701:
|
335
|
-
locale: 'Egilsstaðir (dreifbýli)'
|
336
|
-
dative: 'Egilsstöðum (dreifbýli)'
|
337
|
-
is_rural: true
|
338
|
-
710:
|
339
|
-
locale: 'Seyðisfjörður'
|
340
|
-
dative: 'Seyðisfirði'
|
341
|
-
715:
|
342
|
-
locale: 'Mjóifjörður'
|
343
|
-
dative: 'Mjóafirði'
|
344
|
-
is_rural: true
|
345
|
-
720:
|
346
|
-
locale: 'Borgarfjörður (eystri)'
|
347
|
-
dative: 'Borgarfirði (eystri)'
|
348
|
-
is_rural: true
|
349
|
-
730:
|
350
|
-
locale: 'Reyðarfjörður'
|
351
|
-
dative: 'Reyðarfirði'
|
352
|
-
735:
|
353
|
-
locale: 'Eskifjörður'
|
354
|
-
dative: 'Eskifirði'
|
355
|
-
740:
|
356
|
-
locale: 'Neskaupstaður'
|
357
|
-
dative: 'Neskaupsstað'
|
358
|
-
750:
|
359
|
-
locale: 'Fáskrúðsfjörður'
|
360
|
-
dative: 'Fáskrúðsfirði'
|
361
|
-
755:
|
362
|
-
locale: 'Stöðvarfjörður'
|
363
|
-
dative: 'Stöðvarfirði'
|
364
|
-
760:
|
365
|
-
locale: 'Breiðdalsvík'
|
366
|
-
765:
|
367
|
-
locale: 'Djúpivogur'
|
368
|
-
dative: 'Djúpavogi'
|
369
|
-
780:
|
370
|
-
locale: 'Höfn í Hornafirði'
|
371
|
-
781:
|
372
|
-
locale: 'Höfn í Hornafirði (dreifbýli)'
|
373
|
-
is_rural: true
|
374
|
-
785:
|
375
|
-
locale: 'Öræfi'
|
376
|
-
dative: 'Öræfum'
|
377
|
-
is_rural: true
|
378
|
-
800:
|
379
|
-
locale: 'Selfoss'
|
380
|
-
dative: 'Selfossi'
|
381
|
-
801:
|
382
|
-
locale: 'Selfoss (dreifbýli)'
|
383
|
-
dative: 'Selfossi (dreifbýli)'
|
384
|
-
is_rural: true
|
385
|
-
802:
|
386
|
-
locale: 'Selfoss'
|
387
|
-
dative: 'Selfossi'
|
388
|
-
is_po_box: true
|
389
|
-
810:
|
390
|
-
locale: 'Hveragerði'
|
391
|
-
815:
|
392
|
-
locale: 'Þorlákshöfn'
|
393
|
-
816:
|
394
|
-
locale: 'Ölfus (dreifbýli)'
|
395
|
-
dative: 'Ölfusi (dreifbýli)'
|
396
|
-
is_rural: true
|
397
|
-
820:
|
398
|
-
locale: 'Eyrarbakki'
|
399
|
-
dative: 'Eyrarbakka'
|
400
|
-
is_rural: true
|
401
|
-
825:
|
402
|
-
locale: 'Stokkseyri'
|
403
|
-
is_rural: true
|
404
|
-
840:
|
405
|
-
locale: 'Laugarvatn'
|
406
|
-
dative: 'Laugarvatni'
|
407
|
-
is_rural: true
|
408
|
-
845:
|
409
|
-
locale: 'Flúðir'
|
410
|
-
dative: 'Flúðum'
|
411
|
-
is_rural: true
|
412
|
-
850:
|
413
|
-
locale: 'Hella'
|
414
|
-
dative: 'Hellu'
|
415
|
-
851:
|
416
|
-
locale: 'Hella (dreifbýli)'
|
417
|
-
dative: 'Hellu (dreifbýli)'
|
418
|
-
860:
|
419
|
-
locale: 'Hvolsvöllur'
|
420
|
-
dative: 'Hvolsvelli'
|
421
|
-
861:
|
422
|
-
locale: 'Hvolsvöllur (dreifbýli)'
|
423
|
-
dative: 'Hvolsvelli (dreifbýli)'
|
424
|
-
870:
|
425
|
-
locale: 'Vík'
|
426
|
-
is_rural: true
|
427
|
-
871:
|
428
|
-
locale: 'Vík (dreifbýli)'
|
429
|
-
is_rural: true
|
430
|
-
880:
|
431
|
-
locale: 'Kirkjubæjarklaustur'
|
432
|
-
dative: 'Kirkjubæjarklaustri'
|
433
|
-
is_rural: true
|
434
|
-
900:
|
435
|
-
locale: 'Vestmannaeyjar'
|
436
|
-
dative: 'Vestmannaeyjum'
|
437
|
-
is_rural: true
|
438
|
-
902:
|
439
|
-
locale: 'Vestmannaeyjar'
|
440
|
-
dative: 'Vestmannaeyjum'
|
441
|
-
is_po_box: true
|