Make url constants public

This commit is contained in:
Jumpei Tsuji
2015-03-30 20:59:38 +09:00
parent 2bba6d6800
commit 5b7829b96a

View File

@@ -13,8 +13,8 @@ import (
) )
const ( const (
sandboxURL string = "https://sandbox.itunes.apple.com/verifyReceipt" SandboxURL string = "https://sandbox.itunes.apple.com/verifyReceipt"
productionURL string = "https://buy.itunes.apple.com/verifyReceipt" ProductionURL string = "https://buy.itunes.apple.com/verifyReceipt"
) )
// Config is a configuration to initialize client // Config is a configuration to initialize client
@@ -70,11 +70,11 @@ func HandleError(status int) error {
// New creates a client object // New creates a client object
func New() Client { func New() Client {
client := Client{ client := Client{
URL: sandboxURL, URL: SandboxURL,
TimeOut: time.Second * 5, TimeOut: time.Second * 5,
} }
if os.Getenv("IAP_ENVIRONMENT") == "production" { if os.Getenv("IAP_ENVIRONMENT") == "production" {
client.URL = productionURL client.URL = ProductionURL
} }
return client return client
} }
@@ -86,11 +86,11 @@ func NewWithConfig(config Config) Client {
} }
client := Client{ client := Client{
URL: sandboxURL, URL: SandboxURL,
TimeOut: config.TimeOut, TimeOut: config.TimeOut,
} }
if config.IsProduction { if config.IsProduction {
client.URL = productionURL client.URL = ProductionURL
} }
return client return client