cpr-client 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/lib/cpr_client/client.rb +11 -5
- data/lib/cpr_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a78908818428f7a3b27ebd88c72e3537017cadf
|
4
|
+
data.tar.gz: c985dd242c57a4f05310fff7e7dac085a9babc60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e81272abfb112667cafd1c03df30600fdc999791411aa983f3b557a5d29b71aa5d8080ff5f06e432ce874779a46c01f1a5215c43d893a7c5626e432b3252a49c
|
7
|
+
data.tar.gz: 4d788c44e214ee4801f02cb3476eaa581785345428eef9b1ba8fa27849848f239572c36fcf2f7b71e3b4331ec078591ce64efe71481cc783f7121b834a30eade
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
CPR Client
|
2
2
|
===
|
3
3
|
|
4
|
-
A client for looking up people in the CPR registry
|
5
|
-
|
4
|
+
A client for looking up people in the danish CPR registry.
|
5
|
+
This cpr-client only supports requests allowed for private companies (STAMP).
|
6
|
+
To use the CPR services, you must first get an agreement with [cpr.dk](https://cpr.dk/).
|
6
7
|
|
7
8
|
Install
|
8
9
|
-------
|
@@ -31,4 +32,4 @@ else
|
|
31
32
|
puts record[:adrnvn]
|
32
33
|
puts record[:adrnvn, :t]
|
33
34
|
end
|
34
|
-
```
|
35
|
+
```
|
data/lib/cpr_client/client.rb
CHANGED
@@ -15,10 +15,6 @@ module CPRClient
|
|
15
15
|
# @param endpoint the full URI to the cpr gctp service
|
16
16
|
def initialize(user, pass, endpoint)
|
17
17
|
@user, @pass, @endpoint = user, pass, endpoint
|
18
|
-
@http = HTTPClient.new(
|
19
|
-
agent_name: "CPRClient/#{CPRClient::VERSION}",
|
20
|
-
default_header: { 'Content-Type' => 'text/xml' }
|
21
|
-
)
|
22
18
|
end
|
23
19
|
|
24
20
|
# Returns a Record object or nil if the record could not be found.
|
@@ -90,11 +86,21 @@ module CPRClient
|
|
90
86
|
# @return a Nokogiri::XML object
|
91
87
|
# @raise ClientError if the response status was not 200
|
92
88
|
def post(body)
|
93
|
-
resp =
|
89
|
+
resp = http.post(@endpoint, body)
|
94
90
|
raise ClientError, 'Bad response' if resp.status != 200
|
95
91
|
Nokogiri::XML(resp.body)
|
96
92
|
end
|
97
93
|
|
94
|
+
# Returns the underlying HTTPClient.
|
95
|
+
#
|
96
|
+
# @return a HTTPClient
|
97
|
+
def http
|
98
|
+
@http ||= HTTPClient.new(
|
99
|
+
agent_name: "CPRClient/#{CPRClient::VERSION}",
|
100
|
+
default_header: { 'Content-Type' => 'text/xml' }
|
101
|
+
)
|
102
|
+
end
|
103
|
+
|
98
104
|
private
|
99
105
|
|
100
106
|
def login_body
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Andersen
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2.7'
|
69
|
-
description: Client for making requests to the CPR registry (
|
69
|
+
description: Client for making STAMP requests to the danish CPR registry (cpr.dk).
|
70
70
|
email: michael@aion.dk
|
71
71
|
executables: []
|
72
72
|
extensions: []
|