Weble / ZohoBooksApi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getRegion in Client.php has a wrong return type and generated url is not correct

jvandervalk opened this issue · comments

Hello, i just installed version 5.0.0 and tried to connect to ZohoBooks.

I believe there is a wrong return type and endpoint return for when retrieving the region, because the code breaks and gives an error.

public function getRegion(): Region

Here it says getRegion returns a value of the type Region, which is an Abstract class, also the returntype of $this->oAuthClient->setRegion($region); return a string.

If I change the return type of the Region to string and remove the getKeyValue() in the getUrl(), the api is missing a . i guess, since the domain will be books.zohoeu.

    public function getUrl(): string
    {
        $apiUrl = self::ZOHOBOOKS_API_URL_PARTIAL_HOST;
        $domain = $this->getRegion()->getValue();
        $path = self::ZOHOBOOKS_API_URL_PATH;

        return $apiUrl . $domain . $path;
    }