brreg_grunndata 0.1.0 → 0.1.1

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: 8c7872a9ecab4f94b66773b90b69ce5cd11e8a17
4
- data.tar.gz: f9dbec572665afcd6cfde816734b58d611efefd9
3
+ metadata.gz: 4ea46e3cbb4cb488e8fa34b33cc7318d09fc7838
4
+ data.tar.gz: d565a394fbd09068cdc994e9fc80d6142de51d43
5
5
  SHA512:
6
- metadata.gz: 1e029e32e64679064bc986579f7575487a49848af27702ac5890d3d9ad82cb052c79685b3d80069069921019b49397839f05c6b4f676d686bfb77b233857bea1
7
- data.tar.gz: eab73cef78ce031e4abed34beb5143d3d6d887392e4cb1cc1127d29fb8d5e2dade4cd2ee64a6b523eae75d64c67f153fd98e42a4e48c31cb0f3409181c5121e2
6
+ metadata.gz: 5e994fb218c774d416234a80f81909d8920f37992a5f8f3075f4c61c2cf71625ac33bb3498b67b206faeab1a64b7fa117ac67ef291cde00cb6ce83022a5c8a45
7
+ data.tar.gz: aff02a4e7c68f6a9eec54ab89fea33d42c039a7bc3a317c93d0966802cba34d8e80cc83e6d35fbca748eb6057cf1c342da76a5f96fd2080a15cbf3ec76a70c37
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ ## v.0.1.1 (to be released)
2
+
3
+ * Added `hent_saerlige_opplysninger` to the service layer.
4
+ * Added client spec for `hent_saerlige_opplysninger`.
5
+
6
+ ## v.0.1.0
7
+
8
+ * First release. Includes config, client and a higher level service.
9
+ * Service supports operations `hent_basisdata_mini` and `hent_kontaktdata`.
10
+ * Clients supports operations `hent_basisdata_mini`, `hent_kontaktdata`,
11
+ `sok_enhet`, `hent_saerlige_opplysninger` and
12
+ `hent_opplysninger_tilknyttet_register`.
@@ -52,5 +52,18 @@ module BrregGrunndata
52
52
  def hent_kontaktdata(orgnr:)
53
53
  Types::FromResponseFactory.organization client.hent_kontaktdata orgnr: orgnr
54
54
  end
55
+
56
+ # Get additional information about an organization
57
+ #
58
+ # Like when where the last time the reported taxes, are they registered in
59
+ # the VAT registry etc.
60
+ #
61
+ # Arguments
62
+ # orgnr - The orgnr you are searching for
63
+ #
64
+ # @return BrregGrunndata::Types::Organization
65
+ def hent_saerlige_opplysninger(orgnr:)
66
+ Types::FromResponseFactory.organization client.hent_saerlige_opplysninger orgnr: orgnr
67
+ end
55
68
  end
56
69
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base'
4
+
5
+ module BrregGrunndata
6
+ module Types
7
+ # Additional information represents data we get from
8
+ # the hent_saerlige_opplysninger soap operation.
9
+ #
10
+ # It contains status code, a Norwegian description and date for when
11
+ # this information was registered.
12
+ class AdditionalInformation < Base
13
+ attribute :status_code, Types::String
14
+ attribute :description, Types::String
15
+ attribute :registered_date, Types::Form::Date
16
+ end
17
+ end
18
+ end
@@ -3,6 +3,7 @@
3
3
  require_relative 'organization'
4
4
  require_relative 'organizational_form'
5
5
  require_relative 'address'
6
+ require_relative 'additional_information'
6
7
 
7
8
  module BrregGrunndata
8
9
  module Types
@@ -12,6 +13,7 @@ module BrregGrunndata
12
13
  # Creates an organization from given hash
13
14
  #
14
15
  # rubocop:disable Metrics/MethodLength
16
+ # rubocop:disable Metrics/AbcSize
15
17
  #
16
18
  # @return BrregGrunndata::Types::Organization
17
19
  def organization(h)
@@ -28,10 +30,13 @@ module BrregGrunndata
28
30
  web_page: h[:hjemmesideadresse],
29
31
 
30
32
  business_address: business_address(h[:forretnings_adresse]),
31
- postal_address: postal_address(h[:post_adresse])
33
+ postal_address: postal_address(h[:post_adresse]),
34
+
35
+ additional_information: additional_information(h.dig(:saerlige_opplysninger, :status))
32
36
  )
33
37
  end
34
38
  # rubocop:enable Metrics/MethodLength
39
+ # rubocop:enable Metrics/AbcSize
35
40
 
36
41
  # Creates a address for given Hash
37
42
  #
@@ -59,6 +64,16 @@ module BrregGrunndata
59
64
  )
60
65
  end
61
66
 
67
+ def additional_information(lines)
68
+ Array(lines).map do |line|
69
+ AdditionalInformation.new(
70
+ status_code: line[:@statuskode],
71
+ description: line[:tekst_linje],
72
+ registered_date: line[:@registrerings_dato]
73
+ )
74
+ end
75
+ end
76
+
62
77
  # As of writing, keys for postal and business address
63
78
  # are the same, so the are both initialized here
64
79
  def __address(h)
@@ -3,6 +3,7 @@
3
3
  require_relative 'base'
4
4
  require_relative 'address'
5
5
  require_relative 'organizational_form'
6
+ require_relative 'additional_information'
6
7
 
7
8
  module BrregGrunndata
8
9
  module Types
@@ -20,6 +21,10 @@ module BrregGrunndata
20
21
 
21
22
  attribute :business_address, Types::Address.optional
22
23
  attribute :postal_address, Types::Address.optional
24
+
25
+ attribute :additional_information, Types::Strict::Array
26
+ .member(Types::AdditionalInformation)
27
+ .default([])
23
28
  end
24
29
  end
25
30
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrregGrunndata
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brreg_grunndata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thorbjørn Hermansen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-05 00:00:00.000000000 Z
11
+ date: 2016-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -119,6 +119,7 @@ files:
119
119
  - ".rspec"
120
120
  - ".rubocop.yml"
121
121
  - ".travis.yml"
122
+ - CHANGELOG.md
122
123
  - CODE_OF_CONDUCT.md
123
124
  - Gemfile
124
125
  - LICENSE.txt
@@ -136,6 +137,7 @@ files:
136
137
  - lib/brreg_grunndata/configuration.rb
137
138
  - lib/brreg_grunndata/error.rb
138
139
  - lib/brreg_grunndata/service.rb
140
+ - lib/brreg_grunndata/types/additional_information.rb
139
141
  - lib/brreg_grunndata/types/address.rb
140
142
  - lib/brreg_grunndata/types/base.rb
141
143
  - lib/brreg_grunndata/types/factories.rb