Skip to content
This repository has been archived by the owner on Aug 3, 2020. It is now read-only.

Allow non-default root URLs #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Client interface {
AccountSid() string
AuthToken() string
RootUrl() string
UpdateRoot(string)
get(url.Values, string) ([]byte, error)
post(url.Values, string) ([]byte, error)
delete(string) error
Expand Down Expand Up @@ -172,3 +173,7 @@ func (client *TwilioClient) buildUri(parts ...string) string {
}
return strings.Join(newParts, "/")
}

func (client *TwilioClient) UpdateRoot(root string) {
client.rootUrl = root + "/" + VERSION + "/Accounts/" + client.accountSid
}
3 changes: 3 additions & 0 deletions mock_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ func (client *MockClient) delete(uri string) error {
args := client.Mock.Called(nil, uri)
return args.Error(1)
}

func (client *MockClient) UpdateRoot(_ string) {
}