Skip to content

Commit

Permalink
feat(ipstack): added currency module to IP Stack response for parser
Browse files Browse the repository at this point in the history
  • Loading branch information
eknowlton committed Nov 14, 2023
1 parent 082dedc commit cf59e44
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions iputil/ipstack/ipstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func (ips *IPStack) Parse(ip net.IP, hostname string) (parser.Response, error) {
ips.ParseTimezoneResponse(&parserResponse)
ips.ParseLocationResponse(&parserResponse)
ips.ParseConnectionResponse(&parserResponse)
ips.ParseCurrencyResponse(&parserResponse)

return parserResponse, nil
}
Expand Down Expand Up @@ -116,6 +117,18 @@ func (ips *IPStack) ParseConnectionResponse(parserResponse *parser.Response) {
}
}

func (ips *IPStack) ParseCurrencyResponse(parserResponse *parser.Response) {
if ips.response.Currency != nil {
parserResponse.Currency = parser.Currency{
Code: parserResponse.Currency.Code,
Name: parserResponse.Currency.Name,
Plural: parserResponse.Currency.Plural,
Symbol: parserResponse.Currency.Symbol,
SymbolNative: parserResponse.Currency.SymbolNative,
}
}
}

func (ips *IPStack) IsEmpty() bool {
return false
}

0 comments on commit cf59e44

Please sign in to comment.