|
@@ 282-291 (lines=10) @@
|
| 279 |
|
* |
| 280 |
|
* @param User $user |
| 281 |
|
*/ |
| 282 |
|
public function createUser(User $user) |
| 283 |
|
{ |
| 284 |
|
$response = $this->connect('POST', self::USERS_ROUTE, [ |
| 285 |
|
'json' => $user |
| 286 |
|
]); |
| 287 |
|
$contents = $response->getBody()->getContents(); |
| 288 |
|
$userData = $this->serializer->deserialize($contents, 'array', 'json'); |
| 289 |
|
// The server will return the user ID. Set it to the model |
| 290 |
|
$user->setUserId($userData['userId']); |
| 291 |
|
} |
| 292 |
|
|
| 293 |
|
/** |
| 294 |
|
* Updates provided user |
|
@@ 701-709 (lines=9) @@
|
| 698 |
|
* @param string $actionCode |
| 699 |
|
* @return int |
| 700 |
|
*/ |
| 701 |
|
public function getUserActionOccurrences($user, $actionCode) |
| 702 |
|
{ |
| 703 |
|
$response = $this->connect('GET', new Route(self::USER_ACTION_OCCURRENCES_ROUTE, [ |
| 704 |
|
'userId' => $user instanceof User ? $user->getUserId() : $user, |
| 705 |
|
'actionCode' => $actionCode |
| 706 |
|
])); |
| 707 |
|
$contents = $response->getBody()->getContents(); |
| 708 |
|
return $this->serializer->deserialize($contents, 'array', 'json')['occurrences']; |
| 709 |
|
} |
| 710 |
|
|
| 711 |
|
/** |
| 712 |
|
* Returns information about the status of an interactionaccording to its limits |