diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1b4ade0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: go +go: + - 1.4 +install: + - export PATH=$PATH:$HOME/gopath/bin +script: + - go test -v diff --git a/client.go b/client.go index b523f06..e603c21 100644 --- a/client.go +++ b/client.go @@ -4,6 +4,7 @@ import ( "encoding/json" "io/ioutil" "net/http" + "errors" "bytes" "time" "fmt" @@ -12,6 +13,10 @@ import ( // NewClient returns new Client struct func NewClient(clientID string, secret string, APIBase string) (*Client, error) { + if clientID == "" || secret == "" || APIBase == "" { + return &Client{}, errors.New("ClientID, Secret and APIBase are required to create a Client") + } + return &Client{ &http.Client{}, clientID, diff --git a/client_test.go b/client_test.go new file mode 100644 index 0000000..6f42818 --- /dev/null +++ b/client_test.go @@ -0,0 +1,12 @@ +package paypalsdk + +import ( + "testing" +) + +func TestNewClient(t *testing.T) { + _, err := NewClient("", "", "") + if err == nil { + t.Errorf("All arguments are required in NewClient()") + } +}