gus_bir1 1.0.0 → 1.0.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: fa75fae9eb4869e39cbd5f7ada55f9c3ef8ef0e1
4
- data.tar.gz: fc3b62c2312732c762fb33064700a38ec996f299
3
+ metadata.gz: 1dd6c529611bfd16350b95eb343a18c4f2ac8ac8
4
+ data.tar.gz: '09271b1f6eaef3ed8a1a318bf3bc2f3d01504d49'
5
5
  SHA512:
6
- metadata.gz: 5165c6fbefb4fdaaa70797cf73d571b57657689b7f327ad872c3cae0cd857bf3a6637dd73ccd358d83486c0d4be43e22d052af83abdaf046fc9fb2a47ac88e13
7
- data.tar.gz: fbd74765df4b606d123c5750f0c6b4c85b6761440e739c2894f2d3b9a625bf691c0d0c61d8ea718be13582778960150d8a4ee114a0c2e6f6594b696cb814372e
6
+ metadata.gz: 36ae1e77385e1c30e9317112170b9480edc5a1b43e5405e55089466933c567cb40557b95769a050cc3ed8b8ede4d709337d202fbdee893cc498286629aa68e3d
7
+ data.tar.gz: fc72175a4a771bcddb76b8c94b79a8dcb938d028676906b4f2a0095f0ef765206b18cbc2b90b4876da40c068897b75cca261d276dc5cc8df188c2e5e5e2597e9
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  env:
2
2
  global:
3
- - CC_TEST_REPORTER_ID=4061d1f19a14b3a8cf7a721701a4c96426861c793f1709e445256fa37bcb255f
3
+ - CC_TEST_REPORTER_ID=21904179f670d8951ec18038872b42fbd37ad057a2342c30197dfebaae2ab27e
4
4
  -
5
5
  sudo: false
6
6
  language: ruby
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Code Climate](https://codeclimate.com/github/espago/gus_bir1/badges/gpa.svg)](https://codeclimate.com/github/espago/gus_bir1)
5
5
  [![Test Coverage](https://codeclimate.com/github/espago/gus_bir1/badges/coverage.svg)](https://codeclimate.com/github/espago/gus_bir1)
6
6
 
7
- Simple, ruby wrapper for REGON database (web frontend is reachable at https://wyszukiwarkaregon.stat.gov.pl/appBIR/index.aspx). To access its SOAP API, one needs an USER_KEY issued by REGON administrators available at Regon_Bir@stat.gov.pl.
7
+ 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 an USER_KEY issued by REGON administrators available at Regon_Bir@stat.gov.pl.
8
8
  Official GUS docs http://bip.stat.gov.pl/dzialalnosc-statystyki-publicznej/rejestr-regon/interfejsyapi/jak-skorzystac-informacja-dla-podmiotow-komercyjnych/
9
9
 
10
10
 
@@ -151,7 +151,7 @@ if gus_response.first
151
151
  gus_data = gus_response.first.to_h
152
152
  prefix = gus_data.first.first.split('_').first
153
153
  company.name = gus_data["#{prefix}_nazwaSkrocona"]
154
- company.name = gus_data["#{prefix}_nazwa"] if company.name.empty?
154
+ company.name = gus_data["#{prefix}_nazwa"] if company.name.blank?
155
155
  company.address = gus_data["#{prefix}_adSiedzUlica_Nazwa"]
156
156
  company.address += " " + gus_data["#{prefix}_adSiedzNumerNieruchomosci"] if gus_data["#{prefix}_adSiedzNumerNieruchomosci"]
157
157
  company.address += "/#{gus_data["#{prefix}_adSiedzNumerLokalu"]}" if gus_data["#{prefix}_adSiedzNumerLokalu"]
data/gus_bir1.gemspec CHANGED
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'rubocop', '~> 0.52'
28
28
  spec.add_development_dependency 'simplecov', '~> 0'
29
29
 
30
- spec.add_dependency 'savon', '~> 2'
31
- spec.add_dependency 'savon-multipart', '~> 2'
30
+ spec.add_dependency 'savon', '~> 2.12'
31
+ spec.add_dependency 'savon-multipart', '~> 2.1', '>= 2.1.1'
32
32
  end
data/lib/gus_bir1.rb CHANGED
@@ -20,7 +20,7 @@ module GusBir1
20
20
  def_delegators :client, :production, :client_key, :service_status,
21
21
  :session_status, :status_date_state, :find_by, :find_and_get_full_data,
22
22
  :get_full_data
23
- def_delegators :client, :production=, :client_key=
23
+ def_delegators :client, :production=, :client_key=, :log_level=, :logging=
24
24
 
25
25
  def service_available?
26
26
  client.service_status.to_i == 1
@@ -3,7 +3,7 @@
3
3
  module GusBir1
4
4
  class Client
5
5
  SESSION_TIMEOUT = 3600
6
- attr_accessor :production, :client_key
6
+ attr_accessor :production, :client_key, :log_level, :logging
7
7
 
8
8
  def service_status
9
9
  v = get_value(Constants::PARAM_PARAM_NAME => Constants::PARAM_SERVICE_STATUS)
@@ -11,6 +11,7 @@ module GusBir1
11
11
  end
12
12
 
13
13
  def session_status
14
+ set_session_id
14
15
  v = get_value(Constants::PARAM_PARAM_NAME => Constants::PARAM_SESSION_STATUS)
15
16
  Response::Simple.new(v, Constants::PARAM_SESSION_STATUS)
16
17
  end
@@ -94,11 +95,11 @@ module GusBir1
94
95
  def call(method, message)
95
96
  case method
96
97
  when
97
- :zaloguj,
98
98
  :wyloguj,
99
99
  :dane_szukaj,
100
100
  :dane_pobierz_pelny_raport,
101
- :dane_komunikat
101
+ :dane_komunikat,
102
+ :zaloguj
102
103
  savon_client_publ.call(method, message: message)
103
104
  else
104
105
  savon_client.call(method, message: message)
@@ -137,7 +138,7 @@ module GusBir1
137
138
  end
138
139
 
139
140
  def savon_options(publ: false)
140
- {
141
+ params = {
141
142
  wsdl: Constants::WSDL_URL,
142
143
  namespaces: namespaces(publ: publ),
143
144
  endpoint: endpoint,
@@ -147,10 +148,13 @@ module GusBir1
147
148
  namespace_identifier: :ns,
148
149
  element_form_default: :qualified,
149
150
  multipart: true,
150
- log_level: :debug,
151
- log: false,
152
- headers: { sid: @sid }
151
+ log_level: @log_level,
152
+ log: @logging
153
153
  }
154
+ if defined?(@sid) && @sid.nil? == false
155
+ params.merge!({headers: { sid: @sid } })
156
+ end
157
+ params
154
158
  end
155
159
 
156
160
  def clear_savon_clients
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GusBir1
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gus_bir1
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wacław Łuczak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-15 00:00:00.000000000 Z
11
+ date: 2019-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,28 +86,34 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '2'
89
+ version: '2.12'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '2'
96
+ version: '2.12'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: savon-multipart
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '2'
103
+ version: '2.1'
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 2.1.1
104
107
  type: :runtime
105
108
  prerelease: false
106
109
  version_requirements: !ruby/object:Gem::Requirement
107
110
  requirements:
108
111
  - - "~>"
109
112
  - !ruby/object:Gem::Version
110
- version: '2'
113
+ version: '2.1'
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 2.1.1
111
117
  description:
112
118
  email:
113
119
  - waclaw@luczak.it