-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
368 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
namespace ImovelWeb\Contatos; | ||
|
||
use ImovelWeb\Base\Base; | ||
|
||
final class Imobiliarias extends Base | ||
{ | ||
/** | ||
* Todas as mensagens para um anúncio. | ||
* | ||
* @param int $imobiliaria | ||
* @param int $anuncio | ||
* @return mixed | ||
*/ | ||
public function mensagensAnuncio(int $imobiliaria, int $anuncio) | ||
{ | ||
return $this->request('GET', "imobiliarias/{$imobiliaria}/anuncios/{$anuncio}/mensagens"); | ||
} | ||
|
||
/** | ||
* Todas as mensagens para uma imobiliária. | ||
* | ||
* @param int $imobiliaria | ||
* @return mixed | ||
*/ | ||
public function mensagensImobiliaria(int $imobiliaria) | ||
{ | ||
return $this->request('GET', "imobiliarias/{$imobiliaria}/mensagens"); | ||
} | ||
|
||
/** | ||
* Informação de um contato. | ||
* | ||
* @param int $imobiliaria | ||
* @param int $contato | ||
* @return mixed | ||
*/ | ||
public function contatos(int $imobiliaria, int $contato) | ||
{ | ||
return $this->request('GET', "imobiliarias/{$imobiliaria}/contatos/{$contato}"); | ||
} | ||
} |
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,27 @@ | ||
<?php | ||
namespace ImovelWeb\Contatos; | ||
|
||
use ImovelWeb\Base\Base; | ||
|
||
final class Mensagem extends Base | ||
{ | ||
/** | ||
* O smartLead de uma mensagem. | ||
* | ||
* @return mixed | ||
*/ | ||
public function smartLead(int $id) | ||
{ | ||
return $this->request('GET', "mensagen/{$id}/smartLead"); | ||
} | ||
|
||
/** | ||
* Uma mensagem pelo ID. | ||
* | ||
* @return mixed | ||
*/ | ||
public function visualizar(int $id) | ||
{ | ||
return $this->request('GET', "mensagens/{$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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
namespace ImovelWeb\Tests\Contatos; | ||
|
||
use GuzzleHttp\Psr7\Response; | ||
use ImovelWeb\Contatos\Imobiliarias; | ||
use ImovelWeb\Tests\Base\Base; | ||
|
||
final class ImobiliariasTest extends Base | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function imobiliariasMensagensAnuncio() | ||
{ | ||
$handleResponse = $this->fixture(__FUNCTION__, 'Responses'); | ||
$handlerStack = [new Response(200, [], $handleResponse)]; | ||
|
||
$this->client = $this->getClient($handlerStack); | ||
$this->service = new Imobiliarias($this->client); | ||
|
||
$result = $this->service->mensagensAnuncio( | ||
$this->faker->randomNumber(4), | ||
$this->faker->randomNumber(4) | ||
); | ||
|
||
$this->assertArrayHasKey('content', $result); | ||
$this->assertArrayHasKey('number', $result); | ||
$this->assertArrayHasKey('size', $result); | ||
$this->assertArrayHasKey('total', $result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function imobiliariasMensagensImobiliaria() | ||
{ | ||
$handleResponse = $this->fixture(__FUNCTION__, 'Responses'); | ||
$handlerStack = [new Response(200, [], $handleResponse)]; | ||
|
||
$this->client = $this->getClient($handlerStack); | ||
$this->service = new Imobiliarias($this->client); | ||
|
||
$result = $this->service->mensagensImobiliaria( | ||
$this->faker->randomNumber(4), | ||
$this->faker->randomNumber(4) | ||
); | ||
|
||
$this->assertArrayHasKey('content', $result); | ||
$this->assertArrayHasKey('number', $result); | ||
$this->assertArrayHasKey('size', $result); | ||
$this->assertArrayHasKey('total', $result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function imobiliariasContatos() | ||
{ | ||
$handleResponse = $this->fixture(__FUNCTION__, 'Responses'); | ||
$handlerStack = [new Response(200, [], $handleResponse)]; | ||
|
||
$this->client = $this->getClient($handlerStack); | ||
$this->service = new Imobiliarias($this->client); | ||
|
||
$result = $this->service->contatos( | ||
$this->faker->randomNumber(4), | ||
$this->faker->randomNumber(4) | ||
); | ||
|
||
$this->assertArrayHasKey('cuestionarios', $result); | ||
$this->assertArrayHasKey('idContacto', $result); | ||
$this->assertArrayHasKey('smartlead', $result); | ||
} | ||
} |
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,53 @@ | ||
<?php | ||
namespace ImovelWeb\Tests\Contatos; | ||
|
||
use GuzzleHttp\Psr7\Response; | ||
use ImovelWeb\Contatos\Mensagem; | ||
use ImovelWeb\Tests\Base\Base; | ||
|
||
final class MensagemTest extends Base | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function mensagemSmartLead() | ||
{ | ||
$handleResponse = $this->fixture(__FUNCTION__, 'Responses'); | ||
$handlerStack = [new Response(200, [], $handleResponse)]; | ||
|
||
$this->client = $this->getClient($handlerStack); | ||
$this->service = new Mensagem($this->client); | ||
|
||
$result = $this->service->smartLead($this->faker->randomNumber(4)); | ||
|
||
$this->assertArrayHasKey('codigoMensaje', $result); | ||
$this->assertArrayHasKey('mensaje', $result); | ||
$this->assertArrayHasKey('smartlead', $result); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function mensagemVisualizar() | ||
{ | ||
$handleResponse = $this->fixture(__FUNCTION__, 'Responses'); | ||
$handlerStack = [new Response(200, [], $handleResponse)]; | ||
|
||
$this->client = $this->getClient($handlerStack); | ||
$this->service = new Mensagem($this->client); | ||
|
||
$result = $this->service->visualizar($this->faker->randomNumber(4)); | ||
|
||
$this->assertArrayHasKey('codigoAviso', $result); | ||
$this->assertArrayHasKey('email', $result); | ||
$this->assertArrayHasKey('fecha', $result); | ||
$this->assertArrayHasKey('id', $result); | ||
$this->assertArrayHasKey('idAvisoNavplat', $result); | ||
$this->assertArrayHasKey('idContacto', $result); | ||
$this->assertArrayHasKey('idContactoAccion', $result); | ||
$this->assertArrayHasKey('idMensaje', $result); | ||
$this->assertArrayHasKey('nombre', $result); | ||
$this->assertArrayHasKey('telefono', $result); | ||
$this->assertArrayHasKey('textoMensaje', $result); | ||
} | ||
} |
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,64 @@ | ||
{ | ||
"cuestionarios": [ | ||
{ | ||
"cuestionario": [ | ||
{ | ||
"pregunta": "string", | ||
"respuesta": "string" | ||
} | ||
], | ||
"tipoOperacion": "string" | ||
} | ||
], | ||
"idContacto": 0, | ||
"smartlead": { | ||
"ambientes": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"antiguedad": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"banios": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"cantidadAvisosVistos": 0, | ||
"contactos": 0, | ||
"empezoABuscarHaceXDias": 0, | ||
"habitaciones": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"porcentajeAvisosConExpensas": 0, | ||
"porcentajeAvisosConGarage": 0, | ||
"precio": { | ||
"max": 0, | ||
"min": 0, | ||
"moneda": "string" | ||
}, | ||
"rangoDeExpensas": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"superficieCubiertaXm2": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"superficieTotalXm2": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"tipoDeBusqueda": { | ||
"operacion": "string", | ||
"tipoPropiedad": "string" | ||
}, | ||
"ubicacionesContactadas": [ | ||
{ | ||
"nombre": "string", | ||
"porcentajeDeContactos": 0 | ||
} | ||
] | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/Contatos/Responses/imobiliariasMensagensAnuncio.json
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,21 @@ | ||
{ | ||
"content": [ | ||
{ | ||
"codigoAviso": "string", | ||
"email": "string", | ||
"fecha": "2020-12-21T16:36:02.880Z", | ||
"id": 0, | ||
"idAvisoNavplat": 0, | ||
"idContacto": 0, | ||
"idContactoAccion": 0, | ||
"idMensaje": 0, | ||
"nombre": "string", | ||
"telefono": "string", | ||
"textoMensaje": "string" | ||
} | ||
], | ||
"number": 0, | ||
"size": 0, | ||
"total": 0 | ||
} | ||
|
20 changes: 20 additions & 0 deletions
20
tests/Contatos/Responses/imobiliariasMensagensImobiliaria.json
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,20 @@ | ||
{ | ||
"content": [ | ||
{ | ||
"codigoAviso": "string", | ||
"email": "string", | ||
"fecha": "2020-12-21T16:36:02.887Z", | ||
"id": 0, | ||
"idAvisoNavplat": 0, | ||
"idContacto": 0, | ||
"idContactoAccion": 0, | ||
"idMensaje": 0, | ||
"nombre": "string", | ||
"telefono": "string", | ||
"textoMensaje": "string" | ||
} | ||
], | ||
"number": 0, | ||
"size": 0, | ||
"total": 0 | ||
} |
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,54 @@ | ||
{ | ||
"codigoMensaje": "string", | ||
"mensaje": "string", | ||
"smartlead": { | ||
"ambientes": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"antiguedad": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"banios": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"cantidadAvisosVistos": 0, | ||
"contactos": 0, | ||
"empezoABuscarHaceXDias": 0, | ||
"habitaciones": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"porcentajeAvisosConExpensas": 0, | ||
"porcentajeAvisosConGarage": 0, | ||
"precio": { | ||
"max": 0, | ||
"min": 0, | ||
"moneda": "string" | ||
}, | ||
"rangoDeExpensas": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"superficieCubiertaXm2": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"superficieTotalXm2": { | ||
"max": 0, | ||
"min": 0 | ||
}, | ||
"tipoDeBusqueda": { | ||
"operacion": "string", | ||
"tipoPropiedad": "string" | ||
}, | ||
"ubicacionesContactadas": [ | ||
{ | ||
"nombre": "string", | ||
"porcentajeDeContactos": 0 | ||
} | ||
] | ||
} | ||
} |
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,13 @@ | ||
{ | ||
"codigoAviso": "string", | ||
"email": "string", | ||
"fecha": "2020-12-21T16:36:02.892Z", | ||
"id": 0, | ||
"idAvisoNavplat": 0, | ||
"idContacto": 0, | ||
"idContactoAccion": 0, | ||
"idMensaje": 0, | ||
"nombre": "string", | ||
"telefono": "string", | ||
"textoMensaje": "string" | ||
} |