@@ -11,7 +11,7 @@ module ActsSubmission
1111 class BusinessActs
1212 def search_business ( query )
1313 return [ ] unless query . present?
14- res = client . get ( '/orsr.webapiforms/search' , s : query )
14+ res = client . get ( 'https://orsr.sk /orsr.webapiforms/search' , s : query )
1515
1616 if res . success?
1717 json = aspx_to_json ( res . body )
@@ -23,15 +23,15 @@ def search_business(query)
2323 end
2424
2525 def search_acts ( business )
26- if !business || business . oddiel . blank? || business . sud . blank? || business . vlozka . blank?
26+ if !business || business . oddiel . blank? || business . vlozka . blank? || business . name . blank?
2727 return [ ]
2828 end
2929
3030 res = client . get (
31- '/ orsr.webapiforms/search/listina ' ,
32- oddiel : business . oddiel ,
33- vlozka : business . vlozka ,
34- sud : business . sud ,
31+ 'https://sluzby. orsr.sk/lookup/documents ' ,
32+ section : business . oddiel ,
33+ insertNumber : business . vlozka ,
34+ courtCode : business . name . last ( 2 ) . first ,
3535 )
3636 if res . success?
3737 Act . array_from_json ( res . body )
@@ -45,7 +45,7 @@ def perform
4545 end
4646
4747 def client
48- Faraday . new ( 'https://orsr.sk' ) do |faraday |
48+ Faraday . new do |faraday |
4949 faraday . request :json
5050 faraday . response :json
5151 faraday . response ( :logger , Rails . logger , headers : false , bodies : false )
@@ -82,19 +82,19 @@ class Act
8282 attr_accessor ( :raw , :name , :formatted_name , :type , :delivery_date , :serial_number , :page_count , :make_copy , :json_value )
8383
8484 def self . array_from_json ( json )
85- json [ 'data' ] . map do |act |
85+ json . map do |act |
8686 new (
87- name : act [ 'name ' ] ,
87+ name : act [ 'nazovListiny ' ] ,
8888 formatted_name : act [ 'formattedName' ] ,
8989 type : act [ 'type' ] ,
90- delivery_date : act [ 'deliveryDate ' ] ,
90+ delivery_date : act [ 'datumDorucenia ' ] ,
9191 serial_number : act [ 'serialNumber' ] ,
92- page_count : act [ 'page_count ' ] ,
92+ page_count : act [ 'pageCount ' ] ,
9393 raw : act ,
9494 make_copy : false ,
9595 json_value : {
9696 "id" => act [ 'serialNumber' ] ,
97- "name" => act [ 'name ' ] ,
97+ "name" => act [ 'nazovListiny ' ] ,
9898 "code" => act [ 'serialNumber' ] ,
9999 "make_copy" => true
100100 } . to_json
0 commit comments