cpr-client 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cpr_client/record.rb +18 -3
- data/lib/cpr_client/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab8c7d4ff27eab71f8a508a70ea5e82f74930fff
|
4
|
+
data.tar.gz: 5d35cf5c9e06f9159635bb46c0a28ce3f0cbad2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 782553d02d2cd44b8191df7623e49aef74a2e8abde9962b1b62db495180ce221583373c98b772e2afde401cdcc9067fc45f789d58b8b45a32003243f865b7b45
|
7
|
+
data.tar.gz: 9a0c7c4ef012d018decb90773bd5d2e194e6f1e5b41295f4f7139ec320559ec0ffd2715900a88bb47a172bb8b32ad985a542aed3ac201dcd996339e0885682b7
|
data/lib/cpr_client/record.rb
CHANGED
@@ -41,16 +41,31 @@ module CPRClient
|
|
41
41
|
# The address will be a string of the fields
|
42
42
|
# STADR, POSTNR and POSTNR's t attribute.
|
43
43
|
#
|
44
|
-
# Fx. Boulevarden 101,1 mf, 6800 Varde
|
44
|
+
# Fx. Boulevarden 101, 1. mf, 6800 Varde
|
45
45
|
#
|
46
46
|
# @return string with address or nil
|
47
47
|
def address
|
48
|
-
|
49
|
-
|
48
|
+
street_and_number = "#{get(:vejkod, :t)} #{get_clean(:husnr)}"
|
49
|
+
postal_district = "#{get(:postnr)} #{get(:postnr, :t)}"
|
50
|
+
door = get_clean(:sidedoer)
|
51
|
+
floor = get_clean(:etage)
|
52
|
+
|
53
|
+
if floor and door
|
54
|
+
"#{street_and_number}, #{floor}. #{door}, #{postal_district}"
|
55
|
+
elsif floor
|
56
|
+
"#{street_and_number}, #{floor}., #{postal_district}"
|
57
|
+
else
|
58
|
+
"#{street_and_number}, #{postal_district}"
|
59
|
+
end
|
50
60
|
end
|
51
61
|
|
52
62
|
private
|
53
63
|
|
64
|
+
def get_clean(name, value = 'v')
|
65
|
+
value = get(name, value)
|
66
|
+
value.sub(/^[ 0\-]*(.*?)\s*/, '\1') if value
|
67
|
+
end
|
68
|
+
|
54
69
|
def extract_fields(xml_doc)
|
55
70
|
Hash[xml_doc.css("Praes[r='STAMPNR'] Field").reduce([]) { |a, f|
|
56
71
|
attrs = Hash[f.keys.zip(f.values)]
|
data/lib/cpr_client/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cpr-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Andersen
|
@@ -98,9 +98,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.
|
101
|
+
rubygems_version: 2.6.13
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: CPR Client
|
105
105
|
test_files: []
|
106
|
-
has_rdoc:
|