iceland 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +107 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/iceland.gemspec +31 -0
- data/lib/iceland/version.rb +3 -0
- data/lib/iceland.rb +163 -0
- data/lib/postcodes.yml +441 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 04833b2443ace4bf6a022e6015542bb600ee2456
|
4
|
+
data.tar.gz: 85548c58824fa9cbca966a65d65204afd06c3012
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eb3c8a9e0f8169579131424358e0e5f6a2160f198747962b4ed4295aa56a995dc67d253d944dda930689a7d0ec86bc625ab9fce6348113aa220bca281bca4a83
|
7
|
+
data.tar.gz: 4a5c17f3177c1ee5ebf584ea5c0b824c56d77f1c70a5830e9eb5b6aecfaf13123a599d650421536ae8f9200b4f73387a6d3bc861228dda25880f7d4795175b8a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Stefan Vignir
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
# The Iceland Gem
|
2
|
+
|
3
|
+
The Iceland Gem handles Icelandic "kennitala" personal/entity identifiers and Icelandic postal codes.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'iceland'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install iceland
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
### Postal Codes
|
24
|
+
|
25
|
+
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.
|
26
|
+
|
27
|
+
(Note that we use the term "locale" as per Universal Postal Union convention to name town, city or other location the postal code is assigned to.)
|
28
|
+
|
29
|
+
#### Examples
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# Get all postal codes, skipping codes assigned to P.O. boxes.
|
33
|
+
# This is useful when generating forms.
|
34
|
+
Iceland.all_postal_codes
|
35
|
+
# => [{:postal_code=>101, :locale=>"Reykjavík"}, {:postal_code=>103, [...]
|
36
|
+
|
37
|
+
# Get all postal codes, including P.O. boxes
|
38
|
+
Iceland.all_postal_codes true
|
39
|
+
# => [{:postal_code=>101, :locale=>"Reykjavík"}, {:postal_code=>103, [...]
|
40
|
+
|
41
|
+
# Get the name of locale based on its postal code.
|
42
|
+
# This is useful when you only save the postal code, but not the locale in a database.
|
43
|
+
Iceland.locale_by_postal_code 311
|
44
|
+
# => "Borgarnesi (dreifbýli)"
|
45
|
+
|
46
|
+
# Get the name of the locale in nominative form
|
47
|
+
Iceland.locale_by_postal_code 311, true
|
48
|
+
# => "Borgarnes (dreifbýli)"
|
49
|
+
```
|
50
|
+
|
51
|
+
### The Kennitala Class
|
52
|
+
|
53
|
+
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.
|
54
|
+
|
55
|
+
#### Examples
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
# Initialize a Kennitala object.
|
59
|
+
# The string provided may include spaces and hyphens.
|
60
|
+
k = Kennitala.new('010130-2989')
|
61
|
+
# => #<Kennitala:0x007fe35d041bc0 @value="0101302989">
|
62
|
+
|
63
|
+
# Invalid strings are rejected
|
64
|
+
f = Kennitala.new('010130-2979')
|
65
|
+
# ArgumentError: Kennitala is invalid
|
66
|
+
|
67
|
+
# Retrieve the kennitala as a string.
|
68
|
+
# This is a sanitized string, without any non-numeric characters.
|
69
|
+
k.to_s
|
70
|
+
# => "0101302989"
|
71
|
+
|
72
|
+
# Get the entity type (results in 'person' or 'entity')
|
73
|
+
k.entity_type
|
74
|
+
# => "person"
|
75
|
+
|
76
|
+
# Get the birth date or registration day as a Date object
|
77
|
+
k.to_date
|
78
|
+
# => #<Date: 1930-01-01 ((2425978j,0s,0n),+0s,2299161j)>
|
79
|
+
|
80
|
+
# Get the current age of entity. Useful for age restrictions.
|
81
|
+
k.age
|
82
|
+
# => 86
|
83
|
+
```
|
84
|
+
|
85
|
+
## Todo
|
86
|
+
|
87
|
+
* Administrative Divisions
|
88
|
+
|
89
|
+
## About the data
|
90
|
+
|
91
|
+
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.
|
92
|
+
|
93
|
+
Strings are expected to be UTF-8.
|
94
|
+
|
95
|
+
## Development
|
96
|
+
|
97
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
98
|
+
|
99
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
100
|
+
|
101
|
+
## Contributing
|
102
|
+
|
103
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/stefanvignir/iceland_gem.
|
104
|
+
|
105
|
+
## License
|
106
|
+
|
107
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'iceland'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/iceland.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'iceland/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'iceland'
|
8
|
+
spec.version = Iceland::VERSION
|
9
|
+
spec.authors = ['Stefan Vignir']
|
10
|
+
spec.email = ['stefanvignir@stefanvignir.is']
|
11
|
+
|
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
|
+
spec.homepage = 'https://github.com/stefanvignir/iceland_gem'
|
18
|
+
spec.license = 'MIT'
|
19
|
+
|
20
|
+
spec.files = `git ls-files -z`
|
21
|
+
.split("\x0")
|
22
|
+
.reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
+
spec.bindir = 'exe'
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.11'
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
spec.add_development_dependency 'rubocop', '~> 0.40.0'
|
31
|
+
end
|
data/lib/iceland.rb
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
require 'iceland/version'
|
5
|
+
|
6
|
+
# The Iceland Module
|
7
|
+
module Iceland
|
8
|
+
POSTAL_CODES = YAML.load_file(File.expand_path('../postcodes.yml', __FILE__))
|
9
|
+
|
10
|
+
# Get an array of hashes with postal_code and locale attributes
|
11
|
+
#
|
12
|
+
# @param [Boolean] include_po_boxes Include postal codes for P.O. boxes
|
13
|
+
# @param [Boolean] force_nominative Use the nomative version of locale name
|
14
|
+
# @return [Array]
|
15
|
+
def all_postal_codes(include_po_boxes = false, force_nominative = false)
|
16
|
+
pairs = []
|
17
|
+
POSTAL_CODES.each do |postal_code, p|
|
18
|
+
# Skip P.O. boxes
|
19
|
+
next if (include_po_boxes == false) && (p['is_po_box'] == true)
|
20
|
+
# Retun the dative form of the locale by default
|
21
|
+
pairs << if p['dative'].nil? || force_nominative == true
|
22
|
+
{ postal_code: postal_code, locale: p['locale'] }
|
23
|
+
else
|
24
|
+
{ postal_code: postal_code, locale: p['dative'] }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
pairs
|
28
|
+
end
|
29
|
+
|
30
|
+
# Find the name of locale (city/town/village) by postal code
|
31
|
+
#
|
32
|
+
# @param [Integer, String] postal_code The postal code
|
33
|
+
# @param [Boolean] force_nominative Display locale name in nomative form
|
34
|
+
# @return [String] description of returned object
|
35
|
+
def locale_by_postal_code(postal_code, force_nominative = false)
|
36
|
+
postal_code = postal_code.to_i
|
37
|
+
postal_code_hash = POSTAL_CODES[postal_code]
|
38
|
+
unless postal_code_hash.nil?
|
39
|
+
if postal_code_hash['dative'].nil? || force_nominative == true
|
40
|
+
return postal_code_hash['locale']
|
41
|
+
end
|
42
|
+
postal_code_hash['dative']
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# The Kennitala Class
|
48
|
+
class Kennitala
|
49
|
+
def initialize(kt_string)
|
50
|
+
unless kt_string.is_a String
|
51
|
+
raise ArgumentError, 'Kennitala needs to be provided as a string'
|
52
|
+
end
|
53
|
+
sanitised_kt = sanitize(kt_string)
|
54
|
+
raise ArgumentError, 'Kennitala is invalid' if sanitised_kt.nil?
|
55
|
+
@value = sanitised_kt
|
56
|
+
end
|
57
|
+
|
58
|
+
# Get the type of entity - If it is a person or an organization
|
59
|
+
#
|
60
|
+
# @return [String] Either 'person' or 'organization'
|
61
|
+
def entity_type
|
62
|
+
date_integer = @value[0, 2].to_i
|
63
|
+
return 'person' if date_integer < 32
|
64
|
+
return 'organization' if (date_integer > 40) && (date_integer < 71)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Get the year of birth or registration
|
68
|
+
#
|
69
|
+
# @return [Fixnum]
|
70
|
+
def year
|
71
|
+
century = (10 + @value[9].to_i) * 100
|
72
|
+
year = @value[4, 2].to_i
|
73
|
+
return century + year if (1800..1900).cover?(century)
|
74
|
+
return 2000 + year if century == 0
|
75
|
+
end
|
76
|
+
|
77
|
+
# Get the day of the month of birth or registration
|
78
|
+
#
|
79
|
+
# @return [Fixnum]
|
80
|
+
def day
|
81
|
+
date_integer = @value[0, 2].to_i
|
82
|
+
return @value[0, 2].to_i if date_integer < 32
|
83
|
+
return @value[0, 2].to_i - 40 if (date_integer > 40) && (date_integer < 71)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Get a numeric representation of the month of birth or registration
|
87
|
+
#
|
88
|
+
# @return [Fixnum]
|
89
|
+
def month
|
90
|
+
@value[2, 2].to_i
|
91
|
+
end
|
92
|
+
|
93
|
+
# Get the age of entity in years. Useful when dealing with age restrictions.
|
94
|
+
#
|
95
|
+
# @return [Fixnum]
|
96
|
+
def age
|
97
|
+
year_diff = Date.today.year - to_date.year
|
98
|
+
month_diff = Date.today.month - to_date.month
|
99
|
+
day_diff = Date.today.month - to_date.month
|
100
|
+
|
101
|
+
return year_diff -= 1 if month_diff < 0 || (month_diff == 0 && day_diff < 0)
|
102
|
+
year_diff
|
103
|
+
end
|
104
|
+
|
105
|
+
# Cast the kennitala to a Date object
|
106
|
+
#
|
107
|
+
# @return [Date]
|
108
|
+
def to_date
|
109
|
+
Date.new(year, month, day)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Cast the kennitala to a String object
|
113
|
+
#
|
114
|
+
# @return [Date]
|
115
|
+
def to_s
|
116
|
+
@value.to_s
|
117
|
+
end
|
118
|
+
|
119
|
+
private
|
120
|
+
|
121
|
+
# Sanitize the kennitala
|
122
|
+
#
|
123
|
+
# @param [String] kt_string Unsanitised string representing a kennitala
|
124
|
+
# @return [String] Sanitized kennitala
|
125
|
+
def sanitize(kt_string)
|
126
|
+
sanitized_kt = kt_string.gsub(/\D/, '')
|
127
|
+
checks = check_checksum(sanitized_kt)
|
128
|
+
return sanitized_kt if (/\A\d{10}\z/ =~ sanitized_kt) && (checks == true)
|
129
|
+
end
|
130
|
+
|
131
|
+
# Calculate the checksum
|
132
|
+
#
|
133
|
+
# @param [String] kt_string Sanitized kennitala
|
134
|
+
# @return [Fixnum] The checksum
|
135
|
+
def checksum(kt_string)
|
136
|
+
checksum = 0
|
137
|
+
multipliers = [3, 2, 7, 6, 5, 4, 3, 2]
|
138
|
+
multipliers.each_with_index do |multiplier, index|
|
139
|
+
checksum += multiplier * kt_string[index].to_i
|
140
|
+
end
|
141
|
+
checksum
|
142
|
+
end
|
143
|
+
|
144
|
+
# Calculate remainder and check validity of the check digit
|
145
|
+
#
|
146
|
+
# @param [String] kt_string Sanitized kennitala
|
147
|
+
# @return [Boolean, nil] true on success, nil if the check digit is invalid
|
148
|
+
def check_checksum(kt_string)
|
149
|
+
remainder = checksum(kt_string).modulo(11)
|
150
|
+
|
151
|
+
# A kennitala with a remainder of 10 is always considered to be invalid
|
152
|
+
return nil if remainder == 10
|
153
|
+
|
154
|
+
# The check digit should be 11 minus the remainder,
|
155
|
+
# unless the remainder is 0, then the theck digit becomes 0.
|
156
|
+
expected_check_digit = 11 - remainder
|
157
|
+
expected_check_digit = 0 if remainder == 0
|
158
|
+
|
159
|
+
actual_check_digit = kt_string[8].to_i
|
160
|
+
|
161
|
+
return true if expected_check_digit == actual_check_digit
|
162
|
+
end
|
163
|
+
end
|
data/lib/postcodes.yml
ADDED
@@ -0,0 +1,441 @@
|
|
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
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: iceland
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stefan Vignir
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
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'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.40.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.40.0
|
69
|
+
description: Adds the Kennitala class. Figures out dates and ages, and sanitizes "kennitala"
|
70
|
+
objects and looks up Icelandic postal codes.
|
71
|
+
email:
|
72
|
+
- stefanvignir@stefanvignir.is
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- iceland.gemspec
|
87
|
+
- lib/iceland.rb
|
88
|
+
- lib/iceland/version.rb
|
89
|
+
- lib/postcodes.yml
|
90
|
+
homepage: https://github.com/stefanvignir/iceland_gem
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.4.5.1
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Handles the Icelandic "kennitala" identification scheme and postal codes
|
114
|
+
test_files: []
|
115
|
+
has_rdoc:
|