vat_payer_cz 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vat_info/query.rb +12 -4
- data/lib/vat_info/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d57e420c66d207f6f0e161655d2b31f6aff236e
|
4
|
+
data.tar.gz: d2216b9183c903bab7deb0b5a68f95ccf032ea9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d135b33db2365972b85e730f8477e15ed8f125ec8e8b1562668714ef776dd4c9fb82d24fa4b8e8b3d8a7d65d09560a9662ea6c7c43ccbdb40c147bf2bc3a8ec
|
7
|
+
data.tar.gz: a261dbf1213afb8ced159c571afe36962d26908e50fdd1696229728eab50d8a47ba82faf7e4670ccf3fa31f7f6032cb8a2fa5c02c9b6dc64127bf98b2981a91d
|
data/lib/vat_info/query.rb
CHANGED
@@ -4,9 +4,11 @@ module VatInfo
|
|
4
4
|
class SchemaError < StandardError; end
|
5
5
|
|
6
6
|
class Query
|
7
|
-
DOCS = 'https://adisspr.mfcr.cz/adistc/adis/idpr_pub/dpr_info/ws_spdph.faces'
|
7
|
+
DOCS = 'https://adisspr.mfcr.cz/adistc/adis/idpr_pub/dpr_info/ws_spdph.faces'.freeze
|
8
8
|
WSDL = 'http://adisrws.mfcr.cz/adistc/axis2/services/rozhraniCRPDPH.rozhraniCRPDPHSOAP?wsdl'.freeze
|
9
|
-
TIMEOUT
|
9
|
+
TIMEOUT = 2
|
10
|
+
SERVICE_UNAVAILABLE = 503
|
11
|
+
REQUEST_TIME_OUT = 408
|
10
12
|
|
11
13
|
def self.call(request, endpoint, wsdl = WSDL, timeout = TIMEOUT)
|
12
14
|
client = Savon.client(wsdl: wsdl, open_timeout: timeout)
|
@@ -16,10 +18,16 @@ module VatInfo
|
|
16
18
|
if response.success?
|
17
19
|
VatInfo::Response.new(status_code: 200, raw: response.body)
|
18
20
|
else
|
19
|
-
VatInfo::Response.new(status_code:
|
21
|
+
VatInfo::Response.new(status_code: SERVICE_UNAVAILABLE)
|
22
|
+
end
|
23
|
+
rescue Savon::HTTPError => e
|
24
|
+
if e.to_s.include?('sorry-page.html')
|
25
|
+
VatInfo::Response.new(status_code: SERVICE_UNAVAILABLE)
|
26
|
+
else
|
27
|
+
raise e
|
20
28
|
end
|
21
29
|
rescue Net::OpenTimeout
|
22
|
-
VatInfo::Response.new(status_code:
|
30
|
+
VatInfo::Response.new(status_code: REQUEST_TIME_OUT)
|
23
31
|
rescue Savon::SOAPFault => e
|
24
32
|
raise SchemaError, 'The SOAP schema of VAT service may have changed. Go to '\
|
25
33
|
"#{DOCS} to verify. Original error: #{e}"
|
data/lib/vat_info/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vat_payer_cz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Landovsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|