Class: ErroStrans
- Inherits:
-
Object
- Object
- ErroStrans
- Defined in:
- lib/erro.rb
Overview
Encapsula um erro de requisicao
Instance Method Summary collapse
-
#initialize(fields) ⇒ ErroStrans
constructor
A new instance of ErroStrans.
- #map ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(fields) ⇒ ErroStrans
Returns a new instance of ErroStrans.
4 5 6 7 |
# File 'lib/erro.rb', line 4 def initialize(fields) @code = fields[:code] || fields['code'] = fields[:message] || fields['message'] end |
Instance Method Details
#map ⇒ Object
13 14 15 16 17 |
# File 'lib/erro.rb', line 13 def map error = {} error[:code] = @error if @error error[:message] = if end |
#to_json ⇒ Object
9 10 11 |
# File 'lib/erro.rb', line 9 def to_json map.to_json end |