-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
design changes, add Ontop placements
- Loading branch information
1 parent
8366b17
commit 2b5fa98
Showing
7 changed files
with
82 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Development | ||
/.idea/ | ||
/src/vendor/ | ||
/vendor/ | ||
/composer.lock | ||
|
||
# PHPUnit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# OnTop placement | ||
|
||
**API reference**: https://api.immobilienscout24.de/api-docs/import-export/ontop-placement/overview/ | ||
<br><br> | ||
|
||
## Get all Ontop placed real estates | ||
|
||
```php | ||
$otPlacement = new OnTopPlacement(); | ||
$otPlacement->getAll(); | ||
|
||
// placement is "showcaseplacement" (OnTopPlacement::SHOW_CASE) by default | ||
// but you can change that of course! | ||
$otPlacement->setPlacement(OnTopPlacement::PREMIUM); | ||
$otPlacement->setPlacement(OnTopPlacement::TOP); | ||
``` | ||
|
||
## Get information about OnTop placement of real estate | ||
|
||
```php | ||
$otPlacement->getOneById(int $id); | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Immoscout; | ||
|
||
use http\Exception\InvalidArgumentException; | ||
|
||
class OnTopPlacement extends ApiRequest | ||
{ | ||
public const SHOW_CASE = 'showcaseplacement'; | ||
public const PREMIUM = 'premiumplacement'; | ||
public const TOP = 'topplacement'; | ||
private const PLACEMENT_TYPES = [self::SHOW_CASE, self::PREMIUM, self::TOP]; | ||
|
||
private string $placement = self::SHOW_CASE; | ||
|
||
/** | ||
* Gets all ontop placed real estates | ||
*/ | ||
public function getAll(): array | ||
{ | ||
return $this->request(sprintf('%s/all', $this->placement)); | ||
} | ||
|
||
/** | ||
* Get one ontop placed real estate by id | ||
*/ | ||
public function getOneById(int $id): array | ||
{ | ||
return $this->request(sprintf('realestate/%s/%s', $id, $this->placement)); | ||
} | ||
|
||
public function setPlacement(string $placement): self | ||
{ | ||
if (!in_array($placement, self::PLACEMENT_TYPES, true)) { | ||
throw new InvalidArgumentException(sprintf('Placement %s is invalid.', $placement)); | ||
} | ||
|
||
$this->placement = $placement; | ||
|
||
return $this; | ||
} | ||
|
||
public function getPlacement(): string | ||
{ | ||
return $this->placement; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters