Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Zoho CRM api version #6

Merged
merged 1 commit into from
May 21, 2024
Merged
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
10 changes: 5 additions & 5 deletions src/Clients/ZohoUrlFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ protected function baseApiUrl(ZohoModules $module): string
'CN' => 'https://www.zohoapis.com.cn/books/v3',
],
ZohoModules::CRM->value => [
'EU' => 'https://www.zohoapis.eu/crm/v3',
'US' => 'https://www.zohoapis.com/crm/v3',
'IN' => 'https://www.zohoapis.in/crm/v3',
'AU' => 'https://www.zohoapis.com.au/crm/v3',
'CN' => 'https://www.zohoapis.com.cn/crm/v3',
'EU' => 'https://www.zohoapis.eu/crm/v6',
'US' => 'https://www.zohoapis.com/crm/v6',
'IN' => 'https://www.zohoapis.in/crm/v6',
'AU' => 'https://www.zohoapis.com.au/crm/v6',
'CN' => 'https://www.zohoapis.com.cn/crm/v6',
],
ZohoModules::RECRUIT->value => [
'EU' => 'https://recruit.zoho.eu/recruit/v2',
Expand Down
11 changes: 5 additions & 6 deletions tests/Clients/ZohoUrlFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function it_build_url_for_a_module(): void
$urlFactory = app(ZohoUrlFactory::class);

$this->assertEquals(
'https://www.zohoapis.eu/crm/v3/users/4',
'https://www.zohoapis.eu/crm/v6/users/4',
$urlFactory->api(ZohoModules::CRM, '/users/4')
);

Expand All @@ -47,7 +47,7 @@ public function it_returns_the_base_urls_for_the_api(): void
$urlFactory = app(ZohoUrlFactory::class);

$this->assertEquals(
'https://www.zohoapis.eu/crm/v3',
'https://www.zohoapis.eu/crm/v6',
invade($urlFactory)->baseApiUrl(ZohoModules::CRM)
);

Expand Down Expand Up @@ -126,7 +126,7 @@ public function it_build_using_api_method(): void
$urlFactory = app(ZohoUrlFactory::class);

$this->assertEquals(
'https://www.zohoapis.eu/crm/v3/users/4',
'https://www.zohoapis.eu/crm/v6/users/4',
$urlFactory->api(ZohoModules::CRM, '/users/4')
);

Expand All @@ -141,7 +141,6 @@ public function it_build_using_api_method(): void
);
}


/** @test */
public function it_build_using_web_method(): void
{
Expand Down Expand Up @@ -169,7 +168,7 @@ public function it_adds_parameter_to_api_url()
$urlFactory = app(ZohoUrlFactory::class);

$this->assertEquals(
'https://www.zohoapis.eu/crm/v3/users/4?foo=1&bar=2&baz=3',
'https://www.zohoapis.eu/crm/v6/users/4?foo=1&bar=2&baz=3',
$urlFactory->api(ZohoModules::CRM, '/users/4', [
'foo' => 1,
'bar' => 2,
Expand All @@ -178,7 +177,7 @@ public function it_adds_parameter_to_api_url()
);

$this->assertEquals(
'https://www.zohoapis.eu/crm/v3/users/4?foo=1&bar=2&baz=3',
'https://www.zohoapis.eu/crm/v6/users/4?foo=1&bar=2&baz=3',
$urlFactory->api(ZohoModules::CRM, '/users/4?foo=1', [
'bar' => 2,
'baz' => 3,
Expand Down
26 changes: 12 additions & 14 deletions tests/Zoho/ZohoHttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ protected function tearDown(): void
}

protected array $fakeResponse = [
"users" => [
'users' => [
[
"country" => "US",
"street" => null,
"id" => "4150868000000225013",
"first_name" => "Patricia",
"last_name" => "Boyle",
'country' => 'US',
'street' => null,
'id' => '4150868000000225013',
'first_name' => 'Patricia',
'last_name' => 'Boyle',
],
],
"info" => [
"per_page" => 200,
"count" => 3,
"page" => 1,
"more_records" => false,
'info' => [
'per_page' => 200,
'count' => 3,
'page' => 1,
'more_records' => false,
],
];

Expand All @@ -68,7 +68,7 @@ public function it_can_make_a_request_using_header(): void
public function it_can_make_a_request_zoho_url_facade(): void
{
Http::fake([
'https://www.zohoapis.com/crm/v3/users' => Http::response($this->fakeResponse),
'https://www.zohoapis.com/crm/v6/users' => Http::response($this->fakeResponse),
]);

$this->assertEquals(
Expand All @@ -78,6 +78,4 @@ public function it_can_make_a_request_zoho_url_facade(): void
->json()
);
}


}
Loading