class Transmitenota::Nfe
Public Instance Methods
cancelar_nfe()
click to toggle source
# File lib/transmitenota.rb, line 58 def cancelar_nfe puts 'teste' end
configuration()
click to toggle source
The configuration instance
# File lib/transmitenota.rb, line 24 def configuration @configuration ||= Transmitenota::Config.new end
consultar_nfe(nota)
click to toggle source
# File lib/transmitenota.rb, line 40 def consultar_nfe(nota) puts json = nota.to_json puts '### consultando nota ###' http = HTTPClient.new http.receive_timeout = 30000 response = http.post(url + "ConsultarEmissaoNotaNfe/", json.encode("utf-8"), set_header) puts response.body end
enviar_email_nfe(nota)
click to toggle source
# File lib/transmitenota.rb, line 49 def enviar_email_nfe(nota) puts json = nota.to_json puts '### enviando nota por email ###' http = HTTPClient.new http.receive_timeout = 30000 response = http.post(url + "EnviarEmailNfe/", json.encode("utf-8"), set_header) puts response.body end
enviar_nfe(nota)
click to toggle source
# File lib/transmitenota.rb, line 28 def enviar_nfe(nota) puts json = nota.to_json puts '### enviando nota ###' http = HTTPClient.new http.receive_timeout = 30000 puts url + "EnviarNfe/" response = http.post(url + "EnviarNfe/", json.encode(@configuration.encoding), set_header) #response.body puts obj = JSON.parse(response.body) searchkey = obj['searchkey'] end
set_header()
click to toggle source
# File lib/transmitenota.rb, line 62 def set_header headers = { 'Content-Type' => 'application/json', } end
url()
click to toggle source
# File lib/transmitenota.rb, line 14 def url if @configuration.environment == :production 'prod' elsif @configuration.environment == :sandbox "http://api1.transmitenota.com.br/api/homologacao/" #"http://localhost:8080/" end end