Class: NfseGyn::GerarNfse

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

Defined Under Namespace

Classes: Response

Instance Method Summary collapse

Constructor Details

#initialize(invoice) ⇒ GerarNfse

Returns a new instance of GerarNfse.



5
6
7
8
# File 'lib/nfse_gyn/gerar_nfse.rb', line 5

def initialize(invoice)
  @invoice = invoice
  @client = NfseGyn::SoapClient.new
end

Instance Method Details

#execute!Object



10
11
12
13
14
15
16
# File 'lib/nfse_gyn/gerar_nfse.rb', line 10

def execute!
  if NfseGyn.configuration.mock_mode
    NfseGyn::MockGerarNfseResponse.new(@invoice)
  else
    @client.call(:gerar_nfse, self)
  end
end

#to_xmlObject



18
19
20
# File 'lib/nfse_gyn/gerar_nfse.rb', line 18

def to_xml
  GerarNfseXML.new(@invoice).to_xml
end