postnummer_norge 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.rdoc +11 -0
- data/Rakefile +1 -0
- data/lib/postnummer_norge.rb +7 -0
- data/lib/postnummer_norge/postal_code.rb +45 -0
- data/lib/postnummer_norge/postal_codes.tab +4586 -0
- data/lib/postnummer_norge/version.rb +3 -0
- data/postnummer_norge.gemspec +25 -0
- data/spec/lib/postal_code_spec.rb +30 -0
- data/spec/spec_helper.rb +2 -0
- metadata +109 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "postnummer_norge/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "postnummer_norge"
|
7
|
+
s.version = PostnummerNorge::VERSION
|
8
|
+
s.authors = ["Inge Jørgensen"]
|
9
|
+
s.email = ["inge@manualdesign.no"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Ruby gem for looking up and verifying Norwegian postal codes}
|
12
|
+
s.summary = %q{Ruby gem for looking up and verifying Norwegian postal codes}
|
13
|
+
|
14
|
+
#s.rubyforge_project = "postnummer_norge"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
s.add_development_dependency "rspec", ">= 2.10.0"
|
23
|
+
s.add_development_dependency "rake", "0.9.2.2"
|
24
|
+
# s.add_runtime_dependency "rest-client"
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
include PostnummerNorge
|
5
|
+
|
6
|
+
describe PostnummerNorge::PostalCode do
|
7
|
+
|
8
|
+
it 'checks for existence' do
|
9
|
+
PostalCode.exists?('0662').should be_true
|
10
|
+
PostalCode.exists?('0002').should be_false
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'finds postal code by number' do
|
14
|
+
postal_code = PostalCode.find('4085')
|
15
|
+
postal_code.should be_kind_of(PostalCode)
|
16
|
+
postal_code.name.should == 'HUNDVÅG'
|
17
|
+
postal_code.municipality.should == 'STAVANGER'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'returns nil for invalid postal codes' do
|
21
|
+
PostalCode.find('0002').should be_nil
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'finds postal code by name' do
|
25
|
+
postal_code = PostalCode.find_by_name('HUNDVÅG').first
|
26
|
+
postal_code.should be_kind_of(PostalCode)
|
27
|
+
postal_code.code.should == '4085'
|
28
|
+
postal_code.name.should == 'HUNDVÅG'
|
29
|
+
end
|
30
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: postnummer_norge
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- "Inge J\xC3\xB8rgensen"
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-06-22 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
+
none: false
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
hash: 39
|
27
|
+
segments:
|
28
|
+
- 2
|
29
|
+
- 10
|
30
|
+
- 0
|
31
|
+
version: 2.10.0
|
32
|
+
name: rspec
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
requirement: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - "="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 11
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
- 9
|
46
|
+
- 2
|
47
|
+
- 2
|
48
|
+
version: 0.9.2.2
|
49
|
+
name: rake
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
requirement: *id002
|
53
|
+
description:
|
54
|
+
email:
|
55
|
+
- inge@manualdesign.no
|
56
|
+
executables: []
|
57
|
+
|
58
|
+
extensions: []
|
59
|
+
|
60
|
+
extra_rdoc_files: []
|
61
|
+
|
62
|
+
files:
|
63
|
+
- .gitignore
|
64
|
+
- Gemfile
|
65
|
+
- README.rdoc
|
66
|
+
- Rakefile
|
67
|
+
- lib/postnummer_norge.rb
|
68
|
+
- lib/postnummer_norge/postal_code.rb
|
69
|
+
- lib/postnummer_norge/postal_codes.tab
|
70
|
+
- lib/postnummer_norge/version.rb
|
71
|
+
- postnummer_norge.gemspec
|
72
|
+
- spec/lib/postal_code_spec.rb
|
73
|
+
- spec/spec_helper.rb
|
74
|
+
homepage: ""
|
75
|
+
licenses: []
|
76
|
+
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
version: "0"
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
hash: 3
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
requirements: []
|
101
|
+
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 1.8.24
|
104
|
+
signing_key:
|
105
|
+
specification_version: 3
|
106
|
+
summary: Ruby gem for looking up and verifying Norwegian postal codes
|
107
|
+
test_files:
|
108
|
+
- spec/lib/postal_code_spec.rb
|
109
|
+
- spec/spec_helper.rb
|