code refactor

This commit is contained in:
MaysWind
2024-11-17 13:04:07 +08:00
parent 69498003d8
commit 8f944b1b46
15 changed files with 159 additions and 43 deletions
+10 -3
View File
@@ -3,6 +3,7 @@ package exchangerates
import (
"encoding/json"
"math"
"net/http"
"strings"
"time"
@@ -129,9 +130,15 @@ func (e *BankOfCanadaExchangeRateData) ToLatestExchangeRateResponse(c core.Conte
return latestExchangeRateResp
}
// GetRequestUrls returns the bank of Canada data source urls
func (e *BankOfCanadaDataSource) GetRequestUrls() []string {
return []string{bankOfCanadaExchangeRateUrl}
// BuildRequests returns the bank of Canada exchange rates http requests
func (e *BankOfCanadaDataSource) BuildRequests() ([]*http.Request, error) {
req, err := http.NewRequest("GET", bankOfCanadaExchangeRateUrl, nil)
if err != nil {
return nil, err
}
return []*http.Request{req}, nil
}
// Parse returns the common response entity according to the bank of Canada data source raw response