Class: NfseGyn::GerarNfse::Response

Inherits:
Response show all
Defined in:
lib/nfse_gyn/gerar_nfse.rb

Direct Known Subclasses

MockGerarNfseResponse

Instance Method Summary collapse

Methods inherited from Response

#class_name, #error_message, #initialize, #link, #municipal_registration, #number, #output, #successful?, #verification_code

Constructor Details

This class inherits a constructor from NfseGyn::Response

Instance Method Details

#bodyObject



29
30
31
# File 'lib/nfse_gyn/gerar_nfse.rb', line 29

def body
  content['ListaNfse']['CompNfse']
end

#contentObject



25
26
27
# File 'lib/nfse_gyn/gerar_nfse.rb', line 25

def content
  @content ||= output['GerarNfseResposta']
end

#error?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/nfse_gyn/gerar_nfse.rb', line 33

def error?
  !content['ListaNfse'] || content['ListaMensagemRetorno']['MensagemRetorno']['Codigo'] != 'L000'
end

#errorsObject



37
38
39
40
41
42
43
44
45
46
# File 'lib/nfse_gyn/gerar_nfse.rb', line 37

def errors
  if error?
    message = content['ListaMensagemRetorno']['MensagemRetorno']
    message = [message] if message.is_a?(Hash)

    message
  end
rescue StandardError
  content
end