RobertMyles / cepR

Um pacote R para buscar informações sobre CEPs, endereços, bairros e cidades. (An R package for accessing Brazilian postal code data) :email:
https://robertmyles.github.io/cepR/.
Other
28 stars 9 forks source link

Adjust busca_cep for the API V3 #7

Closed edumucelli closed 4 years ago

edumucelli commented 4 years ago

Given the update of CEPAberto's API to the V3, here is a proposal for a fix regarding the busca_cep feature. This PR does not encompasses the other endpoints though as I had little time to work on it -- that came as a CEPAberto user that reported that cepR package was not working anymore.

It then partially addresses the #6.

Some considerations:

RobertMyles commented 4 years ago

Hi @edumucelli , thanks for your PR! I was working on this myself a few days ago, and I prefer using purrr's pluck() than map with [1]]$estado$sigla. So, for example, for the 'estado' for busca_cep():

estado = pluck(r, 1, "estado", .default = NA_character_) %>%
      pluck("sigla", .default = NA_character_)

Let me know if you're interested in modifying your PR, if not I can update the function myself.

Thanks again, Rob

RobertMyles commented 4 years ago

Ah, I've just seen that you are the maintainer of the API! Thanks so much for CEPAberto :-)

I sent you an email, but feel free to ignore that, I didn't realise it was you.

I've posted a comment on the examples repo with a problem I'm having with API v3. I understand it's probably temporary.

If you'd like to contribute more generally to cepR, I can add you as a collaborator if you'd like.

edumucelli commented 4 years ago

Alright, I am bit rust on the tidyverse world and your suggestion is way better than my approach. I will change the current PR accordingly.

I will try to contribute whenever I can, feel free to add me as collaborator, although I hope there API will stay stable and supplementary big-bang changes won't be necessary in the future :-)

RobertMyles commented 4 years ago

Great, Eduardo, thanks.