afipws 2.0.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a50ec977b4eb2da94edd06703a11d9ee46b6cfd847de01160a1527871712158e
4
- data.tar.gz: 3c0aa5ab031957e66b2afea67af73ea1cd91026f67cfea9353877c1b43186dc2
3
+ metadata.gz: 35d82abb92bacac0765fa6ff1165144285d88b6de45ffb84ae70fa99a8c5bd34
4
+ data.tar.gz: 5dfb329baf6446010559789d0afbcf24b1de9dbe8a5c7121f5b3dec932ef1d4e
5
5
  SHA512:
6
- metadata.gz: 471e56e9c6ceab26acc42b4c2997c2ab9f611ad89bee70400ce5a5d68bc83dc3e89e348af5ce98e727bc6c2363af8936fbcd238f8d1f00942cae3a8a754dae02
7
- data.tar.gz: d503f3f2df71fc503ddb10bf80985014da6cb03cabc77c5a8a98b4203269e5225c011f66fb125d248e785cb5c3b5b133b32ae8bd2b8c471b1946c8fc1f7dc1ad
6
+ metadata.gz: 9c3a00c50955d67e1a4c5bf53965a5b5d2b5ec305c0d4fff28beb8f54339d7d0bd2e9d17145dccdf101f1608f4a0c0420da2e75e2ab8ef8fdfaae7163d142547
7
+ data.tar.gz: e3cfc5f3648b0ab30686f6a7848557b42f332eb12e38216a7b2ee9da69cc3a2d0dfc437477b80d35e2f9b003f699ea3fdd988cbdf9dfd23f85f7c980df3fca17
data/.envrc ADDED
@@ -0,0 +1,2 @@
1
+ layout ruby
2
+ use nix
@@ -0,0 +1,13 @@
1
+ name: CI
2
+ on: push
3
+ jobs:
4
+ test:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: actions/checkout@v3
8
+ - name: Set up Ruby
9
+ uses: ruby/setup-ruby@v1
10
+ - name: Install dependencies
11
+ run: bundle install
12
+ - name: Run tests
13
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ spec/manual/*.key
5
5
  spec/manual/*.crt
6
6
  .DS_Store
7
7
  tmp
8
+ /.direnv
data/.rubocop.yml CHANGED
@@ -46,9 +46,6 @@ Style/Next:
46
46
  Style/NumericPredicate:
47
47
  Enabled: false
48
48
 
49
- Style/NumericLiterals:
50
- Enabled: false
51
-
52
49
  Style/SymbolArray:
53
50
  Enabled: false
54
51
 
@@ -58,19 +55,31 @@ Style/MutableConstant:
58
55
  Style/RescueModifier:
59
56
  Enabled: false
60
57
 
58
+ Style/HashEachMethods:
59
+ Enabled: false
60
+
61
+ Style/HashTransformKeys:
62
+ Enabled: false
63
+
64
+ Style/HashTransformValues:
65
+ Enabled: false
66
+
67
+ Layout/LineLength:
68
+ Max: 120
69
+
61
70
  Layout/SpaceInsideHashLiteralBraces:
62
71
  Enabled: false
63
72
 
64
73
  Layout/MultilineMethodCallIndentation:
65
74
  Enabled: false
66
75
 
67
- Layout/TrailingBlankLines:
76
+ Layout/TrailingEmptyLines:
68
77
  Enabled: false
69
78
 
70
- Layout/IndentArray:
79
+ Layout/FirstArrayElementIndentation:
71
80
  EnforcedStyle: consistent
72
81
 
73
- Layout/AlignParameters:
82
+ Layout/ParameterAlignment:
74
83
  EnforcedStyle: with_fixed_indentation
75
84
 
76
85
  Layout/SpaceInLambdaLiteral:
@@ -82,10 +91,6 @@ Metrics:
82
91
  Bundler:
83
92
  Enabled: false
84
93
 
85
- Lint/Void:
86
- Exclude:
87
- - spec/**/*.rb
88
-
89
94
  Lint/AssignmentInCondition:
90
95
  Enabled: false
91
96
 
@@ -101,5 +106,5 @@ Lint/AmbiguousOperator:
101
106
  Lint/AmbiguousBlockAssociation:
102
107
  Enabled: false
103
108
 
104
- Naming/UncommunicativeMethodParamName:
109
+ Naming/MethodParameterName:
105
110
  Enabled: false
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.0
1
+ 2.7.5
@@ -13,4 +13,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
13
13
 
14
14
  ### Changed
15
15
 
16
- - Rename Afipws::WSError to Afipws::Error, and create subclasses to distinguish between different types of errors.
16
+ - Rename `Afipws::WSError` to `Afipws::Error`, and create subclasses to distinguish between different types of errors.
data/Gemfile.lock CHANGED
@@ -1,42 +1,40 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- afipws (2.0.0)
4
+ afipws (2.2.0)
5
5
  activesupport
6
6
  builder
7
7
  httpclient
8
8
  nokogiri
9
- savon (~> 2.11.0)
9
+ savon (~> 2.12.0)
10
10
 
11
11
  GEM
12
12
  remote: http://rubygems.org/
13
13
  specs:
14
- activesupport (6.0.3.2)
14
+ activesupport (7.0.4.3)
15
15
  concurrent-ruby (~> 1.0, >= 1.0.2)
16
- i18n (>= 0.7, < 2)
17
- minitest (~> 5.1)
18
- tzinfo (~> 1.1)
19
- zeitwerk (~> 2.2, >= 2.2.2)
20
- addressable (2.7.0)
16
+ i18n (>= 1.6, < 2)
17
+ minitest (>= 5.1)
18
+ tzinfo (~> 2.0)
19
+ addressable (2.8.0)
21
20
  public_suffix (>= 2.0.2, < 5.0)
22
21
  akami (1.3.1)
23
22
  gyoku (>= 0.4.0)
24
23
  nokogiri
25
- ast (2.4.0)
24
+ ast (2.4.2)
26
25
  builder (3.2.4)
27
- byebug (11.0.1)
28
- coderay (1.1.2)
29
- concurrent-ruby (1.1.7)
26
+ coderay (1.1.3)
27
+ concurrent-ruby (1.2.2)
30
28
  diff-lcs (1.3)
31
- ffi (1.9.25)
32
- formatador (0.2.5)
33
- guard (2.14.2)
29
+ ffi (1.15.5)
30
+ formatador (1.1.0)
31
+ guard (2.18.0)
34
32
  formatador (>= 0.2.4)
35
33
  listen (>= 2.7, < 4.0)
36
34
  lumberjack (>= 1.0.12, < 2.0)
37
35
  nenv (~> 0.1)
38
36
  notiffany (~> 0.0)
39
- pry (>= 0.9.12)
37
+ pry (>= 0.13.0)
40
38
  shellany (~> 0.0)
41
39
  thor (>= 0.18.1)
42
40
  guard-compat (1.2.1)
@@ -47,46 +45,42 @@ GEM
47
45
  gyoku (1.3.1)
48
46
  builder (>= 2.1.2)
49
47
  httpclient (2.8.3)
50
- httpi (2.4.5)
48
+ httpi (2.5.0)
51
49
  rack
52
50
  socksify
53
- i18n (1.8.5)
51
+ i18n (1.12.0)
54
52
  concurrent-ruby (~> 1.0)
55
- jaro_winkler (1.5.1)
56
- listen (3.1.5)
57
- rb-fsevent (~> 0.9, >= 0.9.4)
58
- rb-inotify (~> 0.9, >= 0.9.7)
59
- ruby_dep (~> 1.2)
60
- lumberjack (1.0.13)
61
- method_source (0.9.0)
62
- mini_portile2 (2.4.0)
63
- minitest (5.14.2)
53
+ jaro_winkler (1.5.4)
54
+ listen (3.7.1)
55
+ rb-fsevent (~> 0.10, >= 0.10.3)
56
+ rb-inotify (~> 0.9, >= 0.9.10)
57
+ lumberjack (1.2.8)
58
+ method_source (1.0.0)
59
+ minitest (5.18.0)
64
60
  mocha (0.9.10)
65
61
  rake
66
62
  nenv (0.3.0)
67
- nokogiri (1.10.10)
68
- mini_portile2 (~> 2.4.0)
63
+ nokogiri (1.13.10-arm64-darwin)
64
+ racc (~> 1.4)
69
65
  nori (2.6.0)
70
- notiffany (0.1.1)
66
+ notiffany (0.1.3)
71
67
  nenv (~> 0.1)
72
68
  shellany (~> 0.0)
73
- parallel (1.12.1)
74
- parser (2.5.3.0)
75
- ast (~> 2.4.0)
76
- powerpack (0.1.2)
77
- pry (0.11.3)
78
- coderay (~> 1.1.0)
79
- method_source (~> 0.9.0)
80
- pry-byebug (3.7.0)
81
- byebug (~> 11.0)
82
- pry (~> 0.10)
83
- public_suffix (4.0.5)
84
- rack (2.2.3)
85
- rainbow (3.0.0)
69
+ parallel (1.21.0)
70
+ parser (3.1.0.0)
71
+ ast (~> 2.4.1)
72
+ pry (0.14.1)
73
+ coderay (~> 1.1)
74
+ method_source (~> 1.0)
75
+ public_suffix (4.0.6)
76
+ racc (1.6.1)
77
+ rack (3.0.7)
78
+ rainbow (3.1.1)
86
79
  rake (13.0.1)
87
- rb-fsevent (0.10.3)
88
- rb-inotify (0.9.10)
89
- ffi (>= 0.5.0, < 2)
80
+ rb-fsevent (0.11.1)
81
+ rb-inotify (0.10.1)
82
+ ffi (~> 1.0)
83
+ rexml (3.2.5)
90
84
  rspec (3.7.0)
91
85
  rspec-core (~> 3.7.0)
92
86
  rspec-expectations (~> 3.7.0)
@@ -100,36 +94,33 @@ GEM
100
94
  diff-lcs (>= 1.2.0, < 2.0)
101
95
  rspec-support (~> 3.7.0)
102
96
  rspec-support (3.7.1)
103
- rubocop (0.61.1)
97
+ rubocop (0.80.1)
104
98
  jaro_winkler (~> 1.5.1)
105
99
  parallel (~> 1.10)
106
- parser (>= 2.5, != 2.5.1.1)
107
- powerpack (~> 0.1)
100
+ parser (>= 2.7.0.1)
108
101
  rainbow (>= 2.2.2, < 4.0)
102
+ rexml
109
103
  ruby-progressbar (~> 1.7)
110
- unicode-display_width (~> 1.4.0)
111
- ruby-progressbar (1.10.0)
112
- ruby_dep (1.5.0)
113
- savon (2.11.2)
104
+ unicode-display_width (>= 1.4.0, < 1.7)
105
+ ruby-progressbar (1.11.0)
106
+ savon (2.12.1)
114
107
  akami (~> 1.2)
115
108
  builder (>= 2.1.2)
116
109
  gyoku (~> 1.2)
117
110
  httpi (~> 2.3)
118
- nokogiri (>= 1.4.0)
111
+ nokogiri (>= 1.8.1)
119
112
  nori (~> 2.4)
120
113
  wasabi (~> 3.4)
121
114
  shellany (0.0.1)
122
115
  socksify (1.7.1)
123
- thor (0.20.0)
124
- thread_safe (0.3.6)
125
- tzinfo (1.2.7)
126
- thread_safe (~> 0.1)
127
- unicode-display_width (1.4.0)
128
- wasabi (3.6.1)
116
+ thor (1.2.1)
117
+ tzinfo (2.0.6)
118
+ concurrent-ruby (~> 1.0)
119
+ unicode-display_width (1.6.1)
120
+ wasabi (3.7.0)
129
121
  addressable
130
122
  httpi (~> 2.0)
131
123
  nokogiri (>= 1.4.2)
132
- zeitwerk (2.4.0)
133
124
 
134
125
  PLATFORMS
135
126
  ruby
@@ -139,9 +130,8 @@ DEPENDENCIES
139
130
  guard-rspec
140
131
  mocha
141
132
  pry
142
- pry-byebug
143
133
  rspec
144
- rubocop
134
+ rubocop (~> 0.80.0)
145
135
 
146
136
  BUNDLED WITH
147
137
  2.1.4
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://travis-ci.org/eeng/afipws.svg?branch=master)](https://travis-ci.org/eeng/afipws)
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
- * 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)
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/afipws.gemspec CHANGED
@@ -21,11 +21,10 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'rspec'
22
22
  s.add_development_dependency 'mocha'
23
23
  s.add_development_dependency 'guard-rspec'
24
- s.add_development_dependency 'rubocop'
24
+ s.add_development_dependency 'rubocop', '~> 0.80.0'
25
25
  s.add_development_dependency 'pry'
26
- s.add_development_dependency 'pry-byebug'
27
26
  s.add_dependency "builder"
28
- s.add_dependency "savon", '~> 2.11.0'
27
+ s.add_dependency "savon", '~> 2.12.0'
29
28
  s.add_dependency "httpclient"
30
29
  s.add_dependency "nokogiri"
31
30
  s.add_dependency "activesupport"
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
@@ -3,5 +3,9 @@ module Afipws
3
3
  def code? _code
4
4
  false
5
5
  end
6
+
7
+ def retriable?
8
+ false
9
+ end
6
10
  end
7
11
  end
@@ -1,4 +1,13 @@
1
1
  module Afipws
2
2
  class NetworkError < Error
3
+ def initialize e, retriable: false
4
+ super e
5
+
6
+ @retriable = retriable
7
+ end
8
+
9
+ def retriable?
10
+ @retriable
11
+ end
3
12
  end
4
13
  end
@@ -1,3 +1,3 @@
1
1
  module Afipws
2
- VERSION = '2.0.0'
2
+ VERSION = '2.2.0'
3
3
  end
data/shell.nix ADDED
@@ -0,0 +1,6 @@
1
+ with import <nixpkgs> {};
2
+ mkShell {
3
+ nativeBuildInputs = [
4
+ ruby
5
+ ];
6
+ }
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  module Afipws
4
4
  describe Client do
5
- context 'manejo de errores' do
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 'HTTPClient::TimeoutError se encapsulan en NetworkError' do
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(HTTPClient::ReceiveTimeoutError, 'execution expired')
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
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,6 @@ require 'rspec'
2
2
  require 'afipws'
3
3
  require 'savon/mock/spec_helper'
4
4
  require 'mocha'
5
- require 'pry-byebug'
6
5
 
7
6
  Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f }
8
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: afipws
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emmanuel Nicolau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-28 00:00:00.000000000 Z
11
+ date: 1980-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 0.80.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 0.80.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: pry-byebug
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: builder
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +100,14 @@ dependencies:
114
100
  requirements:
115
101
  - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: 2.11.0
103
+ version: 2.12.0
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - "~>"
123
109
  - !ruby/object:Gem::Version
124
- version: 2.11.0
110
+ version: 2.12.0
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: httpclient
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -172,11 +158,13 @@ executables:
172
158
  extensions: []
173
159
  extra_rdoc_files: []
174
160
  files:
161
+ - ".envrc"
162
+ - ".github/workflows/ci.yml"
175
163
  - ".gitignore"
176
164
  - ".rspec"
177
165
  - ".rubocop.yml"
178
166
  - ".ruby-version"
179
- - ".travis.yml"
167
+ - CHANGELOG.md
180
168
  - Gemfile
181
169
  - Gemfile.lock
182
170
  - Guardfile
@@ -185,7 +173,6 @@ files:
185
173
  - Rakefile
186
174
  - afipws.gemspec
187
175
  - bin/console
188
- - lib/CHANGELOG.md
189
176
  - lib/afipws.rb
190
177
  - lib/afipws/client.rb
191
178
  - lib/afipws/core_ext/hash.rb
@@ -202,6 +189,7 @@ files:
202
189
  - lib/afipws/ws_constancia_inscripcion.rb
203
190
  - lib/afipws/wsaa.rb
204
191
  - lib/afipws/wsfe.rb
192
+ - shell.nix
205
193
  - spec/afipws/client_spec.rb
206
194
  - spec/afipws/core_ext/hash_spec.rb
207
195
  - spec/afipws/persona_service_a100_spec.rb
@@ -291,8 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
279
  - !ruby/object:Gem::Version
292
280
  version: '0'
293
281
  requirements: []
294
- rubyforge_project: afipws
295
- rubygems_version: 2.7.3
282
+ rubygems_version: 3.2.26
296
283
  signing_key:
297
284
  specification_version: 4
298
285
  summary: Ruby client para los web services de la AFIP
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- before_install: gem install bundler -v 1.16.2