teryt 0.1.2 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 955c36441e30f9e96f3e8e129ffd46b413b44d0ead344c61dfed5ac3109b9da4
4
- data.tar.gz: c2286e6bc9b6673d98dd8f5821db55fdbf17fe88a3e8821a0d634ddb5819e84c
3
+ metadata.gz: 1010f8ce2c0d3ba0903ad4ec54ac592d7b0c6fc0ec8836333313692b0c139b0b
4
+ data.tar.gz: 45d650ae351962047f575e777017529ca48ad5a52af8d332ea581fb8d5041668
5
5
  SHA512:
6
- metadata.gz: 5623164af004403ceea304bdc4f516fbaf406366fbd73ce55b781b5c565b5c8d79086f6c2ed48f9ec967b390862100196c8b93c7df8dfd52d196bdb14548e7bb
7
- data.tar.gz: 4c46ee78b79abb000f6d983fd916715d97ae48b99f2e2b0e19a95caf0e3ada75ec87a14761d53a2bc62a47641c495e44eb7f46badb9250a3ea023016f2f362e9
6
+ metadata.gz: d3010817533bfd61bf87db963378c5f3d2e44b79fba58e0af36d7b75bc1f0991c6846cdc5c4b007db557907165d49528212e50b4ccfac761a0b69197603b4b06
7
+ data.tar.gz: 723fa60451bdb6993e9c8fdbc197c3162d6e8519cb428ef323e7ad6805d2af4ca3a10165a25ab97c875e4700b2cbe34e2c948ea23eab9d23f43efdfd43128b83
data/lib/teryt/client.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'zip'
2
+
1
3
  module Teryt
2
4
  class Client
3
5
  attr_reader :savon_client
@@ -49,5 +51,27 @@ module Teryt
49
51
  .to_hash
50
52
  .dig(:pobierz_slownik_rodzajow_jednostek_response, :pobierz_slownik_rodzajow_jednostek_result, :string)
51
53
  end
54
+
55
+ def pobierz_liste_miejscowosci_w_rodzaju_gminy(symbol_woj:, symbol_pow:, symbol_gmi:, symbol_rodz:, data_stanu: Date.today)
56
+ savon_client
57
+ .call(:pobierz_liste_miejscowosci_w_rodzaju_gminy, message: { "tns:symbolWoj" => symbol_woj,
58
+ "tns:symbolPow" => symbol_pow,
59
+ "tns:symbolGmi" => symbol_gmi,
60
+ "tns:symbolRodz" => symbol_rodz,
61
+ "tns:DataStanu" => data_stanu })
62
+ .to_hash
63
+ .dig(:pobierz_liste_miejscowosci_w_rodzaju_gminy_response, :pobierz_liste_miejscowosci_w_rodzaju_gminy_result, :miejscowosc)
64
+ .then { |result| Array.wrap(result) }
65
+ .map { |attrs| Miejscowosc.new(**attrs) }
66
+ end
67
+
68
+ def pobierz_zmiany_ulic_urzedowy(stanod:, stando: Date.today)
69
+ savon_client
70
+ .call(:pobierz_zmiany_ulic_urzedowy, message: { "tns:stanod" => stanod, "tns:stando" => stando })
71
+ .to_hash
72
+ .dig(:pobierz_zmiany_ulic_urzedowy_response, :pobierz_zmiany_ulic_urzedowy_result, :plik_zawartosc)
73
+ .then { |file_content| StringIO.new(Base64.decode64(file_content)) }
74
+ .then { |io| Zip::InputStream.new(io).get_next_entry.get_input_stream.read }
75
+ end
52
76
  end
53
77
  end
@@ -0,0 +1,17 @@
1
+ module Teryt
2
+ class Miejscowosc
3
+ attr_reader :nazwa, :symbol, :wojewodztwo, :woj_symbol, :powiat, :pow_symbol, :gmina, :gmi_symbol, :gmi_rodzaj
4
+
5
+ def initialize(nazwa:, symbol:, wojewodztwo:, woj_symbol:, powiat:, pow_symbol:, gmina:, gmi_symbol:, gmi_rodzaj:)
6
+ @nazwa = nazwa
7
+ @symbol = symbol
8
+ @wojewodztwo = wojewodztwo
9
+ @woj_symbol = woj_symbol
10
+ @powiat = powiat
11
+ @pow_symbol = pow_symbol
12
+ @gmina = gmina
13
+ @gmi_symbol = gmi_symbol
14
+ @gmi_rodzaj = gmi_rodzaj
15
+ end
16
+ end
17
+ end
data/lib/teryt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Teryt
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/teryt.rb CHANGED
@@ -4,6 +4,7 @@ require "savon"
4
4
  require_relative "teryt/version"
5
5
  require_relative "teryt/client"
6
6
  require_relative "teryt/jednostka_terytorialna"
7
+ require_relative "teryt/miejscowosc"
7
8
 
8
9
  module Teryt
9
10
  WSDL = "https://uslugaterytws1.stat.gov.pl/wsdl/terytws1.wsdl"
data/teryt.gemspec CHANGED
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
- # Uncomment to register a new dependency of your gem
34
33
  spec.add_dependency "savon", "~> 2.13.0"
34
+ spec.add_dependency "rubyzip", "~> 2.3.2"
35
35
 
36
36
  # For more information and examples about making a new gem, check out our
37
37
  # guide at: https://bundler.io/guides/creating_gem.html
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teryt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Doliwa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-15 00:00:00.000000000 Z
11
+ date: 2023-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 2.13.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubyzip
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.3.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.3.2
27
41
  description:
28
42
  email:
29
43
  - mdoliwa@gmail.com
@@ -39,9 +53,9 @@ files:
39
53
  - lib/teryt.rb
40
54
  - lib/teryt/client.rb
41
55
  - lib/teryt/jednostka_terytorialna.rb
56
+ - lib/teryt/miejscowosc.rb
42
57
  - lib/teryt/version.rb
43
58
  - sig/teryt.rbs
44
- - teryt-0.1.0.gem
45
59
  - teryt.gemspec
46
60
  homepage: https://github.com/mdoliwa/teryt
47
61
  licenses:
data/teryt-0.1.0.gem DELETED
Binary file