Class: BrNfe::Service::Base

Inherits:
Base show all
Includes:
Concerns::ValuesTs::ServiceV1
Defined in:
lib/br_nfe/service/base.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#certificate_pkcs12_password, #certificate_pkcs12_path, #certificate_pkcs12_value, #env, #ibge_code_of_issuer_city, #ibge_code_of_issuer_uf

Attributes inherited from ActiveModelBase

#reference

Instance Method Summary collapse

Methods included from Concerns::ValuesTs::ServiceV1

#ts_aliquota, #ts_art, #ts_bairro, #ts_cep, #ts_cnpj, #ts_codigo_cancelamento_nfse, #ts_codigo_cnae, #ts_codigo_mensagem_alerta, #ts_codigo_municipio_ibge, #ts_codigo_obra, #ts_codigo_tributacao, #ts_codigo_verificacao, #ts_complemento_endereco, #ts_cpf, #ts_date, #ts_datetime, #ts_descricao_mensagem_alerta, #ts_discriminacao, #ts_email, #ts_endereco, #ts_id_tag, #ts_indicacao_cpf_cnpj, #ts_inscricao_municipal, #ts_item_lista_servico, #ts_natureza_operacao, #ts_nome_fantasia, #ts_numero_endereco, #ts_numero_lote, #ts_numero_nfse, #ts_numero_protocolo, #ts_numero_rps, #ts_outras_informacoes, #ts_quantidade_rps, #ts_razao_social, #ts_regime_especial_tributacao, #ts_serie_rps, #ts_sim_nao, #ts_situacao_lote_rps, #ts_status_nfse, #ts_status_rps, #ts_telefone, #ts_tipo_rps, #ts_uf, #ts_valor

Methods inherited from Base

#certificado_obrigatorio?, #certificate, #certificate=, #certificate_key, #certificate_key=, #certificate_pkcs12, #certificate_pkcs12=, #client_wsdl, #client_wsdl_params, #content_xml, #env_namespace, #env_test?, #find_xml, #get_xml_dirs, #id_attribute?, #message_namespaces, #method_wsdl, #namespace_for_signature, #namespace_for_tags, #namespace_identifier, #original_response, #render_xml, #response, #response_encoding, #sign_xml, #signature_type, #signature_type?, #soap_namespaces, #soap_xml, #tag_xml, #url_wsdl, #wsdl_encoding, #xml_builder, #xml_default_dir_path, #xml_version

Methods included from Association::HaveEmitente

#emitente, #emitente=

Methods inherited from ActiveModelBase

#assign_attributes, #default_values, #initialize

Constructor Details

This class inherits a constructor from BrNfe::ActiveModelBase

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



11
12
13
# File 'lib/br_nfe/service/base.rb', line 11

def password
  @password
end

#usernameObject

Alguns orgãos emissores necessitam que seja passado junto ao XML o Usuário e Senha do acesso do sistema da prefeitura.



10
11
12
# File 'lib/br_nfe/service/base.rb', line 10

def username
  @username
end

Instance Method Details

#body_xml_pathObject



31
32
33
# File 'lib/br_nfe/service/base.rb', line 31

def body_xml_path
	[]
end

#nfse_xml_pathObject



26
27
28
29
# File 'lib/br_nfe/service/base.rb', line 26

def nfse_xml_path
	#//Envelope/Body/ConsultarLoteRpsEnvioResponse/ConsultarLoteRpsResposta
	'//*/*/*/*'
end

#requestObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/br_nfe/service/base.rb', line 35

def request
	@original_response = client_wsdl.call(method_wsdl, xml: soap_xml)
	set_response
rescue Savon::SOAPFault => error
	return @response = response_class.new(status: :soap_error, error_messages: [error.message])
rescue Savon::HTTPError => error
	return @response = response_class.new(status: :http_error, error_messages: [error.message])
rescue Exception => error
	return @response = response_class.new(status: :unknown_error, error_messages: [error.message])
end

#response_root_pathObject



22
23
24
# File 'lib/br_nfe/service/base.rb', line 22

def response_root_path
	[]
end

#xml_current_dir_pathObject

Declaro que o método ‘render_xml` irá verificar os arquivos também presentes no diretório especificado

Tipo de retorno: Array



18
19
20
# File 'lib/br_nfe/service/base.rb', line 18

def xml_current_dir_path
	["#{BrNfe.root}/lib/br_nfe/service/xml/#{xml_version}"]+super
end