Class: NfseGyn::Response
- Inherits:
-
Object
show all
- Defined in:
- lib/nfse_gyn/response.rb
Instance Method Summary
collapse
Constructor Details
#initialize(payload) ⇒ Response
Returns a new instance of Response.
3
4
5
|
# File 'lib/nfse_gyn/response.rb', line 3
def initialize(payload)
@payload = payload
end
|
Instance Method Details
#class_name ⇒ Object
7
8
9
|
# File 'lib/nfse_gyn/response.rb', line 7
def class_name
self.class.to_s.split('::')[1]
end
|
#error? ⇒ Boolean
15
16
17
|
# File 'lib/nfse_gyn/response.rb', line 15
def error?
content['ListaMensagemRetorno'].present?
end
|
#error_message ⇒ Object
19
20
21
22
23
|
# File 'lib/nfse_gyn/response.rb', line 19
def error_message
if error? && content['ListaMensagemRetorno']['MensagemRetorno'].present?
content['ListaMensagemRetorno']['MensagemRetorno']['Correcao'].try(:strip)
end
end
|
#output ⇒ Object
25
26
27
28
|
# File 'lib/nfse_gyn/response.rb', line 25
def output
response = @payload.body.try(:values).try(:first)
@output ||= Nori.new.parse(response.try(:values).try(:first) || response)
end
|
#successful? ⇒ Boolean
11
12
13
|
# File 'lib/nfse_gyn/response.rb', line 11
def successful?
!error?
end
|