internal static IPDetails ConvertToIPDetails(this IPStackResponseModel resp) { return(new IP_Details { City = resp.City, Continent = resp.ContinentName, Country = resp.CountryName, Latitude = resp.Latitude, Longitude = resp.Longitude }); }
public async Task <IPDetails> GetDetails(string ip) { ip.Validate(); IPDetails details; try { IRestResponse restResp = await GetDetailsFromIpStack(ip); IsAnticipatedResponse(restResp); IPStackResponseModel resp = DeserializeResponse <IPStackResponseModel>(restResp); details = resp.ConvertToIPDetails(); } catch (Exception ex) { throw new IPServiceNotAvailableException(ex.Message, ex.InnerException); } return(details); }