postnummer_norge 1.0.0 → 1.0.2
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 +4 -4
- data/LICENSE +20 -0
- data/README.md +15 -3
- data/lib/postnummer_norge/postal_codes.tab +1613 -1647
- data/lib/postnummer_norge/version.rb +1 -1
- metadata +13 -20
- data/.github/workflows/build.yml +0 -37
- data/.gitignore +0 -4
- data/.rubocop.yml +0 -21
- data/Gemfile +0 -15
- data/Gemfile.lock +0 -81
- data/Rakefile +0 -14
- data/postnummer_norge.gemspec +0 -23
- data/spec/postnummer_norge/postal_code_spec.rb +0 -62
- data/spec/spec_helper.rb +0 -8
metadata
CHANGED
|
@@ -1,41 +1,35 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: postnummer_norge
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Inge Jørgensen
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
|
-
description:
|
|
14
12
|
email:
|
|
15
|
-
- inge@
|
|
13
|
+
- inge@elektronaut.no
|
|
16
14
|
executables: []
|
|
17
15
|
extensions: []
|
|
18
16
|
extra_rdoc_files: []
|
|
19
17
|
files:
|
|
20
|
-
-
|
|
21
|
-
- ".gitignore"
|
|
22
|
-
- ".rubocop.yml"
|
|
23
|
-
- Gemfile
|
|
24
|
-
- Gemfile.lock
|
|
18
|
+
- LICENSE
|
|
25
19
|
- README.md
|
|
26
|
-
- Rakefile
|
|
27
20
|
- lib/postnummer_norge.rb
|
|
28
21
|
- lib/postnummer_norge/postal_code.rb
|
|
29
22
|
- lib/postnummer_norge/postal_codes.tab
|
|
30
23
|
- lib/postnummer_norge/version.rb
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
homepage: ''
|
|
35
|
-
licenses: []
|
|
24
|
+
homepage: https://github.com/elektronaut/postnummer_norge
|
|
25
|
+
licenses:
|
|
26
|
+
- MIT
|
|
36
27
|
metadata:
|
|
28
|
+
bug_tracker_uri: https://github.com/elektronaut/postnummer_norge/issues
|
|
29
|
+
changelog_uri: https://github.com/elektronaut/postnummer_norge/blob/main/CHANGELOG.md
|
|
30
|
+
documentation_uri: https://www.rubydoc.info/gems/postnummer_norge
|
|
37
31
|
rubygems_mfa_required: 'true'
|
|
38
|
-
|
|
32
|
+
source_code_uri: https://github.com/elektronaut/postnummer_norge
|
|
39
33
|
rdoc_options: []
|
|
40
34
|
require_paths:
|
|
41
35
|
- lib
|
|
@@ -43,15 +37,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
43
37
|
requirements:
|
|
44
38
|
- - ">="
|
|
45
39
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 3.
|
|
40
|
+
version: 3.2.0
|
|
47
41
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
42
|
requirements:
|
|
49
43
|
- - ">="
|
|
50
44
|
- !ruby/object:Gem::Version
|
|
51
45
|
version: '0'
|
|
52
46
|
requirements: []
|
|
53
|
-
rubygems_version:
|
|
54
|
-
signing_key:
|
|
47
|
+
rubygems_version: 4.0.20
|
|
55
48
|
specification_version: 4
|
|
56
49
|
summary: Norwegian postal codes
|
|
57
50
|
test_files: []
|
data/.github/workflows/build.yml
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
env:
|
|
2
|
-
RUBY_VERSION: 3.0
|
|
3
|
-
|
|
4
|
-
name: Build
|
|
5
|
-
on:
|
|
6
|
-
push:
|
|
7
|
-
branches:
|
|
8
|
-
- master
|
|
9
|
-
- develop
|
|
10
|
-
pull_request:
|
|
11
|
-
jobs:
|
|
12
|
-
rubocop-test:
|
|
13
|
-
name: Rubocop
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v1
|
|
17
|
-
- uses: ruby/setup-ruby@v1
|
|
18
|
-
with:
|
|
19
|
-
ruby-version: ${{ env.RUBY_VERSION }}
|
|
20
|
-
bundler-cache: true
|
|
21
|
-
- name: Check code
|
|
22
|
-
run: bundle exec rubocop
|
|
23
|
-
|
|
24
|
-
rspec-test:
|
|
25
|
-
name: RSpec
|
|
26
|
-
runs-on: ubuntu-latest
|
|
27
|
-
strategy:
|
|
28
|
-
matrix:
|
|
29
|
-
ruby: ['3.0', '3.1', '3.2']
|
|
30
|
-
steps:
|
|
31
|
-
- uses: actions/checkout@v1
|
|
32
|
-
- uses: ruby/setup-ruby@v1
|
|
33
|
-
with:
|
|
34
|
-
ruby-version: ${{ matrix.ruby }}
|
|
35
|
-
bundler-cache: true
|
|
36
|
-
- name: Run tests
|
|
37
|
-
run: bundle exec rspec
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require:
|
|
2
|
-
- rubocop-rake
|
|
3
|
-
- rubocop-rspec
|
|
4
|
-
|
|
5
|
-
AllCops:
|
|
6
|
-
NewCops: enable
|
|
7
|
-
TargetRubyVersion: 3.0
|
|
8
|
-
|
|
9
|
-
Style/StringLiterals:
|
|
10
|
-
EnforcedStyle: double_quotes
|
|
11
|
-
|
|
12
|
-
Style/Documentation:
|
|
13
|
-
Enabled: false
|
|
14
|
-
|
|
15
|
-
Metrics/BlockLength:
|
|
16
|
-
Exclude:
|
|
17
|
-
- "*.gemspec"
|
|
18
|
-
- "**/*_spec.rb"
|
|
19
|
-
|
|
20
|
-
Naming/MethodName:
|
|
21
|
-
Enabled: false
|
data/Gemfile
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
source "http://rubygems.org"
|
|
4
|
-
|
|
5
|
-
# Specify your gem's dependencies in postnummer_norge.gemspec
|
|
6
|
-
gemspec
|
|
7
|
-
|
|
8
|
-
group :development, :test do
|
|
9
|
-
gem "rake"
|
|
10
|
-
gem "rspec"
|
|
11
|
-
gem "rubocop", require: false
|
|
12
|
-
gem "rubocop-rake", require: false
|
|
13
|
-
gem "rubocop-rspec", require: false
|
|
14
|
-
gem "simplecov"
|
|
15
|
-
end
|
data/Gemfile.lock
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
postnummer_norge (1.0.0)
|
|
5
|
-
|
|
6
|
-
GEM
|
|
7
|
-
remote: http://rubygems.org/
|
|
8
|
-
specs:
|
|
9
|
-
ast (2.4.2)
|
|
10
|
-
diff-lcs (1.5.0)
|
|
11
|
-
docile (1.4.0)
|
|
12
|
-
json (2.6.3)
|
|
13
|
-
language_server-protocol (3.17.0.3)
|
|
14
|
-
parallel (1.23.0)
|
|
15
|
-
parser (3.2.2.4)
|
|
16
|
-
ast (~> 2.4.1)
|
|
17
|
-
racc
|
|
18
|
-
racc (1.7.3)
|
|
19
|
-
rainbow (3.1.1)
|
|
20
|
-
rake (13.1.0)
|
|
21
|
-
regexp_parser (2.8.2)
|
|
22
|
-
rexml (3.2.6)
|
|
23
|
-
rspec (3.12.0)
|
|
24
|
-
rspec-core (~> 3.12.0)
|
|
25
|
-
rspec-expectations (~> 3.12.0)
|
|
26
|
-
rspec-mocks (~> 3.12.0)
|
|
27
|
-
rspec-core (3.12.2)
|
|
28
|
-
rspec-support (~> 3.12.0)
|
|
29
|
-
rspec-expectations (3.12.3)
|
|
30
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
31
|
-
rspec-support (~> 3.12.0)
|
|
32
|
-
rspec-mocks (3.12.6)
|
|
33
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
34
|
-
rspec-support (~> 3.12.0)
|
|
35
|
-
rspec-support (3.12.1)
|
|
36
|
-
rubocop (1.57.2)
|
|
37
|
-
json (~> 2.3)
|
|
38
|
-
language_server-protocol (>= 3.17.0)
|
|
39
|
-
parallel (~> 1.10)
|
|
40
|
-
parser (>= 3.2.2.4)
|
|
41
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
42
|
-
regexp_parser (>= 1.8, < 3.0)
|
|
43
|
-
rexml (>= 3.2.5, < 4.0)
|
|
44
|
-
rubocop-ast (>= 1.28.1, < 2.0)
|
|
45
|
-
ruby-progressbar (~> 1.7)
|
|
46
|
-
unicode-display_width (>= 2.4.0, < 3.0)
|
|
47
|
-
rubocop-ast (1.30.0)
|
|
48
|
-
parser (>= 3.2.1.0)
|
|
49
|
-
rubocop-capybara (2.19.0)
|
|
50
|
-
rubocop (~> 1.41)
|
|
51
|
-
rubocop-factory_bot (2.24.0)
|
|
52
|
-
rubocop (~> 1.33)
|
|
53
|
-
rubocop-rake (0.6.0)
|
|
54
|
-
rubocop (~> 1.0)
|
|
55
|
-
rubocop-rspec (2.25.0)
|
|
56
|
-
rubocop (~> 1.40)
|
|
57
|
-
rubocop-capybara (~> 2.17)
|
|
58
|
-
rubocop-factory_bot (~> 2.22)
|
|
59
|
-
ruby-progressbar (1.13.0)
|
|
60
|
-
simplecov (0.22.0)
|
|
61
|
-
docile (~> 1.1)
|
|
62
|
-
simplecov-html (~> 0.11)
|
|
63
|
-
simplecov_json_formatter (~> 0.1)
|
|
64
|
-
simplecov-html (0.12.3)
|
|
65
|
-
simplecov_json_formatter (0.1.4)
|
|
66
|
-
unicode-display_width (2.5.0)
|
|
67
|
-
|
|
68
|
-
PLATFORMS
|
|
69
|
-
ruby
|
|
70
|
-
|
|
71
|
-
DEPENDENCIES
|
|
72
|
-
postnummer_norge!
|
|
73
|
-
rake
|
|
74
|
-
rspec
|
|
75
|
-
rubocop
|
|
76
|
-
rubocop-rake
|
|
77
|
-
rubocop-rspec
|
|
78
|
-
simplecov
|
|
79
|
-
|
|
80
|
-
BUNDLED WITH
|
|
81
|
-
2.4.22
|
data/Rakefile
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "bundler/gem_tasks"
|
|
4
|
-
require "net/http"
|
|
5
|
-
require "uri"
|
|
6
|
-
|
|
7
|
-
desc "Update postal codes"
|
|
8
|
-
task :update_codes do
|
|
9
|
-
url = "https://www.bring.no/postnummerregister-ansi.txt"
|
|
10
|
-
content = Net::HTTP.get(URI.parse(url))
|
|
11
|
-
File.write("./lib/postnummer_norge/postal_codes.tab",
|
|
12
|
-
content.force_encoding("iso-8859-1")
|
|
13
|
-
.encode("UTF-8", universal_newline: true))
|
|
14
|
-
end
|
data/postnummer_norge.gemspec
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
|
4
|
-
require "postnummer_norge/version"
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |s|
|
|
7
|
-
s.name = "postnummer_norge"
|
|
8
|
-
s.version = PostnummerNorge::VERSION
|
|
9
|
-
s.authors = ["Inge Jørgensen"]
|
|
10
|
-
s.email = ["inge@anyone.no"]
|
|
11
|
-
s.homepage = ""
|
|
12
|
-
s.summary = "Norwegian postal codes"
|
|
13
|
-
|
|
14
|
-
s.required_ruby_version = ">= 3.0.0"
|
|
15
|
-
|
|
16
|
-
s.files = `git ls-files`.split("\n")
|
|
17
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
18
|
-
s.require_paths = ["lib"]
|
|
19
|
-
|
|
20
|
-
# specify any dependencies here; for example:
|
|
21
|
-
# s.add_runtime_dependency "rest-client"
|
|
22
|
-
s.metadata["rubygems_mfa_required"] = "true"
|
|
23
|
-
end
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "spec_helper"
|
|
4
|
-
require "postnummer_norge"
|
|
5
|
-
|
|
6
|
-
describe PostnummerNorge::PostalCode do
|
|
7
|
-
describe "#exists?" do
|
|
8
|
-
subject { described_class.exists?(code) }
|
|
9
|
-
|
|
10
|
-
context "when code exists" do
|
|
11
|
-
let(:code) { "0662" }
|
|
12
|
-
|
|
13
|
-
it { is_expected.to be(true) }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
context "when code does not exist" do
|
|
17
|
-
let(:code) { "0002" }
|
|
18
|
-
|
|
19
|
-
it { is_expected.to be(false) }
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe "#find" do
|
|
24
|
-
subject(:postal_code) { described_class.find(code) }
|
|
25
|
-
|
|
26
|
-
context "when code exists" do
|
|
27
|
-
let(:code) { "4085" }
|
|
28
|
-
|
|
29
|
-
it { is_expected.to be_a(described_class) }
|
|
30
|
-
specify { expect(postal_code.name).to eq("HUNDVÅG") }
|
|
31
|
-
specify { expect(postal_code.municipality).to eq("STAVANGER") }
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
context "when code does not exist" do
|
|
35
|
-
let(:code) { "0002" }
|
|
36
|
-
|
|
37
|
-
it { is_expected.to be_nil }
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
describe "#find_by_name" do
|
|
42
|
-
subject(:results) { described_class.find_by_name(name) }
|
|
43
|
-
|
|
44
|
-
let(:postal_code) { results.first }
|
|
45
|
-
|
|
46
|
-
context "when name exists" do
|
|
47
|
-
let(:name) { "HUNDVÅG" }
|
|
48
|
-
|
|
49
|
-
it { is_expected.to be_an(Array) }
|
|
50
|
-
specify { expect(postal_code).to be_a(described_class) }
|
|
51
|
-
specify { expect(postal_code.code).to eq("4077") }
|
|
52
|
-
specify { expect(postal_code.name).to eq("HUNDVÅG") }
|
|
53
|
-
specify { expect(postal_code.municipality).to eq("STAVANGER") }
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
context "when name does not exist" do
|
|
57
|
-
let(:name) { "XYZZYX" }
|
|
58
|
-
|
|
59
|
-
it { is_expected.to be_nil }
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|