Class: NfseGyn::ConsultarNfse

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

Defined Under Namespace

Classes: Response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(invoice_number, invoice_serie, invoice_type) ⇒ ConsultarNfse

Returns a new instance of ConsultarNfse.



7
8
9
10
11
12
# File 'lib/nfse_gyn/consultar_nfse.rb', line 7

def initialize(invoice_number, invoice_serie, invoice_type)
  @client = NfseGyn::SoapClient.new
  @invoice_number = invoice_number
  @invoice_serie = invoice_serie
  @invoice_type = invoice_type
end

Instance Attribute Details

#invoice_numberObject (readonly)

Returns the value of attribute invoice_number.



3
4
5
# File 'lib/nfse_gyn/consultar_nfse.rb', line 3

def invoice_number
  @invoice_number
end

#invoice_serieObject (readonly)

Returns the value of attribute invoice_serie.



4
5
6
# File 'lib/nfse_gyn/consultar_nfse.rb', line 4

def invoice_serie
  @invoice_serie
end

#invoice_typeObject (readonly)

Returns the value of attribute invoice_type.



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

def invoice_type
  @invoice_type
end

Instance Method Details

#execute!Object



14
15
16
17
18
19
20
# File 'lib/nfse_gyn/consultar_nfse.rb', line 14

def execute!
  if NfseGyn.configuration.mock_mode
    NfseGyn::MockConsultarNfseResponse.new(invoice_number, invoice_serie, invoice_type)
  else
    @client.call(:consultar_nfse_rps, self)
  end
end

#to_xmlObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/nfse_gyn/consultar_nfse.rb', line 22

def to_xml
  Gyoku.xml(
    'ConsultarNfseRpsEnvio' => {
      '@xmlns' => 'http://nfse.goiania.go.gov.br/xsd/nfse_gyn_v02.xsd',

      'IdentificacaoRps' => {
        'Numero' => invoice_number,
        'Serie' => invoice_serie,
        'Tipo' => invoice_type
      },
      'Prestador' => {
        'CpfCnpj' => {
          'Cnpj' => NfseGyn.configuration.cnpj
        },
        'InscricaoMunicipal' => NfseGyn.configuration.inscricao_municipal
      }
    }
  )
end