mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-21 18:24:26 +08:00
code refactor
This commit is contained in:
@@ -2,6 +2,7 @@ package exchangerates
|
||||
|
||||
import (
|
||||
"math"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -27,9 +28,21 @@ type CzechNationalBankDataSource struct {
|
||||
ExchangeRatesDataSource
|
||||
}
|
||||
|
||||
// GetRequestUrls returns the czech nation bank data source urls
|
||||
func (e *CzechNationalBankDataSource) GetRequestUrls() []string {
|
||||
return []string{czechNationalBankMonthlyOtherExchangeRateUrl, czechNationalBankDailyExchangeRateUrl}
|
||||
// BuildRequests returns the Czech National Bank exchange rates http requests
|
||||
func (e *CzechNationalBankDataSource) BuildRequests() ([]*http.Request, error) {
|
||||
monthlyReq, err := http.NewRequest("GET", czechNationalBankMonthlyOtherExchangeRateUrl, nil)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dailyReq, err := http.NewRequest("GET", czechNationalBankDailyExchangeRateUrl, nil)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return []*http.Request{monthlyReq, dailyReq}, nil
|
||||
}
|
||||
|
||||
// Parse returns the common response entity according to the czech nation bank data source raw response
|
||||
|
||||
Reference in New Issue
Block a user