registeruz 1.1.1 → 1.2.1

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
  SHA1:
3
- metadata.gz: b56642bb9475ed82328fa370593269e00a8c2c4b
4
- data.tar.gz: 241fabf2c9c41f9bd52ed49ed6c8c947a5c2ea0b
3
+ metadata.gz: 3df47f3fafad591dc2d0aaba5533bb9f51acd829
4
+ data.tar.gz: d4b3a137ab8248755ff34999c97870006aba040b
5
5
  SHA512:
6
- metadata.gz: fa1095df1c904cca0bb27e463d6aed986b56614327f81e1da4a9398dc3049d37446a580d8659d43f87e37751660ae117a5c3ae4099cef7e0af619304d298fda7
7
- data.tar.gz: a0ea6709d4e3d1113c6e2f57bb886ca32adbbadd4801587a803b3492699b997f29301f7a831002355fcb51fe82ff6d57acbaacc1316e3d3ac4b562d150381dc6
6
+ metadata.gz: e7d0fe677511a487e33e05355506ce28d421f4c1ebbc535965e54a71faf548c3a9b15abfe4abf2bf0e16e1b4bb2ea686221b5d10e0b7d9c39277ad92b7d37b4a
7
+ data.tar.gz: dbf1cf9633a347fc707213fe2d0b9bb4deef00124c4f461fdda5bde31b2cb8c5b9643b77bf377aac6e40124b47ab031de134705c4a758b1215f76bf94c36c183
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- registeruz (1.1.0)
4
+ registeruz (1.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -34,6 +34,8 @@ You can find many many details there, I will present you with use case I did
34
34
  this for, if you are missing something, do not hesitate to contact me, will try
35
35
  to have a look shortly...
36
36
 
37
+ ### Registeruz::Subject
38
+
37
39
  You are provided with class `Registeruz::Subject` which allows you to search
38
40
  through companies by attributes listed in official docs, I will go through ICO
39
41
  lookup only here:
@@ -41,25 +43,43 @@ lookup only here:
41
43
  You can choose if you are searching and expect more items returned to use `where` (similar to rails activerecord method):
42
44
 
43
45
  ```ruby
44
- Registeruz::Subject.where(ico: 50826042)
45
-
46
- [#<Registeruz::Models::Subject:0x00007fdc7a1a57a8
46
+ > Registeruz::Subject.where(ico: 50826042)
47
+
48
+ => [#<Registeruz::Models::Subject:0x00007f8b79871098
49
+ @body=
50
+ {"skNace"=>"69200",
51
+ "konsolidovana"=>false,
52
+ "datumPoslednejUpravy"=>"2017-11-03",
53
+ "zdrojDat"=>"SUSR",
54
+ "nazovUJ"=>"UOL SK s.r.o.",
55
+ "ico"=>"50826042",
56
+ "mesto"=>"Bratislava - mestská časť Rača",
57
+ "ulica"=>"Karpatské námestie 10A",
58
+ "psc"=>"83106",
59
+ "datumZalozenia"=>"2017-04-12",
60
+ "pravnaForma"=>"112",
61
+ "velkostOrganizacie"=>"00",
62
+ "druhVlastnictva"=>"7",
63
+ "kraj"=>"1",
64
+ "okres"=>"103",
65
+ "sidlo"=>"529354",
66
+ "id"=>1689373},
47
67
  @city="Bratislava - mestská časť Rača",
48
68
  @consolidated=false,
49
69
  @data_origin="SUSR",
50
70
  @dic=nil,
51
- @district="Bratislava III",
71
+ @district_id="103",
52
72
  @founded_at=2017-04-12 00:00:00 +0200,
53
73
  @ico="50826042",
54
74
  @id=1689373,
55
- @legal_form="Spol. s r. o.",
75
+ @legal_form_id="112",
56
76
  @name="UOL SK s.r.o.",
57
- @organization_size="nezistený",
58
- @ownership_type="Zahraničné",
77
+ @organization_size_id="00",
78
+ @ownership_type_id="7",
59
79
  @postal_code="83106",
60
- @region="Bratislavský kraj",
61
- @residence="Bratislava-Rača",
62
- @sk_nace_code="Účtovnícke činnosti",
80
+ @region_id="1",
81
+ @residence_id="529354",
82
+ @sk_nace_code_id="69200",
63
83
  @street="Karpatské námestie 10A",
64
84
  @updated_at=2017-11-03 00:00:00 +0100>]
65
85
  ```
@@ -71,8 +91,53 @@ Otherwise searching by ICO seems to make more sense with usage of `find_by`
71
91
  where object of `Registeruz::Subject` is being returned like this:
72
92
 
73
93
  ```ruby
74
- Registeruz::Subject.find_by(ico: 50826042)
94
+ > Registeruz::Subject.find_by(ico: 50826042)
95
+
96
+ => #<Registeruz::Models::Subject:0x00007f8b7b0e8518
97
+ @body=
98
+ {"druhVlastnictva"=>"7",
99
+ "kraj"=>"1",
100
+ "okres"=>"103",
101
+ "sidlo"=>"529354",
102
+ "zdrojDat"=>"SUSR",
103
+ "nazovUJ"=>"UOL SK s.r.o.",
104
+ "mesto"=>"Bratislava - mestská časť Rača",
105
+ "ulica"=>"Karpatské námestie 10A",
106
+ "psc"=>"83106",
107
+ "datumPoslednejUpravy"=>"2017-11-03",
108
+ "datumZalozenia"=>"2017-04-12",
109
+ "ico"=>"50826042",
110
+ "pravnaForma"=>"112",
111
+ "velkostOrganizacie"=>"00",
112
+ "skNace"=>"69200",
113
+ "konsolidovana"=>false,
114
+ "id"=>1689373},
115
+ @city="Bratislava - mestská časť Rača",
116
+ @consolidated=false,
117
+ @data_origin="SUSR",
118
+ @dic=nil,
119
+ @district_id="103",
120
+ @founded_at=2017-04-12 00:00:00 +0200,
121
+ @ico="50826042",
122
+ @id=1689373,
123
+ @legal_form_id="112",
124
+ @name="UOL SK s.r.o.",
125
+ @organization_size_id="00",
126
+ @ownership_type_id="7",
127
+ @postal_code="83106",
128
+ @region_id="1",
129
+ @residence_id="529354",
130
+ @sk_nace_code_id="69200",
131
+ @street="Karpatské námestie 10A",
132
+ @updated_at=2017-11-03 00:00:00 +0100>
133
+ ```
75
134
 
135
+ You can see all the codebook values returned with `..._id` params, which does
136
+ not do any extra queries for codebook values, but still you have their
137
+ alternatives without ending `_id` available for use like so (they return
138
+ codebook values):
139
+
140
+ ```ruby
76
141
  #<Registeruz::Models::Subject:0x00007fdc7aa124b8
77
142
  @city="Bratislava - mestská časť Rača",
78
143
  @consolidated=false,
@@ -94,6 +159,50 @@ Registeruz::Subject.find_by(ico: 50826042)
94
159
  @updated_at=2017-11-03 00:00:00 +0100>
95
160
  ```
96
161
 
162
+ if you want to purely search by id you have ActiveRecord-like method `find` available:
163
+
164
+ ```ruby
165
+ > Registeruz::Subject.find(1689373)
166
+
167
+ => #<Registeruz::Models::Subject:0x00007fc6860e8950
168
+ @body=
169
+ {"druhVlastnictva"=>"7",
170
+ "kraj"=>"1",
171
+ "okres"=>"103",
172
+ "sidlo"=>"529354",
173
+ "zdrojDat"=>"SUSR",
174
+ "nazovUJ"=>"UOL SK s.r.o.",
175
+ "mesto"=>"Bratislava - mestská časť Rača",
176
+ "ulica"=>"Karpatské námestie 10A",
177
+ "psc"=>"83106",
178
+ "datumPoslednejUpravy"=>"2017-11-03",
179
+ "datumZalozenia"=>"2017-04-12",
180
+ "ico"=>"50826042",
181
+ "pravnaForma"=>"112",
182
+ "velkostOrganizacie"=>"00",
183
+ "skNace"=>"69200",
184
+ "konsolidovana"=>false,
185
+ "id"=>1689373},
186
+ @city="Bratislava - mestská časť Rača",
187
+ @consolidated=false,
188
+ @data_origin="SUSR",
189
+ @dic=nil,
190
+ @district_id="103",
191
+ @founded_at=2017-04-12 00:00:00 +0200,
192
+ @ico="50826042",
193
+ @id=1689373,
194
+ @legal_form_id="112",
195
+ @name="UOL SK s.r.o.",
196
+ @organization_size_id="00",
197
+ @ownership_type_id="7",
198
+ @postal_code="83106",
199
+ @region_id="1",
200
+ @residence_id="529354",
201
+ @sk_nace_code_id="69200",
202
+ @street="Karpatské námestie 10A",
203
+ @updated_at=2017-11-03 00:00:00 +0100>
204
+ ```
205
+
97
206
  The `Registeruz::Subject` that is returned has method with english names, but
98
207
  here you have SVK equivalents from official docs:
99
208
 
@@ -121,6 +230,159 @@ When there is `Číselník` mentioned it means you will not get ID representatio
121
230
  of the data but gem looks it up and gives you slovak word equivalent of the
122
231
  ID....
123
232
 
233
+
234
+ ### Registeruz::FinancialStatement
235
+
236
+ You are provided with class `Registeruz::FinancialStatement` which allows you get financial statements...
237
+ Unlike above `Registeruz::Subject` this can only use these params for search:
238
+
239
+ - `pokracovat-za-id` - continue after given id
240
+ - `max-zaznamov` - max number of records returned
241
+
242
+ to search e.x. for two records starting with id 3 (returns array of objects as
243
+ ussual...):
244
+
245
+ ```ruby
246
+ > Registeruz::FinancialStatement.where('pokracovat-za-id': 3, 'max-zaznamov': 2)
247
+
248
+ => [#<Registeruz::Models::FinancialStatement:0x00007fc68613a318
249
+ @accounting_report_ids=[7, 8],
250
+ @assembled_for_date=2009-12-31 00:00:00 +0100,
251
+ @body=
252
+ {"ico"=>"00165581",
253
+ "dic"=>"2020830152",
254
+ "nazovUJ"=>"Najvyšší súd Slovenskej republiky",
255
+ "datumPoslednejUpravy"=>"2013-08-18",
256
+ "zdrojDat"=>"JUS",
257
+ "obdobieOd"=>"2009-01",
258
+ "obdobieDo"=>"2009-12",
259
+ "typ"=>"Riadna",
260
+ "konsolidovana"=>true,
261
+ "datumZostaveniaK"=>"2009-12-31",
262
+ "idUJ"=>31355,
263
+ "idUctovnychVykazov"=>[7, 8],
264
+ "id"=>4},
265
+ @comprehensiver_finstat_of_public_admin=nil,
266
+ @consolidated=true,
267
+ @consolidated_check_of_central_gov=nil,
268
+ @data_origin="JUS",
269
+ @dic="2020830152",
270
+ ```
271
+
272
+ Then if you are looking for one in particular, you can do so by using its ID:
273
+
274
+ ```ruby
275
+ > Registeruz::FinancialStatement.find(1)
276
+
277
+ => #<Registeruz::Models::FinancialStatement:0x00007fc68610ba40
278
+ @accounting_report_ids=[1, 2],
279
+ @assembled_for_date=2009-12-31 00:00:00 +0100,
280
+ @body=
281
+ {"ico"=>"30845572",
282
+ "nazovUJ"=>"Ministerstvo obrany Slovenskej republiky",
283
+ "datumPoslednejUpravy"=>"2013-08-18",
284
+ "zdrojDat"=>"JUS",
285
+ "obdobieOd"=>"2009-01",
286
+ "obdobieDo"=>"2009-12",
287
+ "typ"=>"Riadna",
288
+ "konsolidovana"=>true,
289
+ "datumZostaveniaK"=>"2009-12-31",
290
+ "idUJ"=>442175,
291
+ "idUctovnychVykazov"=>[1, 2],
292
+ "id"=>1},
293
+ @comprehensiver_finstat_of_public_admin=nil,
294
+ @consolidated=true,
295
+ @consolidated_check_of_central_gov=nil,
296
+ @data_origin="JUS",
297
+ @dic=nil,
298
+ @fond_name=nil,
299
+ @ico="30845572",
300
+ @id=1,
301
+ @lei_code=nil,
302
+ @period_from=2009-01-01 00:00:00 +0100,
303
+ @period_to=2009-12-01 00:00:00 +0100,
304
+ @subject_id=442175,
305
+ @subject_name="Ministerstvo obrany Slovenskej republiky",
306
+ @type="Riadna",
307
+ @updated_at=2013-08-18 00:00:00 +0200>
308
+ ```
309
+
310
+ Subject is part of the response, referenced by id there (`subject_id`) and you
311
+ can get its value by calling method without `_id` like so:
312
+
313
+ ```ruby
314
+ > finstat = Registeruz::FinancialStatement.find(1)
315
+ > finstat.subject
316
+
317
+ => #<Registeruz::Models::Subject:0x00007fc6829ce898
318
+ @body=
319
+ {"datumPoslednejUpravy"=>"2017-11-30",
320
+ "zdrojDat"=>"SUSR",
321
+ "nazovUJ"=>"Ministerstvo obrany Slovenskej republiky",
322
+ "ico"=>"30845572",
323
+ "mesto"=>"Bratislava - mestská časť Nové Mesto",
324
+ "ulica"=>"Kutuzovova 8",
325
+ "psc"=>"83247",
326
+ "datumZalozenia"=>"1993-01-01",
327
+ "pravnaForma"=>"321",
328
+ "velkostOrganizacie"=>"36",
329
+ "druhVlastnictva"=>"4",
330
+ "kraj"=>"1",
331
+ "okres"=>"103",
332
+ "sidlo"=>"529346",
333
+ "idVyrocnychSprav"=>[2208382, 2619266, 3020165, 3411566],
334
+ "idUctovnychZavierok"=>[1, 613, 557005, 558698, 698433, 697701, 1784783, 1742215, 2082509, 2208380, 2450565, 2619265, 2884031, 3019938, 3279774, 3276049, 3411565],
335
+ "skNace"=>"84220",
336
+ "konsolidovana"=>true,
337
+ "id"=>442175},
338
+ @city="Bratislava - mestská časť Nové Mesto",
339
+ @consolidated=true,
340
+ @data_origin="SUSR",
341
+ @dic=nil,
342
+ @district_id="103",
343
+ @founded_at=1993-01-01 00:00:00 +0100,
344
+ @ico="30845572",
345
+ @id=442175,
346
+ @legal_form_id="321",
347
+ @name="Ministerstvo obrany Slovenskej republiky",
348
+ @organization_size_id="36",
349
+ @ownership_type_id="4",
350
+ @postal_code="83247",
351
+ @region_id="1",
352
+ @residence_id="529346",
353
+ @sk_nace_code_id="84220",
354
+ @street="Kutuzovova 8",
355
+ @updated_at=2017-11-30 00:00:00 +0100>
356
+ ```
357
+
358
+ `Registeruz::FinancialStatement` object as is represented by enlish attributes
359
+ is meant to represent these:
360
+
361
+ - `id` - identifikátor účtovnej závierky, maximálne desaťciferné celé číslo
362
+ - `period_from` - účtovná závierka za obdobie - od, formát RRRR-MM
363
+ - `period_to` - účtovná závierka za obdobie - do, formát RRRR-MM
364
+ - `submitted_at` - dátum podania účtovnej závierky (napr. evidencia na FRSR), formát RRRR-MM-DD
365
+ - `assembled_at` - dátum, kedy bola závierka zostavená, formát RRRR-MM-DD
366
+ - `approved_at` - dátum, kedy bola závierka schválená, formát RRRR-MM-DD
367
+ - `assembled_for_date` - dátum, ku ktorému bola závierka zostavená, formát RRRR-MM-DD
368
+ - `auditor_report_added_at` - dátum priloženia správy audítora, formát RRRR-MM-DD
369
+ - `subject_name` - názov účtovnej jednotky v čase podania závierky, textový reťazec s maximálnou dĺžkou 500 znakov
370
+ - `ico` - IČO účtovnej jednotky v čase podania závierky, osemznakový textový reťazec
371
+ - `dic` - DIČ účtovnej jednotky v čase podania závierky, desaťznakový textový reťazec
372
+ - `fond_name` - názov fondu, za ktorý bola závierka predložená (v prípade že sa jedná o účtovnú závierku fondu), textový reťazec s maximálnou dĺžkou 500 znakov
373
+ - `lei_code` - LEI kód, pod ktorým bola závierka predložená, textový reťazec s dĺžkou 20 znakov
374
+ - `subject_id` - identifikátor účtovnej jednotky, maximálne desaťciferné celé číslo
375
+ - `consolidated` - boolean príznak - true, ak ide o konsolidovanú závierku
376
+ - `consolidated_check_of_central_gov` - boolean príznak - true, ak ide o konsolidovanú závierku ústrednej štátnej správy
377
+ - `comprehensiver_finstat_of_public_admin` - boolean príznak - true, ak ide o súhrnnú účtovnú závierku verejnej správy
378
+ - `type` - "Riadna", "Mimoriadna", "Priebežná" alebo "Kombinovaná" (riadna aj mimoriadna)
379
+ - `accounting_report_ids` - zoznam identifikátorov všetkých súvisiacich účtovných výkazov, identifikátor je maximálne desaťciferné celé číslo
380
+ - `data_origin` - kód zdroja, z ktorého pochádzajú dáta (viď Zdroje dát), textový reťazec s maximálnou dĺžkou 30 znakov
381
+ - `updated_at` - dátum poslednej úpravy, formát RRRR-MM-DD
382
+
383
+
384
+ ### Registeruz::Api::Codebook
385
+
124
386
  Otherwise you can search yourself through codebooks like this:
125
387
 
126
388
  ```ruby
@@ -4,15 +4,21 @@ require 'time'
4
4
 
5
5
  require 'registeruz/version'
6
6
  require 'registeruz/subject'
7
+ require 'registeruz/financial_statement'
7
8
  require 'registeruz/errors'
8
9
 
10
+ require 'registeruz/api/base_where'
11
+ require 'registeruz/api/base_find'
12
+ require 'registeruz/api/subject/where'
13
+ require 'registeruz/api/subject/find'
14
+ require 'registeruz/api/financial_statement/where'
15
+ require 'registeruz/api/financial_statement/find'
9
16
  require 'registeruz/api/request'
10
- require 'registeruz/api/where'
11
- require 'registeruz/api/find'
12
17
  require 'registeruz/api/codebook'
13
18
 
14
19
  require 'registeruz/models/collection'
15
20
  require 'registeruz/models/subject'
21
+ require 'registeruz/models/financial_statement'
16
22
 
17
23
  module Registeruz
18
24
  class << self
@@ -0,0 +1,33 @@
1
+ module Registeruz
2
+ module Api
3
+ class BaseFind
4
+ THIRD = 2
5
+
6
+ def initialize(id)
7
+ @id = id
8
+ end
9
+
10
+ def self.find(id)
11
+ new(id).find
12
+ end
13
+
14
+ def find
15
+ response = Request.get(endpoint, id: @id)
16
+ body = JSON.parse(response.body)
17
+ model_class.new(body)
18
+ end
19
+
20
+ def namespace_name
21
+ self.class.to_s.split('::')[THIRD]
22
+ end
23
+
24
+ def endpoint
25
+ raise NotImplementedError
26
+ end
27
+
28
+ def model_class
29
+ Object.const_get("::Registeruz::Models::#{namespace_name}")
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,29 @@
1
+ module Registeruz
2
+ module Api
3
+ class BaseWhere
4
+ THIRD = 2
5
+
6
+ def initialize(params)
7
+ @params = params.merge('zmenene-od': '1993-01-01')
8
+ end
9
+
10
+ def self.where(params)
11
+ new(params).where
12
+ end
13
+
14
+ def where
15
+ response = Request.get(endpoint, @params)
16
+ body = JSON.parse(response.body)
17
+ ::Registeruz::Models::Collection.new(body, namespace_name)
18
+ end
19
+
20
+ def endpoint
21
+ raise NotImplementedError
22
+ end
23
+
24
+ def namespace_name
25
+ self.class.to_s.split('::')[THIRD]
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,11 @@
1
+ module Registeruz
2
+ module Api
3
+ module FinancialStatement
4
+ class Find < BaseFind
5
+ def endpoint
6
+ 'uctovna-zavierka'
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Registeruz
2
+ module Api
3
+ module FinancialStatement
4
+ class Where < BaseWhere
5
+ def endpoint
6
+ 'uctovne-zavierky'
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Registeruz
2
+ module Api
3
+ module Subject
4
+ class Find < BaseFind
5
+ def endpoint
6
+ 'uctovna-jednotka'
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Registeruz
2
+ module Api
3
+ module Subject
4
+ class Where < BaseWhere
5
+ def endpoint
6
+ 'uctovne-jednotky'
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ module Registeruz
2
+ class FinancialStatement
3
+ class << self
4
+ def where(options)
5
+ ::Registeruz::Api::FinancialStatement::Where.where(options).items
6
+ end
7
+
8
+ def find(id)
9
+ ::Registeruz::Api::FinancialStatement::Find.find(id)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -3,9 +3,10 @@ module Registeruz
3
3
  class Collection
4
4
  attr_accessor :items
5
5
 
6
- def initialize(body)
6
+ def initialize(body, namespace_name)
7
7
  raise NotFound unless body['id']&.any?
8
8
  @ids = body['id']
9
+ @namespace_name = namespace_name
9
10
  load_all_subjects
10
11
  end
11
12
 
@@ -13,9 +14,13 @@ module Registeruz
13
14
 
14
15
  def load_all_subjects
15
16
  @items = @ids.map do |id|
16
- ::Registeruz::Api::Find.find(id)
17
+ finder_class.find(id)
17
18
  end
18
19
  end
20
+
21
+ def finder_class
22
+ Object.const_get("::Registeruz::Api::#{@namespace_name}::Find")
23
+ end
19
24
  end
20
25
  end
21
26
  end
@@ -0,0 +1,60 @@
1
+ module Registeruz
2
+ module Models
3
+ class FinancialStatement
4
+ attr_accessor :id, :body, :period_from, :period_to, :submitted_at,
5
+ :assembled_at, :approved_at, :assembled_for_date,
6
+ :auditor_report_added_at, :subject_name, :ico, :dic,
7
+ :fond_name, :lei_code, :subject_id, :consolidated,
8
+ :consolidated_check_of_central_gov,
9
+ :comprehensiver_finstat_of_public_admin,
10
+ :type, :accounting_report_ids, :data_origin, :updated_at
11
+
12
+ # rubocop:disable Metrics/AbcSize
13
+ # rubocop:disable Metrics/MethodLength
14
+ # rubocop:disable Metrics/CyclomaticComplexity
15
+ # rubocop:disable Metrics/PerceivedComplexity
16
+ def initialize(body)
17
+ @body = body
18
+ @id = body['id']
19
+ @period_from = Time.parse "#{body['obdobieOd']}-01" if body['obdobieOd']
20
+ @period_to = Time.parse "#{body['obdobieDo']}-01" if body['obdobieDo']
21
+ @submitted_at = Time.parse body['datumPodania'] if body['datumPodania']
22
+ @assembled_at = Time.parse body['datumZostavenia'] if body['datumZostavenia']
23
+ @approved_at = Time.parse body['datumSchvalenia'] if body['datumSchvalenia']
24
+ if body['datumZostaveniaK']
25
+ @assembled_for_date = Time.parse body['datumZostaveniaK']
26
+ end
27
+ if body['datumPrilozeniaSpravyAuditora']
28
+ @auditor_report_added_at = Time.parse body['datumPrilozeniaSpravyAuditora']
29
+ end
30
+ @subject_name = body['nazovUJ']
31
+ @ico = body['ico']
32
+ @dic = body['dic']
33
+ @fond_name = body['nazovFondu']
34
+ @lei_code = body['leiKod']
35
+ @subject_id = body['idUJ']
36
+ @consolidated = body['konsolidovana']
37
+ @consolidated_check_of_central_gov =
38
+ body['konsolidovanaZavierkaUstrednejStatnejSpravy']
39
+ @comprehensiver_finstat_of_public_admin =
40
+ body['suhrnnaUctovnaZavierkaVerejnejSpravy']
41
+ @type = body['typ']
42
+ @accounting_report_ids = body['idUctovnychVykazov']
43
+ @data_origin = body['zdrojDat']
44
+ # rubocop:disable Style/GuardClause
45
+ if body['datumPoslednejUpravy']
46
+ @updated_at = Time.parse body['datumPoslednejUpravy']
47
+ end
48
+ # rubocop:enable Style/GuardClause
49
+ end
50
+ # rubocop:enable Metrics/PerceivedComplexity
51
+ # rubocop:enable Metrics/CyclomaticComplexity
52
+ # rubocop:enable Metrics/MethodLength
53
+ # rubocop:enable Metrics/AbcSize
54
+
55
+ def subject
56
+ ::Registeruz::Subject.find(@subject_id)
57
+ end
58
+ end
59
+ end
60
+ end
@@ -25,7 +25,9 @@ module Registeruz
25
25
  @district_id = body['okres']
26
26
  @residence_id = body['sidlo']
27
27
  @data_origin = body['zdrojDat']
28
- @updated_at = Time.parse body['datumPoslednejUpravy'] if body['datumPoslednejUpravy']
28
+ if body['datumPoslednejUpravy']
29
+ @updated_at = Time.parse body['datumPoslednejUpravy']
30
+ end
29
31
  @ico = body['ico']
30
32
  @dic = body['dic']
31
33
  @sk_nace_code_id = body['skNace']
@@ -2,12 +2,16 @@ module Registeruz
2
2
  class Subject
3
3
  class << self
4
4
  def where(options)
5
- ::Registeruz::Api::Where.where(options).items
5
+ ::Registeruz::Api::Subject::Where.where(options).items
6
6
  end
7
7
 
8
8
  def find_by(options)
9
9
  where(options).first
10
10
  end
11
+
12
+ def find(id)
13
+ ::Registeruz::Api::Subject::Find.find(id)
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -1,3 +1,3 @@
1
1
  module Registeruz
2
- VERSION = '1.1.1'.freeze
2
+ VERSION = '1.2.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: registeruz
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrej Antas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-26 00:00:00.000000000 Z
11
+ date: 2018-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -160,12 +160,18 @@ files:
160
160
  - bin/console
161
161
  - bin/setup
162
162
  - lib/registeruz.rb
163
+ - lib/registeruz/api/base_find.rb
164
+ - lib/registeruz/api/base_where.rb
163
165
  - lib/registeruz/api/codebook.rb
164
- - lib/registeruz/api/find.rb
166
+ - lib/registeruz/api/financial_statement/find.rb
167
+ - lib/registeruz/api/financial_statement/where.rb
165
168
  - lib/registeruz/api/request.rb
166
- - lib/registeruz/api/where.rb
169
+ - lib/registeruz/api/subject/find.rb
170
+ - lib/registeruz/api/subject/where.rb
167
171
  - lib/registeruz/errors.rb
172
+ - lib/registeruz/financial_statement.rb
168
173
  - lib/registeruz/models/collection.rb
174
+ - lib/registeruz/models/financial_statement.rb
169
175
  - lib/registeruz/models/subject.rb
170
176
  - lib/registeruz/subject.rb
171
177
  - lib/registeruz/version.rb
@@ -1,19 +0,0 @@
1
- module Registeruz
2
- module Api
3
- class Find
4
- def initialize(id)
5
- @id = id
6
- end
7
-
8
- def self.find(id)
9
- new(id).find
10
- end
11
-
12
- def find
13
- response = Request.get('uctovna-jednotka', id: @id)
14
- body = JSON.parse(response.body)
15
- ::Registeruz::Models::Subject.new(body)
16
- end
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- module Registeruz
2
- module Api
3
- class Where
4
- def initialize(params)
5
- @params = params.merge('zmenene-od': '1993-01-01')
6
- end
7
-
8
- def self.where(params)
9
- new(params).where
10
- end
11
-
12
- def where
13
- response = Request.get('uctovne-jednotky', @params)
14
- body = JSON.parse(response.body)
15
- ::Registeruz::Models::Collection.new(body)
16
- end
17
- end
18
- end
19
- end