Last active
October 10, 2017 18:51
-
-
Save anchietajunior/766c8c6c45e0bdf85ace8a338dab596c to your computer and use it in GitHub Desktop.
NFE.io Integragration with HTTparty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GET AUTHORIZATION | |
HTTParty.get("https://api.nfe.io/v1/", | |
headers: {"Authorization" => "your-api-key"}) | |
# POST GENERATE INVOICE (NF) | |
HTTParty.post("https://api.nfe.io/v1/companies/company-id/serviceinvoices", | |
:body => { :borrower => { | |
:federalTaxNumber => "99999999999", | |
:name => "Anchieta Junior", | |
:email => "email@email.com", | |
:address => { | |
:country => "BRA", | |
:postalCode => "0000000", | |
:street => "Rua Tal", | |
:number => "0000", | |
:district => "Bairro Tal", | |
:city => { | |
:name => "Cidade", | |
:code => "Código da cidade" | |
}, | |
:state => "BA" | |
} | |
}, | |
:rpsNumber => "000000", | |
:cityServiceCode => "6201500", | |
:description => 'Teste, para manutenção e suporte técnico.', | |
:servicesAmount => 0.99, | |
:rps_serie => "6" | |
}.to_json, | |
:headers => { "Authorization" => "your-api-key", | |
'Content-Type' => 'application/json' } ) | |
# GET - INVOICE SEARCH | |
HTTParty.get("https://api.nfe.io/v1/companies/company-id/serviceinvoices/invoice-id", | |
headers: {"Authorization" => "your-api-key"}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment