afipws 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 481dd3449d5658b7d7222c4e041d7a4efe8d095d
4
- data.tar.gz: 092b5b8ded81405f91cb9665d0a2bff98a310096
3
+ metadata.gz: c04ecc136f57b95ee4e7fa573088cc2090707a6c
4
+ data.tar.gz: 6525c8ec8aaca3fa71e85ce1b0c707788d00f7c1
5
5
  SHA512:
6
- metadata.gz: 7e5be4d4543156ffed6574a0739c1dd58b56068c256e57030fe2b0a86d74af5de15fb77d624b7ab5a14df59baa251d59134ae66d9c82ee39977edee62e05d4bc
7
- data.tar.gz: 2d88703b4e60a13b27d69f2d337d0bda512348a77758bf70263747543c61e58a5673e7396d03cbf558d7eb7b81030aa94145a5be871295e94f59ad8c8b566ad1
6
+ metadata.gz: e72031f2743622a36234d3100804c3deefa2ceb49de6117b5753bd7af80714c003adeb547067eb9390bdd928b2bb6eb1e6cd187d44f8c77139c9b4eb05a92d15
7
+ data.tar.gz: 77629e1f045924abb0335c78cd41402304cfe8d1e8dfe37fda38e2085e54d25ec52ecd4cc96f527103890337f456b765101fbb0f2cc2869ccfbb5862e81e7319
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- afipws (1.2.0)
4
+ afipws (1.2.1)
5
5
  activesupport
6
6
  builder
7
7
  nokogiri
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- activesupport (5.2.0)
13
+ activesupport (5.2.3)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 0.7, < 2)
16
16
  minitest (~> 5.1)
@@ -22,7 +22,7 @@ GEM
22
22
  builder (3.2.3)
23
23
  byebug (11.0.1)
24
24
  coderay (1.1.2)
25
- concurrent-ruby (1.0.5)
25
+ concurrent-ruby (1.1.5)
26
26
  diff-lcs (1.3)
27
27
  ffi (1.9.25)
28
28
  formatador (0.2.5)
@@ -42,10 +42,10 @@ GEM
42
42
  rspec (>= 2.99.0, < 4.0)
43
43
  gyoku (1.3.1)
44
44
  builder (>= 2.1.2)
45
- httpi (2.4.3)
45
+ httpi (2.4.4)
46
46
  rack
47
47
  socksify
48
- i18n (1.0.1)
48
+ i18n (1.6.0)
49
49
  concurrent-ruby (~> 1.0)
50
50
  jaro_winkler (1.5.1)
51
51
  listen (3.1.5)
@@ -54,13 +54,13 @@ GEM
54
54
  ruby_dep (~> 1.2)
55
55
  lumberjack (1.0.13)
56
56
  method_source (0.9.0)
57
- mini_portile2 (2.3.0)
57
+ mini_portile2 (2.4.0)
58
58
  minitest (5.11.3)
59
59
  mocha (0.9.10)
60
60
  rake
61
61
  nenv (0.3.0)
62
- nokogiri (1.8.4)
63
- mini_portile2 (~> 2.3.0)
62
+ nokogiri (1.10.3)
63
+ mini_portile2 (~> 2.4.0)
64
64
  nori (2.6.0)
65
65
  notiffany (0.1.1)
66
66
  nenv (~> 0.1)
@@ -75,7 +75,7 @@ GEM
75
75
  pry-byebug (3.7.0)
76
76
  byebug (~> 11.0)
77
77
  pry (~> 0.10)
78
- rack (2.0.6)
78
+ rack (2.0.7)
79
79
  rainbow (3.0.0)
80
80
  rake (10.4.2)
81
81
  rb-fsevent (0.10.3)
data/lib/afipws.rb CHANGED
@@ -10,7 +10,7 @@ require 'nokogiri'
10
10
  require 'active_support'
11
11
  require 'active_support/core_ext'
12
12
  require 'afipws/core_ext/hash'
13
- require 'afipws/excepciones'
13
+ require 'afipws/wserror'
14
14
  require 'afipws/type_conversions'
15
15
  require 'afipws/client'
16
16
  require 'afipws/wsaa'
@@ -1,3 +1,3 @@
1
1
  module Afipws
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
@@ -1,13 +1,19 @@
1
1
  module Afipws
2
2
  class WSError < StandardError
3
3
  attr_reader :errors
4
+
4
5
  def initialize errors
5
6
  if errors.is_a? Array
6
7
  super errors.map { |e| "#{e[:code]}: #{e[:msg]}" }.join '; '
7
8
  @errors = errors
8
9
  else
9
10
  super
11
+ @errors = []
10
12
  end
11
13
  end
14
+
15
+ def code? code
16
+ @errors.any? { |e| e[:code].to_s == code.to_s }
17
+ end
12
18
  end
13
19
  end
@@ -69,7 +69,12 @@ module Afipws
69
69
 
70
70
  it 'cuando la moneda no existe' do
71
71
  savon.expects(:fe_param_get_cotizacion).with(message: auth.merge(mon_id: 'PES')).returns(fixture('wsfe/fe_param_get_cotizacion/inexistente'))
72
- -> { ws.cotizacion('PES') }.should raise_error WSError, /602: Sin Resultados/
72
+ -> { ws.cotizacion('PES') }.should raise_error { |error|
73
+ error.should be_a WSError
74
+ error.message.should match /602: Sin Resultados/
75
+ error.code?(602).should be true
76
+ error.code?(603).should be false
77
+ }
73
78
  end
74
79
  end
75
80
 
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: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emmanuel Nicolau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-15 00:00:00.000000000 Z
11
+ date: 2019-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -172,7 +172,6 @@ files:
172
172
  - lib/afipws.rb
173
173
  - lib/afipws/client.rb
174
174
  - lib/afipws/core_ext/hash.rb
175
- - lib/afipws/excepciones.rb
176
175
  - lib/afipws/persona_service_a100.rb
177
176
  - lib/afipws/persona_service_a4.rb
178
177
  - lib/afipws/type_conversions.rb
@@ -180,6 +179,7 @@ files:
180
179
  - lib/afipws/w_cons_declaracion.rb
181
180
  - lib/afipws/ws_constancia_inscripcion.rb
182
181
  - lib/afipws/wsaa.rb
182
+ - lib/afipws/wserror.rb
183
183
  - lib/afipws/wsfe.rb
184
184
  - spec/afipws/core_ext/hash_spec.rb
185
185
  - spec/afipws/persona_service_a100_spec.rb