afipws 2.1.0 → 2.3.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: c62722b5dadabc183a975922b0177b63d8bce82c24fafdd35e74240856b25d8e
4
- data.tar.gz: b1a0f1ce2a252d730fee01a0830fc3d2142b50df33c13864b95854bdffa856ca
3
+ metadata.gz: 06c593e69f4ee8e1d8a9ebb1737eab6fbbc67000cd7cd1c765452b9cbb0d163b
4
+ data.tar.gz: 3ca8cb1302e496bcc60911cf13ef84b1c89b70b8a7abf56b0e658e49d4457a4e
5
5
  SHA512:
6
- metadata.gz: 969630cf2f9cb2b9ae629a61f0c0cdfe79832825ea6a6fe43745d341b5b29b1117ce230567ed0e9fd27ff22f73936135bf1c4cfc6aed856fb5090ec1eeadd9eb
7
- data.tar.gz: 4601ea842fcd9d84ed968fd6e8a0d11e7304353b92782dfe79ad18d6894d8c8eada013b893d8ea0f424ac004722cee6edd9e879513204d7cb354321dfb16ad75
6
+ metadata.gz: c708d15931cd8d67df57d8228e21d86e2eac85ca46439d3357856c779109293907105ff47a9e274dc38b6957f64daf4266bfd102f18da7a487bb08e49fbf79d4
7
+ data.tar.gz: 5199b2e3d64d98f56b6e71c487b6677feb5332a81f9f5181f3a54e20b95e91270f6ce5a172ae9421d43ab9c82494d1386f76daa88a86f736dbc2b959ff2668d7
data/.envrc CHANGED
@@ -1,2 +1 @@
1
- layout ruby
2
- use nix
1
+ use ruby-version
@@ -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,4 +5,5 @@ spec/manual/*.key
5
5
  spec/manual/*.crt
6
6
  .DS_Store
7
7
  tmp
8
- /.direnv
8
+ /.direnv
9
+ /keys
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.5
1
+ 3.3.4
data/CHANGELOG.md CHANGED
@@ -4,13 +4,17 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
- ## [2.0.0] - 2020-10-28
7
+ ## [2.3.0] - 2024-07-13
8
8
 
9
- ### Added
9
+ - Upgrade Ruby to 3.3.4
10
+ - Upgrade Savon to 2.15.1
10
11
 
11
- - Long overdue CHANGELOG file.
12
- - Include `httpclient` dependency so we can wrap network errors.
12
+ ## [2.2.0] - 2023-03-19
13
13
 
14
- ### Changed
14
+ - Handle Savon::HTTPError
15
15
 
16
+ ## [2.0.0] - 2020-10-28
17
+
18
+ - Long overdue CHANGELOG file.
19
+ - Include `httpclient` dependency so we can wrap network errors.
16
20
  - Rename `Afipws::WSError` to `Afipws::Error`, and create subclasses to distinguish between different types of errors.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ ruby File.read(".ruby-version").strip
2
+
1
3
  source "http://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in afipws.gemspec
data/Gemfile.lock CHANGED
@@ -1,34 +1,50 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- afipws (2.1.0)
4
+ afipws (2.3.0)
5
5
  activesupport
6
6
  builder
7
7
  httpclient
8
8
  nokogiri
9
- savon (~> 2.12.0)
9
+ savon (~> 2.15.0)
10
10
 
11
11
  GEM
12
12
  remote: http://rubygems.org/
13
13
  specs:
14
- activesupport (7.0.2.2)
14
+ activesupport (7.1.3.4)
15
+ base64
16
+ bigdecimal
15
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ connection_pool (>= 2.2.5)
19
+ drb
16
20
  i18n (>= 1.6, < 2)
17
21
  minitest (>= 5.1)
22
+ mutex_m
18
23
  tzinfo (~> 2.0)
19
- addressable (2.8.0)
20
- public_suffix (>= 2.0.2, < 5.0)
21
- akami (1.3.1)
24
+ addressable (2.8.7)
25
+ public_suffix (>= 2.0.2, < 7.0)
26
+ akami (1.3.3)
27
+ base64
22
28
  gyoku (>= 0.4.0)
23
29
  nokogiri
24
- ast (2.4.2)
25
- builder (3.2.4)
30
+ base64 (0.2.0)
31
+ bigdecimal (3.1.8)
32
+ builder (3.3.0)
26
33
  coderay (1.1.3)
27
- concurrent-ruby (1.1.9)
28
- diff-lcs (1.3)
29
- ffi (1.15.5)
34
+ concurrent-ruby (1.3.3)
35
+ connection_pool (2.4.1)
36
+ date (3.3.4)
37
+ diff-lcs (1.5.1)
38
+ drb (2.2.1)
39
+ faraday (2.10.0)
40
+ faraday-net_http (>= 2.0, < 3.2)
41
+ logger
42
+ faraday-net_http (3.1.0)
43
+ net-http
44
+ ffi (1.17.0)
45
+ ffi (1.17.0-x86_64-linux-gnu)
30
46
  formatador (1.1.0)
31
- guard (2.18.0)
47
+ guard (2.18.1)
32
48
  formatador (>= 0.2.4)
33
49
  listen (>= 2.7, < 4.0)
34
50
  lumberjack (>= 1.0.12, < 2.0)
@@ -42,88 +58,106 @@ GEM
42
58
  guard (~> 2.1)
43
59
  guard-compat (~> 1.1)
44
60
  rspec (>= 2.99.0, < 4.0)
45
- gyoku (1.3.1)
61
+ gyoku (1.4.0)
46
62
  builder (>= 2.1.2)
63
+ rexml (~> 3.0)
47
64
  httpclient (2.8.3)
48
- httpi (2.5.0)
49
- rack
50
- socksify
51
- i18n (1.10.0)
65
+ httpi (4.0.3)
66
+ base64
67
+ mutex_m
68
+ nkf
69
+ rack (>= 2.0, < 4)
70
+ i18n (1.14.5)
52
71
  concurrent-ruby (~> 1.0)
53
- jaro_winkler (1.5.4)
54
- listen (3.7.1)
72
+ listen (3.9.0)
55
73
  rb-fsevent (~> 0.10, >= 0.10.3)
56
74
  rb-inotify (~> 0.9, >= 0.9.10)
57
- lumberjack (1.2.8)
58
- method_source (1.0.0)
59
- minitest (5.15.0)
75
+ logger (1.6.0)
76
+ lumberjack (1.2.10)
77
+ mail (2.8.1)
78
+ mini_mime (>= 0.1.1)
79
+ net-imap
80
+ net-pop
81
+ net-smtp
82
+ method_source (1.1.0)
83
+ mini_mime (1.1.5)
84
+ mini_portile2 (2.8.7)
85
+ minitest (5.24.1)
60
86
  mocha (0.9.10)
61
87
  rake
88
+ mutex_m (0.2.0)
62
89
  nenv (0.3.0)
63
- nokogiri (1.13.1-arm64-darwin)
90
+ net-http (0.4.1)
91
+ uri
92
+ net-imap (0.4.14)
93
+ date
94
+ net-protocol
95
+ net-pop (0.1.2)
96
+ net-protocol
97
+ net-protocol (0.2.2)
98
+ timeout
99
+ net-smtp (0.5.0)
100
+ net-protocol
101
+ nkf (0.2.0)
102
+ nokogiri (1.16.6)
103
+ mini_portile2 (~> 2.8.2)
64
104
  racc (~> 1.4)
65
- nori (2.6.0)
105
+ nokogiri (1.16.6-x86_64-linux)
106
+ racc (~> 1.4)
107
+ nori (2.7.0)
108
+ bigdecimal
66
109
  notiffany (0.1.3)
67
110
  nenv (~> 0.1)
68
111
  shellany (~> 0.0)
69
- parallel (1.21.0)
70
- parser (3.1.0.0)
71
- ast (~> 2.4.1)
72
- pry (0.14.1)
112
+ pry (0.14.2)
73
113
  coderay (~> 1.1)
74
114
  method_source (~> 1.0)
75
- public_suffix (4.0.6)
76
- racc (1.6.0)
77
- rack (2.2.3)
78
- rainbow (3.1.1)
115
+ public_suffix (6.0.0)
116
+ racc (1.8.0)
117
+ rack (3.1.7)
79
118
  rake (13.0.1)
80
- rb-fsevent (0.11.1)
81
- rb-inotify (0.10.1)
119
+ rb-fsevent (0.11.2)
120
+ rb-inotify (0.11.1)
82
121
  ffi (~> 1.0)
83
- rexml (3.2.5)
84
- rspec (3.7.0)
85
- rspec-core (~> 3.7.0)
86
- rspec-expectations (~> 3.7.0)
87
- rspec-mocks (~> 3.7.0)
88
- rspec-core (3.7.1)
89
- rspec-support (~> 3.7.0)
90
- rspec-expectations (3.7.0)
122
+ rexml (3.3.1)
123
+ strscan
124
+ rspec (3.13.0)
125
+ rspec-core (~> 3.13.0)
126
+ rspec-expectations (~> 3.13.0)
127
+ rspec-mocks (~> 3.13.0)
128
+ rspec-core (3.13.0)
129
+ rspec-support (~> 3.13.0)
130
+ rspec-expectations (3.13.1)
91
131
  diff-lcs (>= 1.2.0, < 2.0)
92
- rspec-support (~> 3.7.0)
93
- rspec-mocks (3.7.0)
132
+ rspec-support (~> 3.13.0)
133
+ rspec-mocks (3.13.1)
94
134
  diff-lcs (>= 1.2.0, < 2.0)
95
- rspec-support (~> 3.7.0)
96
- rspec-support (3.7.1)
97
- rubocop (0.80.1)
98
- jaro_winkler (~> 1.5.1)
99
- parallel (~> 1.10)
100
- parser (>= 2.7.0.1)
101
- rainbow (>= 2.2.2, < 4.0)
102
- rexml
103
- ruby-progressbar (~> 1.7)
104
- unicode-display_width (>= 1.4.0, < 1.7)
105
- ruby-progressbar (1.11.0)
106
- savon (2.12.1)
135
+ rspec-support (~> 3.13.0)
136
+ rspec-support (3.13.1)
137
+ savon (2.15.1)
107
138
  akami (~> 1.2)
108
139
  builder (>= 2.1.2)
109
140
  gyoku (~> 1.2)
110
- httpi (~> 2.3)
141
+ httpi (>= 4, < 5)
142
+ mail (~> 2.5)
111
143
  nokogiri (>= 1.8.1)
112
144
  nori (~> 2.4)
113
- wasabi (~> 3.4)
145
+ wasabi (>= 3.7, < 6)
114
146
  shellany (0.0.1)
115
- socksify (1.7.1)
116
- thor (1.2.1)
117
- tzinfo (2.0.4)
147
+ strscan (3.1.0)
148
+ thor (1.3.1)
149
+ timeout (0.4.1)
150
+ tzinfo (2.0.6)
118
151
  concurrent-ruby (~> 1.0)
119
- unicode-display_width (1.6.1)
120
- wasabi (3.7.0)
152
+ uri (0.13.0)
153
+ wasabi (5.0.2)
121
154
  addressable
122
- httpi (~> 2.0)
123
- nokogiri (>= 1.4.2)
155
+ faraday (~> 2.8)
156
+ nokogiri (>= 1.13.9)
124
157
 
125
158
  PLATFORMS
126
159
  ruby
160
+ x86_64-linux
127
161
 
128
162
  DEPENDENCIES
129
163
  afipws!
@@ -131,7 +165,9 @@ DEPENDENCIES
131
165
  mocha
132
166
  pry
133
167
  rspec
134
- rubocop (~> 0.80.0)
168
+
169
+ RUBY VERSION
170
+ ruby 3.3.4p94
135
171
 
136
172
  BUNDLED WITH
137
- 2.1.4
173
+ 2.5.15
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://app.travis-ci.com/eeng/afipws.svg?branch=master)](https://app.travis-ci.com/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,10 +21,9 @@ 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', '~> 0.80.0'
25
24
  s.add_development_dependency 'pry'
26
25
  s.add_dependency "builder"
27
- s.add_dependency "savon", '~> 2.12.0'
26
+ s.add_dependency "savon", '~> 2.15.0'
28
27
  s.add_dependency "httpclient"
29
28
  s.add_dependency "nokogiri"
30
29
  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.1.0'
2
+ VERSION = '2.3.0'
3
3
  end
@@ -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
@@ -22,12 +22,6 @@ module Afipws
22
22
  end
23
23
  end
24
24
 
25
- context 'codificación del tra' do
26
- it 'debería quitarle el header y footer' do
27
- subject.codificar_tra(OpenSSL::PKCS7.new).should_not include 'BEGIN', 'END'
28
- end
29
- end
30
-
31
25
  context 'login' do
32
26
  it 'debería mandar el TRA al WS y obtener el TA' do
33
27
  ws = WSAA.new key: 'key', cert: 'cert'
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.1.0
4
+ version: 2.3.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: 1980-01-01 00:00:00.000000000 Z
11
+ date: 2024-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.80.0
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.80.0
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: pry
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +86,14 @@ dependencies:
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: 2.12.0
89
+ version: 2.15.0
104
90
  type: :runtime
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: 2.12.0
96
+ version: 2.15.0
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: httpclient
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -159,11 +145,11 @@ extensions: []
159
145
  extra_rdoc_files: []
160
146
  files:
161
147
  - ".envrc"
148
+ - ".github/workflows/ci.yml"
162
149
  - ".gitignore"
163
150
  - ".rspec"
164
151
  - ".rubocop.yml"
165
152
  - ".ruby-version"
166
- - ".travis.yml"
167
153
  - CHANGELOG.md
168
154
  - Gemfile
169
155
  - Gemfile.lock
@@ -189,7 +175,6 @@ files:
189
175
  - lib/afipws/ws_constancia_inscripcion.rb
190
176
  - lib/afipws/wsaa.rb
191
177
  - lib/afipws/wsfe.rb
192
- - shell.nix
193
178
  - spec/afipws/client_spec.rb
194
179
  - spec/afipws/core_ext/hash_spec.rb
195
180
  - spec/afipws/persona_service_a100_spec.rb
@@ -279,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
279
264
  - !ruby/object:Gem::Version
280
265
  version: '0'
281
266
  requirements: []
282
- rubygems_version: 3.2.26
267
+ rubygems_version: 3.5.11
283
268
  signing_key:
284
269
  specification_version: 4
285
270
  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 2.1.4
data/shell.nix DELETED
@@ -1,6 +0,0 @@
1
- with import <nixpkgs> {};
2
- mkShell {
3
- nativeBuildInputs = [
4
- ruby
5
- ];
6
- }