Simple wrapper for PostmonAPI
Include into your project.clj
[postmon "1.0.0"](postmon/cep "02013010")You'll get a map with CEP especification.
{:bairro "Santana", :cidade "São Paulo", :logradouro "Rua Henrique Bernardelli", :estado_info {:area_km2 "248.221,996", :codigo_ibge "35", :nome "São Paulo"}, :cep "02013010", :cidade_info {:area_km2 "1521,11", :codigo_ibge "3550308"}, :estado "SP"}Note: You don't need to format your CEP, you can use unformatted CEP string.
(postmon/city-data "SP" "Leme"){:area_km2 "402,871", :codigo_ibge "3526704"}(postmon/uf-data "SP"){:area_km2 "248.221,996", :codigo_ibge "35", :nome "São Paulo"}(postmon/pack-deliver-tracker "ect" "mocked") {:codigo "mocked" :service "ect" :historico {:local "AG Liberdade - Sao Paulo/SP" :data "02/01/2020 13:23:03" :situacao "Postado"}}Note: Postmon only supports ECT (Correios - Empresa Brasileira de Correios e Telegrafos) yet!
In case your query does return nothing from Postmon services, you will get a custom exception from slingshot! There is the exception for handling.
{:type :postmon.request/nothing-returned :message "nothing returned from postmon"}Bug reports and pull requests are welcome on GitHub at https://github.com/Rynaro/postmon-clj.
The lib is available as open source under the terms of the MIT License.