afipws 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +13 -0
- data/Gemfile.lock +9 -9
- data/README.md +8 -8
- data/lib/afipws/client.rb +3 -1
- data/lib/afipws/errors/error.rb +4 -0
- data/lib/afipws/errors/network_error.rb +9 -0
- data/lib/afipws/version.rb +1 -1
- data/spec/afipws/client_spec.rb +26 -4
- metadata +2 -2
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35d82abb92bacac0765fa6ff1165144285d88b6de45ffb84ae70fa99a8c5bd34
|
4
|
+
data.tar.gz: 5dfb329baf6446010559789d0afbcf24b1de9dbe8a5c7121f5b3dec932ef1d4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c3a00c50955d67e1a4c5bf53965a5b5d2b5ec305c0d4fff28beb8f54339d7d0bd2e9d17145dccdf101f1608f4a0c0420da2e75e2ab8ef8fdfaae7163d142547
|
7
|
+
data.tar.gz: e3cfc5f3648b0ab30686f6a7848557b42f332eb12e38216a7b2ee9da69cc3a2d0dfc437477b80d35e2f9b003f699ea3fdd988cbdf9dfd23f85f7c980df3fca17
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
afipws (2.
|
4
|
+
afipws (2.2.0)
|
5
5
|
activesupport
|
6
6
|
builder
|
7
7
|
httpclient
|
@@ -11,7 +11,7 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: http://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activesupport (7.0.
|
14
|
+
activesupport (7.0.4.3)
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
16
|
i18n (>= 1.6, < 2)
|
17
17
|
minitest (>= 5.1)
|
@@ -24,7 +24,7 @@ GEM
|
|
24
24
|
ast (2.4.2)
|
25
25
|
builder (3.2.4)
|
26
26
|
coderay (1.1.3)
|
27
|
-
concurrent-ruby (1.
|
27
|
+
concurrent-ruby (1.2.2)
|
28
28
|
diff-lcs (1.3)
|
29
29
|
ffi (1.15.5)
|
30
30
|
formatador (1.1.0)
|
@@ -48,7 +48,7 @@ GEM
|
|
48
48
|
httpi (2.5.0)
|
49
49
|
rack
|
50
50
|
socksify
|
51
|
-
i18n (1.
|
51
|
+
i18n (1.12.0)
|
52
52
|
concurrent-ruby (~> 1.0)
|
53
53
|
jaro_winkler (1.5.4)
|
54
54
|
listen (3.7.1)
|
@@ -56,11 +56,11 @@ GEM
|
|
56
56
|
rb-inotify (~> 0.9, >= 0.9.10)
|
57
57
|
lumberjack (1.2.8)
|
58
58
|
method_source (1.0.0)
|
59
|
-
minitest (5.
|
59
|
+
minitest (5.18.0)
|
60
60
|
mocha (0.9.10)
|
61
61
|
rake
|
62
62
|
nenv (0.3.0)
|
63
|
-
nokogiri (1.13.
|
63
|
+
nokogiri (1.13.10-arm64-darwin)
|
64
64
|
racc (~> 1.4)
|
65
65
|
nori (2.6.0)
|
66
66
|
notiffany (0.1.3)
|
@@ -73,8 +73,8 @@ GEM
|
|
73
73
|
coderay (~> 1.1)
|
74
74
|
method_source (~> 1.0)
|
75
75
|
public_suffix (4.0.6)
|
76
|
-
racc (1.6.
|
77
|
-
rack (
|
76
|
+
racc (1.6.1)
|
77
|
+
rack (3.0.7)
|
78
78
|
rainbow (3.1.1)
|
79
79
|
rake (13.0.1)
|
80
80
|
rb-fsevent (0.11.1)
|
@@ -114,7 +114,7 @@ GEM
|
|
114
114
|
shellany (0.0.1)
|
115
115
|
socksify (1.7.1)
|
116
116
|
thor (1.2.1)
|
117
|
-
tzinfo (2.0.
|
117
|
+
tzinfo (2.0.6)
|
118
118
|
concurrent-ruby (~> 1.0)
|
119
119
|
unicode-display_width (1.6.1)
|
120
120
|
wasabi (3.7.0)
|
data/README.md
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
Ruby client para los web services de la AFIP.
|
4
4
|
|
5
|
-
[![Build Status](https://
|
5
|
+
[![Build Status](https://github.com/eeng/afipws/actions/workflows/ci.yml/badge.svg)](https://github.com/eeng/afipws/actions/workflows/ci.yml)
|
6
6
|
|
7
7
|
## Servicios Disponibles
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
- wsaa (WSAA)
|
10
|
+
- wsfe (WSFE)
|
11
|
+
- ws_sr_constancia_inscripcion (WSConstanciaInscripcion)
|
12
|
+
- ws_sr_padron_a100 (PersonaServiceA100)
|
13
|
+
- ws_sr_padron_a4 (PersonaServiceA4)
|
14
|
+
- ws_sr_padron_a5 (PersonaServiceA5)
|
15
|
+
- wconsdeclaracion (WConsDeclaracion)
|
16
16
|
|
17
17
|
## Uso
|
18
18
|
|
data/lib/afipws/client.rb
CHANGED
@@ -6,8 +6,10 @@ module Afipws
|
|
6
6
|
|
7
7
|
def request action, body = nil
|
8
8
|
@savon.call action, message: body
|
9
|
-
rescue Savon::SOAPFault => e
|
9
|
+
rescue Savon::SOAPFault, Savon::HTTPError => e
|
10
10
|
raise ServerError, e
|
11
|
+
rescue HTTPClient::ConnectTimeoutError => e
|
12
|
+
raise NetworkError.new(e, retriable: true)
|
11
13
|
rescue HTTPClient::TimeoutError => e
|
12
14
|
raise NetworkError, e
|
13
15
|
end
|
data/lib/afipws/errors/error.rb
CHANGED
data/lib/afipws/version.rb
CHANGED
data/spec/afipws/client_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Afipws
|
4
4
|
describe Client do
|
5
|
-
context '
|
5
|
+
context 'errores' do
|
6
6
|
subject { Client.new(wsdl: Afipws::WSFE::WSDL[:test]) }
|
7
7
|
|
8
8
|
it 'Savon::SOAPFault se encapsulan en ServerError' do
|
@@ -10,10 +10,32 @@ module Afipws
|
|
10
10
|
-> { subject.request :fe_dummy }.should raise_error ServerError, /CMS no es valido/
|
11
11
|
end
|
12
12
|
|
13
|
-
it '
|
13
|
+
it 'Savon::HTTPError se encapsulan en ServerError' do
|
14
|
+
expect_savon_to_raise Savon::HTTPError, stub(code: 503, body: 'Service Unavailable')
|
15
|
+
-> { subject.request :fe_dummy }.should raise_error ServerError, /Service Unavailable/
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'HTTPClient::TimeoutError se encapsulan en NetworkError y no es retriable' do
|
19
|
+
expect_savon_to_raise HTTPClient::ReceiveTimeoutError, 'execution expired'
|
20
|
+
-> { subject.request :fe_dummy }.should raise_error { |error|
|
21
|
+
error.should be_a NetworkError
|
22
|
+
error.message.should match /execution expired/
|
23
|
+
error.retriable?.should be false
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'HTTPClient::ConnectTimeoutError se encapsulan en NetworkError y es retriable' do
|
28
|
+
expect_savon_to_raise HTTPClient::ConnectTimeoutError, 'execution expired'
|
29
|
+
-> { subject.request :fe_dummy }.should raise_error { |error|
|
30
|
+
error.should be_a NetworkError
|
31
|
+
error.message.should match /execution expired/
|
32
|
+
error.retriable?.should be true
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def expect_savon_to_raise error_class, message
|
14
37
|
# Hack to mock exceptions on Savon
|
15
|
-
subject.instance_eval('@savon').expects(:call).raises(
|
16
|
-
-> { subject.request :fe_dummy }.should raise_error NetworkError, /execution expired/
|
38
|
+
subject.instance_eval('@savon', __FILE__, __LINE__).expects(:call).raises(error_class, message)
|
17
39
|
end
|
18
40
|
end
|
19
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: afipws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emmanuel Nicolau
|
@@ -159,11 +159,11 @@ extensions: []
|
|
159
159
|
extra_rdoc_files: []
|
160
160
|
files:
|
161
161
|
- ".envrc"
|
162
|
+
- ".github/workflows/ci.yml"
|
162
163
|
- ".gitignore"
|
163
164
|
- ".rspec"
|
164
165
|
- ".rubocop.yml"
|
165
166
|
- ".ruby-version"
|
166
|
-
- ".travis.yml"
|
167
167
|
- CHANGELOG.md
|
168
168
|
- Gemfile
|
169
169
|
- Gemfile.lock
|