gus_bir1 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +26 -0
- data/CHANGELOG.md +8 -0
- data/README.md +15 -13
- data/gus_bir1.gemspec +1 -1
- data/lib/gus_bir1/response/search.rb +24 -18
- data/lib/gus_bir1/version.rb +1 -1
- data/lib/gus_bir1.rb +0 -1
- metadata +7 -10
- data/.travis.yml +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9680b3fb20b4b3c9e2709a6983408db4d0a7ae0c44a785e9091d6517565642d8
|
4
|
+
data.tar.gz: f546c8a9fcb50cc6be2347a55f4020e5099a480b91876013cb4eeae52bf58321
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9eca81e9d55c9964f14579eab5dc36cabedbcf479a291a4ada75c4c8982ba9ac73daccf93bc3bc68e9470fe239047f84612df0497f58b6408664cdde9aed7b1b
|
7
|
+
data.tar.gz: 1dbe40541fa79eaff76e1a7719d1a3d90555e161120e9dbcf7f661b9faa182485bbc3d34f1789337041bb46492442545b824cbc35d1a4d19deb5cf508f8a5b65
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: CI Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ 'master', 'develop' ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ 'master', 'develop' ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
env:
|
13
|
+
CI: true
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby-version: ['3.2', '3.3', '3.4']
|
17
|
+
steps:
|
18
|
+
- name: Checkout code
|
19
|
+
uses: actions/checkout@v3
|
20
|
+
- name: Install Ruby and gems
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
24
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
25
|
+
- name: Run unit tests
|
26
|
+
run: bundle exec rake test
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 1.3.0
|
4
|
+
|
5
|
+
- Removed `ostruct` from codebase. Replaced data structures returned by the library with the `Struct` defined underneath. This might be a breaking change if you used OpenStruct and extended it by adding your own fields in your applications.
|
6
|
+
```rb
|
7
|
+
SearchResult = Struct.new(:name, :regon, :province, :district, :community, :city, :zip_code, :street, :street_number, :house_number, :street_address, :type, :silos_id, :type_desc, :silos_desc, :report :post_city)
|
8
|
+
```
|
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# GusBir1
|
2
|
-
[](LICENSE)
|
3
|
+
[](https://github.com/espago/gus_bir1/actions/workflows/ci.yml/badge.svg)
|
3
4
|
[](https://badge.fury.io/rb/gus_bir1)
|
4
5
|
[](https://codeclimate.com/github/espago/gus_bir1)
|
5
6
|
[](https://codeclimate.com/github/espago/gus_bir1)
|
6
7
|
|
7
|
-
Simple,
|
8
|
-
|
8
|
+
Simple, Ruby wrapper for REGON database (Baza Internetowa Regon (BIR))(web frontend is reachable at https://wyszukiwarkaregon.stat.gov.pl/appBIR/index.aspx). To access its SOAP API, one needs a USER_KEY issued by REGON administrators available at regon_bir@stat.gov.pl.
|
9
|
+
|
10
|
+
Official GUS docs: https://api.stat.gov.pl/Home/RegonApi
|
9
11
|
|
10
12
|
|
11
13
|
## Installation
|
@@ -74,47 +76,47 @@ To start querying the GUS database, You can use three methods `GusBir1.find_by`,
|
|
74
76
|
with `regon`
|
75
77
|
```ruby
|
76
78
|
response = GusBir1.find_by(regon: '00033150100000')
|
77
|
-
=> [#<
|
79
|
+
=> [#<struct GusBir1::Response::SearchResult name="GŁÓWNY URZĄD STATYSTYCZNY", regon="00033150100000", province="MAZOWIECKIE", district="m. st. Warszawa", community="Śródmieście", city="Warszawa", zip_code="00-925", street="ul. Test-Krucza", type="P", silos_id="6", type_desc="Typ jednostki – jednostka prawna", silos_desc="Miejsce prowadzenia działalności jednostki prawnej", report="PublDaneRaportPrawna">]
|
78
80
|
response.class
|
79
81
|
=> Array
|
80
82
|
response.first
|
81
|
-
=> #<
|
83
|
+
=> #<struct GusBir1::Response::SearchResult name="GŁÓWNY URZĄD STATYSTYCZNY", regon="00033150100000", province="MAZOWIECKIE", district="m. st. Warszawa", community="Śródmieście", city="Warszawa", zip_code="00-925", street="ul. Test-Krucza", type="P", silos_id="6", type_desc="Typ jednostki – jednostka prawna", silos_desc="Miejsce prowadzenia działalności jednostki prawnej", report="PublDaneRaportPrawna">
|
82
84
|
```
|
83
85
|
|
84
86
|
with `nip`
|
85
87
|
```ruby
|
86
88
|
response = GusBir1.find_by(nip: '8992689516')
|
87
|
-
=> [#<
|
89
|
+
=> [#<struct GusBir1::Response::SearchResult name="\"PSP POLSKA\" SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ", regon="02121583300000", province="DOLNOŚLĄSKIE", district="m. Wrocław", community="Wrocław-Stare Miasto", city="Wrocław", zip_code="53-505", street="ul. Test-Krucza", type="P", silos_id="6", type_desc="Typ jednostki – jednostka prawna", silos_desc="Miejsce prowadzenia działalności jednostki prawnej", report="PublDaneRaportPrawna">]
|
88
90
|
```
|
89
91
|
|
90
92
|
with `krs`
|
91
93
|
```ruby
|
92
94
|
response = GusBir1.find_by(krs: '0000352235')
|
93
|
-
=> [#<
|
95
|
+
=> [#<struct GusBir1::Response::SearchResult name="\"PSP POLSKA\" SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ", regon="02121583300000", province="DOLNOŚLĄSKIE", district="m. Wrocław", community="Wrocław-Stare Miasto", city="Wrocław", zip_code="53-505", street="ul. Test-Krucza", type="P", silos_id="6", type_desc="Typ jednostki – jednostka prawna", silos_desc="Miejsce prowadzenia działalności jednostki prawnej", report="PublDaneRaportPrawna">]
|
94
96
|
```
|
95
97
|
|
96
98
|
with `regons14` (up to 20 regons)
|
97
99
|
```ruby
|
98
100
|
response = GusBir1.find_by(regons14: '00033150100000,02121583300000')
|
99
|
-
=> [#<
|
101
|
+
=> [#<struct GusBir1::Response::SearchResult name="GŁÓWNY URZĄD STATYSTYCZNY", regon="00033150100000", province="MAZOWIECKIE", district="m. st. Warszawa", community="Śródmieście", city="Warszawa", zip_code="00-925", street="ul. Test-Krucza", type="P", silos_id="6", type_desc="Typ jednostki – jednostka prawna", silos_desc="Miejsce prowadzenia działalności jednostki prawnej", report="PublDaneRaportPrawna">, #<struct GusBir1::Response::SearchResult name="\"PSP POLSKA\" SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ", regon="02121583300000", province="DOLNOŚLĄSKIE", district="m. Wrocław", community="Wrocław-Stare Miasto", city="Wrocław", zip_code="53-505", street="ul. Test-Krucza", type="P", silos_id="6", type_desc="Typ jednostki – jednostka prawna", silos_desc="Miejsce prowadzenia działalności jednostki prawnej", report="PublDaneRaportPrawna">]
|
100
102
|
```
|
101
103
|
|
102
104
|
with `regons9` (up to 20 regons)
|
103
105
|
```ruby
|
104
106
|
response = GusBir1.find_by(regons9: '000331501,021215833')
|
105
|
-
=> [#<
|
107
|
+
=> [#<struct GusBir1::Response::SearchResult name="GŁÓWNY URZĄD STATYSTYCZNY", regon="00033150100000", province="MAZOWIECKIE", district="m. st. Warszawa", community="Śródmieście", city="Warszawa", zip_code="00-925", street="ul. Test-Krucza", type="P", silos_id="6", type_desc="Typ jednostki – jednostka prawna", silos_desc="Miejsce prowadzenia działalności jednostki prawnej", report="PublDaneRaportPrawna">, #<struct GusBir1::Response::SearchResult name="\"PSP POLSKA\" SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ", regon="02121583300000", province="DOLNOŚLĄSKIE", district="m. Wrocław", community="Wrocław-Stare Miasto", city="Wrocław", zip_code="53-505", street="ul. Test-Krucza", type="P", silos_id="6", type_desc="Typ jednostki – jednostka prawna", silos_desc="Miejsce prowadzenia działalności jednostki prawnej", report="PublDaneRaportPrawna">]
|
106
108
|
```
|
107
109
|
|
108
110
|
with `nips` (up to 20 nips)
|
109
111
|
```ruby
|
110
112
|
response = GusBir1.find_by(nips: '8992689516,5261040828')
|
111
|
-
=> [#<
|
113
|
+
=> [#<struct GusBir1::Response::SearchResult name="GŁÓWNY URZĄD STATYSTYCZNY", regon="00033150100000", province="MAZOWIECKIE", district="m. st. Warszawa", community="Śródmieście", city="Warszawa", zip_code="00-925", street="ul. Test-Krucza", type="P", silos_id="6", type_desc="Typ jednostki – jednostka prawna", silos_desc="Miejsce prowadzenia działalności jednostki prawnej", report="PublDaneRaportPrawna">, #<struct GusBir1::Response::SearchResult name="\"PSP POLSKA\" SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ", regon="02121583300000", province="DOLNOŚLĄSKIE", district="m. Wrocław", community="Wrocław-Stare Miasto", city="Wrocław", zip_code="53-505", street="ul. Test-Krucza", type="P", silos_id="6", type_desc="Typ jednostki – jednostka prawna", silos_desc="Miejsce prowadzenia działalności jednostki prawnej", report="PublDaneRaportPrawna">]
|
112
114
|
```
|
113
115
|
|
114
116
|
with `krss` (up to 20 krss)
|
115
117
|
```ruby
|
116
118
|
response = GusBir1.find_by(krss: '0000352235')
|
117
|
-
=> [#<
|
119
|
+
=> [#<struct GusBir1::Response::SearchResult name="\"PSP POLSKA\" SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ", regon="02121583300000", province="DOLNOŚLĄSKIE", district="m. Wrocław", community="Wrocław-Stare Miasto", city="Wrocław", zip_code="53-505", street="ul. Test-Krucza", type="P", silos_id="6", type_desc="Typ jednostki – jednostka prawna", silos_desc="Miejsce prowadzenia działalności jednostki prawnej", report="PublDaneRaportPrawna">]
|
118
120
|
```
|
119
121
|
|
120
122
|
#### get_full_data
|
@@ -144,7 +146,7 @@ response.first.class
|
|
144
146
|
## Example
|
145
147
|
|
146
148
|
```ruby
|
147
|
-
company =
|
149
|
+
company = struct GusBir1::Response::SearchResult.new
|
148
150
|
|
149
151
|
gus_response = GusBir1.find_and_get_full_data(nip: 5261040828)
|
150
152
|
if gus_response.first
|
@@ -164,7 +166,7 @@ if gus_response.first
|
|
164
166
|
end
|
165
167
|
|
166
168
|
company
|
167
|
-
=> #<
|
169
|
+
=> #<struct GusBir1::Response::SearchResult name="GUS", address="ul. Test-Krucza 208", zip="00-925", city="Warszawa", country="POLSKA", regon="00033150100000", nip="5261040828">
|
168
170
|
```
|
169
171
|
|
170
172
|
|
data/gus_bir1.gemspec
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
module GusBir1
|
4
4
|
module Response
|
5
|
+
SearchResult = Struct.new(:name, :regon, :province, :district, :community,
|
6
|
+
:city, :zip_code, :street, :street_number,
|
7
|
+
:house_number, :street_address, :type, :silos_id,
|
8
|
+
:type_desc, :silos_desc, :report, :post_city)
|
9
|
+
|
5
10
|
class Search
|
6
11
|
def initialize(body)
|
7
12
|
@body = body
|
@@ -17,24 +22,25 @@ module GusBir1
|
|
17
22
|
private
|
18
23
|
|
19
24
|
def parse_dane(hash)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
25
|
+
SearchResult.new.tap do |search_result|
|
26
|
+
search_result.name = hash['Nazwa']
|
27
|
+
search_result.regon = hash['Regon']
|
28
|
+
search_result.province = hash['Wojewodztwo']
|
29
|
+
search_result.district = hash['Powiat']
|
30
|
+
search_result.community = hash['Gmina']
|
31
|
+
search_result.city = hash['Miejscowosc']
|
32
|
+
search_result.zip_code = hash['KodPocztowy']
|
33
|
+
search_result.street = hash['Ulica']
|
34
|
+
search_result.street_number = hash['NrNieruchomosci']
|
35
|
+
search_result.house_number = hash['NrLokalu']
|
36
|
+
search_result.street_address = street_address_from(hash)
|
37
|
+
search_result.type = hash['Typ']
|
38
|
+
search_result.silos_id = hash['SilosID']
|
39
|
+
search_result.type_desc = type_info(search_result)
|
40
|
+
search_result.silos_desc = silos_info(search_result)
|
41
|
+
search_result.report = report_info(search_result)
|
42
|
+
search_result.post_city = hash['MiejscowoscPoczty']
|
43
|
+
end
|
38
44
|
end
|
39
45
|
|
40
46
|
def type_info(search_result)
|
data/lib/gus_bir1/version.rb
CHANGED
data/lib/gus_bir1.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gus_bir1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Waclaw Luczak
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: bundler
|
@@ -86,14 +85,14 @@ dependencies:
|
|
86
85
|
requirements:
|
87
86
|
- - "~>"
|
88
87
|
- !ruby/object:Gem::Version
|
89
|
-
version: '2.
|
88
|
+
version: '2.15'
|
90
89
|
type: :runtime
|
91
90
|
prerelease: false
|
92
91
|
version_requirements: !ruby/object:Gem::Requirement
|
93
92
|
requirements:
|
94
93
|
- - "~>"
|
95
94
|
- !ruby/object:Gem::Version
|
96
|
-
version: '2.
|
95
|
+
version: '2.15'
|
97
96
|
- !ruby/object:Gem::Dependency
|
98
97
|
name: savon-multipart
|
99
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,15 +107,15 @@ dependencies:
|
|
108
107
|
- - ">="
|
109
108
|
- !ruby/object:Gem::Version
|
110
109
|
version: '0'
|
111
|
-
description:
|
112
110
|
email:
|
113
111
|
- waclaw@luczak.it
|
114
112
|
executables: []
|
115
113
|
extensions: []
|
116
114
|
extra_rdoc_files: []
|
117
115
|
files:
|
116
|
+
- ".github/workflows/ci.yml"
|
118
117
|
- ".gitignore"
|
119
|
-
-
|
118
|
+
- CHANGELOG.md
|
120
119
|
- Gemfile
|
121
120
|
- LICENSE.txt
|
122
121
|
- README.md
|
@@ -140,7 +139,6 @@ homepage: https://github.com/espago/gus_bir1
|
|
140
139
|
licenses:
|
141
140
|
- MIT
|
142
141
|
metadata: {}
|
143
|
-
post_install_message:
|
144
142
|
rdoc_options: []
|
145
143
|
require_paths:
|
146
144
|
- lib
|
@@ -155,8 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
153
|
- !ruby/object:Gem::Version
|
156
154
|
version: '0'
|
157
155
|
requirements: []
|
158
|
-
rubygems_version: 3.
|
159
|
-
signing_key:
|
156
|
+
rubygems_version: 3.6.7
|
160
157
|
specification_version: 4
|
161
158
|
summary: Rails GUS API library based on official REGON SOAP api.
|
162
159
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
env:
|
2
|
-
global:
|
3
|
-
- CC_TEST_REPORTER_ID=21904179f670d8951ec18038872b42fbd37ad057a2342c30197dfebaae2ab27e
|
4
|
-
-
|
5
|
-
sudo: false
|
6
|
-
language: ruby
|
7
|
-
rvm:
|
8
|
-
- 2.7.7
|
9
|
-
-3.0.5
|
10
|
-
before_install: gem install bundler
|
11
|
-
|
12
|
-
before_script:
|
13
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
14
|
-
- chmod +x ./cc-test-reporter
|
15
|
-
- ./cc-test-reporter before-build
|
16
|
-
script:
|
17
|
-
- COVERAGE=1 rake test
|
18
|
-
after_script:
|
19
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|