brreg 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/brreg.gemspec +2 -2
- data/lib/brreg/version.rb +1 -1
- data/lib/brreg.rb +16 -15
- metadata +14 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9d20871bf9a0c7bf08e2ee2331ed03bb0ce2a3dd2545d7b28b0c150e57c206e4
|
4
|
+
data.tar.gz: 6d21f7ba3b987eeb013f3df2e0c3e1116159250f616e20641854381a6c73c832
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0499839d05a11289b5f09b07f091f4c6c26972e9a3d96a67185ffc87068a5edb41ac0bf23378c4e2f73d0612faf2950c38476dab926173b2d2c3880958d625f2'
|
7
|
+
data.tar.gz: f2ed13bce171af06b19ea3eefd838dc690943511a1c5a85efeb27523f6287057b13acb643a191d1c8fa9011e80846821fdfc990ef2121fe8614074e6ff4dfffb
|
data/brreg.gemspec
CHANGED
@@ -17,6 +17,6 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = "brreg"
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_development_dependency "bundler"
|
21
|
-
spec.add_development_dependency "rake"
|
20
|
+
spec.add_development_dependency "bundler"
|
21
|
+
spec.add_development_dependency "rake"
|
22
22
|
end
|
data/lib/brreg/version.rb
CHANGED
data/lib/brreg.rb
CHANGED
@@ -3,7 +3,7 @@ require 'net/http'
|
|
3
3
|
require 'json'
|
4
4
|
|
5
5
|
module Brreg
|
6
|
-
BrregURI = 'https://
|
6
|
+
BrregURI = 'https://data.brreg.no/enhetsregisteret/api/enheter'
|
7
7
|
def self.find_by_orgnr(orgnr)
|
8
8
|
if !orgnr
|
9
9
|
puts "Ugyldig verdi"
|
@@ -17,21 +17,22 @@ module Brreg
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
|
-
res = get_json( { :
|
20
|
+
res = get_json( { :organisasjonsnummer => orgnr } )
|
21
21
|
if res.is_a?(Net::HTTPSuccess)
|
22
22
|
jsonres = JSON.parse(res.body)
|
23
|
-
|
24
|
-
|
23
|
+
matches = jsonres['_embedded']['enheter']
|
24
|
+
if matches.length > 0
|
25
|
+
company = matches.first
|
25
26
|
puts "\n"
|
26
27
|
puts "\e[32mViser oppføring for orgnr #{orgnr}\e[0m"
|
27
28
|
puts "\n"
|
28
29
|
puts company['navn']
|
29
|
-
puts company['
|
30
|
-
puts company['
|
30
|
+
puts company['forretningsadresse']['adresse']
|
31
|
+
puts company['forretningsadresse']['postnummer'] + ' ' + company['forretningsadresse']['poststed']
|
31
32
|
if !company['postadresse'].empty?
|
32
33
|
puts 'Postadresse:'
|
33
|
-
puts company['postadresse']
|
34
|
-
puts company['
|
34
|
+
puts company['postadresse']['adresse']
|
35
|
+
puts company['postadresse']['postnummer'] + ' ' + company['postadresse']['poststed']
|
35
36
|
end
|
36
37
|
else
|
37
38
|
puts "Fant ingen oppføring for #{orgnr}"
|
@@ -61,17 +62,17 @@ module Brreg
|
|
61
62
|
puts "\n"
|
62
63
|
puts "\e[32mTreff i Enhetsregisteret basert på søket '#{query}'\e[0m"
|
63
64
|
puts "\n"
|
64
|
-
res = self.get_json( { :
|
65
|
+
res = self.get_json( { :navn => query } )
|
65
66
|
if res.is_a?(Net::HTTPSuccess)
|
66
67
|
jsonres = JSON.parse(res.body)
|
67
|
-
matches = jsonres['
|
68
|
-
if matches > 0
|
69
|
-
if matches == 1
|
68
|
+
matches = jsonres['_embedded']['enheter']
|
69
|
+
if matches.length > 0
|
70
|
+
if matches.length == 1
|
70
71
|
puts "Fant 1 oppføring"
|
71
|
-
Brreg.find_by_orgnr(
|
72
|
+
Brreg.find_by_orgnr( matches.first['organisasjonsnummer'] )
|
72
73
|
else
|
73
|
-
for entry in
|
74
|
-
puts entry['
|
74
|
+
for entry in matches
|
75
|
+
puts entry['organisasjonsnummer'] + ' ' + entry['navn']
|
75
76
|
end
|
76
77
|
end
|
77
78
|
else
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brreg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Espen Antonsen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
description: Search Norwegian companies
|
42
42
|
email:
|
43
43
|
- espen@inspired.no
|
@@ -60,7 +60,7 @@ files:
|
|
60
60
|
homepage: http://github.com/espen/brreg
|
61
61
|
licenses: []
|
62
62
|
metadata: {}
|
63
|
-
post_install_message:
|
63
|
+
post_install_message:
|
64
64
|
rdoc_options: []
|
65
65
|
require_paths:
|
66
66
|
- lib
|
@@ -75,9 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
|
79
|
-
|
80
|
-
signing_key:
|
78
|
+
rubygems_version: 3.5.16
|
79
|
+
signing_key:
|
81
80
|
specification_version: 4
|
82
81
|
summary: Search Enhetsregisteret i Brønnøysundsregisteret
|
83
82
|
test_files: []
|