Highjhacker / Ark-Elixir

Ark API Wrapper in Elixir
MIT License
11 stars 0 forks source link

Fix Delegate.get_delegate to work with public keys #2

Closed insanedefaults closed 6 years ago

insanedefaults commented 6 years ago

I am attempting to address #1 with this small change. The two get_delegate functions have been merged into one. This function uses a case block to determine if the id passed is a username or public key. It then issues the request with the proper field in either case.

insanedefaults commented 6 years ago

I did a quick test against all delegates to make sure this works. A :true return indicates success.

iex(49)> import Ark_Elixir.Delegate
Ark_Elixir.Delegate
iex(50)> 51 == get_delegates["delegates"] |> Enum.count(& get_delegate(&1["publicKey"])["delegate"]["username"])
true