Exception: Afipws::WSError
- Inherits:
-
StandardError
- Object
- StandardError
- Afipws::WSError
- Defined in:
- lib/afipws/wserror.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #code?(code) ⇒ Boolean
-
#initialize(errors) ⇒ WSError
constructor
A new instance of WSError.
Constructor Details
#initialize(errors) ⇒ WSError
Returns a new instance of WSError.
5 6 7 8 9 10 11 12 13 |
# File 'lib/afipws/wserror.rb', line 5 def initialize errors if errors.is_a? Array super errors.map { |e| "#{e[:code]}: #{e[:msg]}" }.join '; ' @errors = errors else super @errors = [] end end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
3 4 5 |
# File 'lib/afipws/wserror.rb', line 3 def errors @errors end |
Instance Method Details
#code?(code) ⇒ Boolean
15 16 17 |
# File 'lib/afipws/wserror.rb', line 15 def code? code @errors.any? { |e| e[:code].to_s == code.to_s } end |