Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pjaskulski committed Dec 3, 2020
1 parent ae0e830 commit 8d2302a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ type NBPCurrency struct {
func NewCurrency(tableType string) *NBPCurrency
NewCurrency - function creates new currency type
func (c *NBPCurrency) CurrencyByDate(date string, code string) error
func (c *NBPCurrency) CurrencyByDate(code string, date string) error
CurrencyByDate - function downloads and writes data to exchange (exchangeC)
slice, raw data (json) still available in result field
Expand Down Expand Up @@ -164,7 +164,7 @@ func (c *NBPCurrency) CurrencyLast(code string, last int) error
last - as an alternative to date, the last <n> tables/rates
can be retrieved
func (c *NBPCurrency) CurrencyRaw(date string, last int, code string, format string) error
func (c *NBPCurrency) CurrencyRaw(code string, date string, last int, format string) error
CurrencyRaw - function downloads data in json or xml form
Expand Down Expand Up @@ -251,6 +251,7 @@ func (c *NBPCurrency) GetRawOutput() string
type NBPGold struct {
GoldRates []GoldRate
// Has unexported fields.
}
NBPGold type
Expand Down
4 changes: 2 additions & 2 deletions currency.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Parameters:
format - 'json' or 'xml'
*/
func (c *NBPCurrency) CurrencyRaw(date string, last int, code string, format string) error {
func (c *NBPCurrency) CurrencyRaw(code string, date string, last int, format string) error {
var err error

url := c.getCurrencyAddress(c.tableType, date, last, code)
Expand All @@ -129,7 +129,7 @@ Parameters:
code - ISO 4217 currency code, depending on the type of the
table available currencies may vary
*/
func (c *NBPCurrency) CurrencyByDate(date string, code string) error {
func (c *NBPCurrency) CurrencyByDate(code string, date string) error {
var err error

url := c.getCurrencyAddress(c.tableType, date, 0, code)
Expand Down
8 changes: 4 additions & 4 deletions currency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestGetCurrencyCurrent(t *testing.T) {
littleDelay()
client := NewCurrency(table)

err := client.CurrencyByDate("current", currency)
err := client.CurrencyByDate(currency, "current")
if err != nil {
t.Errorf("expected: err == nil, received: err != nil")
}
Expand Down Expand Up @@ -52,7 +52,7 @@ func TestGetCurrencyDay(t *testing.T) {
littleDelay()
client := NewCurrency(table)

err := client.CurrencyByDate(day, currency)
err := client.CurrencyByDate(currency, day)
if err != nil {
t.Errorf("expected: err == nil, received: err != nil")
}
Expand All @@ -79,7 +79,7 @@ func TestGetCurrencyDaySaturdayFailed(t *testing.T) {

client := NewCurrency(table)

err := client.CurrencyByDate(day, currency)
err := client.CurrencyByDate(currency, day)
if err == nil {
t.Errorf("expected: err != nil, received: err == nil")
}
Expand Down Expand Up @@ -221,7 +221,7 @@ func TestCurrencyCSVOutput(t *testing.T) {
want := "TABLE,DATE,AVERAGE (PLN)"

client := NewCurrency("A")
err := client.CurrencyByDate("current", "EUR")
err := client.CurrencyByDate("EUR", "current")
if err != nil {
t.Error(err)
}
Expand Down

0 comments on commit 8d2302a

Please sign in to comment.