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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: daaea0b9741a8ba8f133cdbe08c5526433e0e9b1
4
- data.tar.gz: d7cd374f49a63a246aa61ddeb8c6b3c30b5a1f03
3
+ metadata.gz: 2a78908818428f7a3b27ebd88c72e3537017cadf
4
+ data.tar.gz: c985dd242c57a4f05310fff7e7dac085a9babc60
5
5
  SHA512:
6
- metadata.gz: 28f1404cf84dee0f2a055f68fd05c0a27ce234095ca5eafc3ddd8ba747fab251b140dc779d0c7797261588ed137c51068b5ec91c4a5e9923f7759fcc63a740ab
7
- data.tar.gz: 70a0dfaf32ae732912c6f6968cae0c3c93c111d6ce57f10a172fb4f8342446b29be14783b2f35328cc2d67f5e01e520739865f493a57577d19061165c4d0b440
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 (as a private company).
5
- It is backed by HTTPClient.
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
+ ```
@@ -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 = @http.post(@endpoint, body)
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
@@ -1,3 +1,3 @@
1
1
  module CPRClient
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
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.5
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 (as a private company)
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: []